【问题标题】:Issue with retrieving Magento Frontend Session检索 Magento 前端会话的问题
【发布时间】:2012-04-10 20:04:52
【问题描述】:

我正在尝试使用对 Magento 客户 API 的 AMF 调用从 Flex 应用程序中检索客户的登录状态:

Mage::app('default');
    $session = Mage::getSingleton('customer/session', array('name'=>'frontend') );
    $sessId= $session->getSessionId();
    if($session->isLoggedIn()) {
        $name = "Hi ". Mage::getModel('customer/session')->getCustomer()->getName();
        return 'true' . $name;
    } 
    else{
        return 'false ' . $sessId;
    }

仅返回 PHP 会话 ID: PHPSESSID=i5s1gcemc6r8uquadc4rsk9ou5

但是用户登录到下面的ID 前端=3qdcimcdp7nq4bi8jlovqmnq61

如果我在这里遗漏了什么,请告诉我。

【问题讨论】:

    标签: api session magento amf


    【解决方案1】:

    使用以下代码获取客户 ID

    Mage::getSingleton('core/session', array('name' => 'frontend')); 
    $customer = Mage::getSingleton('customer/session',array('name' => 'frontend'));
    echo $customerId = $customer->getCustomer()->getId();
    

    【讨论】:

      猜你喜欢
      • 2013-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-30
      • 1970-01-01
      • 2019-02-15
      • 1970-01-01
      相关资源
      最近更新 更多