Magento getmodel没有';不行,我需要通过电子邮件检索客户ID

Magento getmodel没有';不行,我需要通过电子邮件检索客户ID,magento,Magento,我需要通过电子邮件检索客户ID,我尝试过这样做: $collection = mage::getModel('customer/customer')->getCollection() ->addAttributeToSelect('customer_id') ->addAttributeToFilter('email', 'costumeremail@gmail.com') ->addAttributeToSort('customer_id',

我需要通过电子邮件检索客户ID,我尝试过这样做:

    $collection = mage::getModel('customer/customer')->getCollection()
   ->addAttributeToSelect('customer_id')
   ->addAttributeToFilter('email', 'costumeremail@gmail.com')
   ->addAttributeToSort('customer_id', 'ASC');
echo (string)$collection->getSelect();
但它总是返回错误500; 怎么了


有没有办法通过电子邮件检索客户信息?

请使用标准功能magento:

$customerEmail = 'someemail@sample.com';
$customer=Mage::getModel('customer/customer')->loadByEmail($customerEmail);
$customerId=$customer->getId()

加载资源失败:服务器响应状态为500(内部服务器错误){“readyState”:4,“responseText”:“status”:500,“statusText”:“Internal server Error”}我将其放在根文件夹的getCustomer.php上。。我错了吗?php视图文件放在哪里?要查找错误500的原因,您需要查看服务器错误标志jeee Makajeeeee;我应该把umask(0);需要“app/Mage.php”;Mage::app()->setCurrentStore(Mage_Core_Model_app::ADMIN_STORE_ID);在头部或文件中,客户id应为实体id