Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/sbboke.com/wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php:409) in /www/wwwroot/sbboke.com/wp-content/themes/pacify/content-single.php on line 5

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 评论
内联反馈
查看所有评论