Magento:检查客户是否已登录

下面的代码片段将检查客户是否已登录。如果是,它将获取客户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
}

相关文章

0 0 投票数
文章评分
订阅评论
提醒
0 评论
最旧
最新 最多投票
内联反馈
查看所有评论