首页 > 解决方案 > Magento:在管理员中获取客户 ID

问题描述

在 Magento 1.9 中,我想获取已打开客户的 customerId Mage_Adminhtml_Block_Customer_Edit_Tab_View

我试过这样:

$customer_session = Mage::getSingleton('customer/session'); //I saw here in Stackoverflow this
$customer = $customer_session->getCustomer();
$customerID = $customer->getId();

但我得到了一个空值。

我也尝试过$this->getId()and Mage::helper('customer')->getId(),但都没有成功。

如何做到这一点?

标签: magentoadminmagento-1.9

解决方案


我发现正确的方法是:

$customerID = $this->getCustomer()->getId();


推荐阅读