我使用一些迁移工具将订单导入 Magento。当回头客尝试下订单时,Magento 阻止他们这样做并说“此客户电子邮件已存在”。尽管事实上他们已经登录到 Magento。
我是否错误地导入/迁移到 Magento 数据库?或者可能是其他什么原因造成的?
任何建议都非常感谢。
我使用一些迁移工具将订单导入 Magento。当回头客尝试下订单时,Magento 阻止他们这样做并说“此客户电子邮件已存在”。尽管事实上他们已经登录到 Magento。
我是否错误地导入/迁移到 Magento 数据库?或者可能是其他什么原因造成的?
任何建议都非常感谢。
The exception you get is generated by the customer resource model's _beforeSave function, which checks if a customer with the given email address exists. The check's code:
$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
);
}
You customers are logged in, which means the condition $customer->getId()
is true. But since you get an exception, I suggest, there are duplicate customer accounts with the same emails.
Can it be that your import tool has created duplicates in the customer data? That is the only reason I can think of. Check your database with this query:
select email, count(*) from customer_entity group by email having count(*) > 1