下面的代码片段将检查客户是否已登录。如果是,它将获取客户ID,客户名称和客户电子邮件
//Get the customer session and check if the customer is logged in
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
// Get the customer object from customer session
$customer = Mage::getSingleton('customer/session')->getCustomer();
$custID = $customer->getID();//get customer id
$custName = $customer->getName();//get customer full name
$custEmail = $customer->getEmail();//get customer email
}