我使用一些迁移工具将订单导入 Magento。当回头客试图下订单时,Magento 会阻止他们这样做并说“此客户电子邮件已经存在”。尽管事实上他们已经登录到 Magento。
我是否错误地导入/迁移到 Magento 数据库?或者可能有其他原因导致这种情况?
任何建议都非常感谢。
最佳答案
您得到的异常是由客户资源模型的 _beforeSave 生成的函数,用于检查具有给定电子邮件地址的客户是否存在。
支票的代码:
$adapter = $this->_getWriteAdapter();
$bind = array('email' => $customer->getEmail());
$select = $adapter->select()
->from($this->getEntityTable(), array($this->getEntityIdField()))
->where('email = :email');
if ($customer->getSharingConfig()->isWebsiteScope()) {
$bind['website_id'] = (int)$customer->getWebsiteId();
$select->where('website_id = :website_id');
}
if ($customer->getId()) {
$bind['entity_id'] = (int)$customer->getId();
$select->where('entity_id != :entity_id');
}
$result = $adapter->fetchOne($select, $bind);
if ($result) {
throw Mage::exception(
'Mage_Customer', Mage::helper('customer')->__('This customer email already exists'),
Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS
);
}
您的客户已登录,这意味着条件
$customer->getId()
是真的。但是由于您遇到了异常(exception)情况,我建议您使用相同的电子邮件存在重复的客户帐户。可能是您的导入工具在客户数据中创建了重复项?这是我能想到的唯一原因。使用此查询检查您的数据库:
select email, count(*) from customer_entity group by email having count(*) > 1
关于订购页面 : "This customer email already exists" 上的 Magento,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14981958/