订购页面 : "This customer email already exists" 上的 Magento

标签 magento migration magento-1.6

我使用一些迁移工具将订单导入 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/

相关文章:

node.js - MongoDB 查询返回 null,即使它在从 mlab 迁移到 mongoDB atlas 后在集合中可用

VBA 更改 Excel 2002 -> Excel 2007

php - 基于类别的时事通讯电子邮件? Magento CE 1/6/2

magento-1.6 - Magento 1.6、Google 购物/产品/内容

php - magento 模块设置存储在哪里?

Magento,addAttributeToSelect,别名

Magento 缓存 - 清理缓存的规则

php - 如何在 Laravel 5.1 迁移中使用外键

php - 继续使用 PayPal 中的信用卡付款方式

magento - 从 1.7 升级到 1.9 magento