我需要通过电子邮件检索客户ID,我试过这样:
$collection = mage::getModel('customer/customer')->getCollection()
->addAttributeToSelect('customer_id')
->addAttributeToFilter('email', 'costumeremail@gmail.com')
->addAttributeToSort('customer_id', 'ASC');
echo (string)$collection->getSelect();
但它总是返回错误500; 怎么了?
有没有办法通过电子邮件检索客户信息?
答案 0 :(得分:0)
请使用标准功能magento:
$customerEmail = 'someemail@sample.com';
$ customer = Mage :: getModel('customer / customer') - > loadByEmail($ customerEmail); $ customerId = $ customer-> getId();