magento - 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()
,但都没有成功。
如何做到这一点?
解决方案
我发现正确的方法是:
$customerID = $this->getCustomer()->getId();
推荐阅读
- python - 使用 Google Calendar API 时“Safari 无法连接到服务器”
- python - Python字典访问数据
- python - 对于deap toolbox.evaluate postional 参数错误
- java - 如何为存储库 (java) 中的文件指定路径,以便我的自动化测试不会失败
- c++ - 为什么我的向量不支持偶数和奇数
- jsp - 如何在jsp webapplication中运行后台进程
- swiftui - Swiftui 中的 AsyncImage 不显示图像
- javascript - 测试对象数组的值是否等于 Chai 中另一个数组的值
- woocommerce - Woocommerce 结帐面包屑
- django - Django`DetailView`中的对象不可调用错误