gpt4 book ai didi

php - 客户模型中 Magento 中的 loadByEmail 和加载方法问题

转载 作者:可可西里 更新时间:2023-11-01 13:03:11 25 4
gpt4 key购买 nike

我尝试在客户/客户模型对象中使用获取实体 ID (getEntityId()) 方法时出现错误。

请检查我的波纹管代码。

我想使用波纹管的代码。但是显示错误。

$customer = Mage::getModel("customer/customer"); 
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail('email@example.com'); //load customer by email id

虽然波纹管的​​代码工作正常。使用 getEntityId()

$id=3;
$customer = Mage::getModel('customer/customer')->load($id);

所以请给出 loadByEmail() 方法的解决方案。

最佳答案

商店网站代码错误,它应该是 Mage::app()->getStore()->getWebsiteId()

这里修改后的代码是

$customer = Mage::getModel("customer/customer"); 
$customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
$customer->loadByEmail('email@example.com')

关于php - 客户模型中 Magento 中的 loadByEmail 和加载方法问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24759015/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com