Magento - SQLSTATE[23000]:完整性约束冲突:1062 重复条目


Magento - SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

当客户在Magento的结帐过程中并被重定向到他的后台网站以完成付款时。如果他们取消付款并被重定向回magento商店,则无法再下订单,并且我收到此错误电子邮件:

SQLSTATE[23000]:完整性约束冲突:1062 键"UNQ_SALES_FLAT_ORDER_INCREMENT_ID"的重复条目"MF00000007",查询为: 插入到sales_flat_order ( coupon_codeprotect_codeshipping_descriptionis_virtualstore_idcustomer_idbase_discount_amountbase_grand_totalbase_shipping_amountbase_shipping_tax_amountbase_subtotalbase_tax_amountbase_to_global_ratebase_to_order_ratediscount_amountgrand_totalshipping_amountshipping_tax_amountstore_to_base_ratestore_to_order_ratesubtotaltax_amounttotal_qty_orderedcustomer_is_guestcustomer_note_notifycustomer_group_idquote_idbase_shipping_discount_amountbase_subtotal_incl_taxshipping_discount_amountsubtotal_incl_taxweightcustomer_dobincrement_idapplied_rule_idsbase_currency_codecustomer_emailcustomer_firstnamecustomer_lastnamecustomer_middlenamecustomer_prefixcustomer_suffixcustomer_taxvatdiscount_descriptionglobal_currency_codeorder_currency_coderemote_ipshipping_methodstore_currency_codestore_namex_forwarded_forcustomer_notecreated_atupdated_attotal_item_countcustomer_genderhidden_tax_amountbase_hidden_tax_amountshipping_hidden_tax_amountbase_shipping_hidden_tax_amntshipping_incl_taxbase_shipping_incl_taxgift_message_id ( 值 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '2016-02-11 15:39:09', '2016-02-11 15:39:09', ?, ?, ?, ?, ?, ?, ?, ?, ?(

有人可以帮我解决这个问题吗,我们有另一个客户也 magento 商店有同样的问题......

此致敬意罗伯特

将文件app/code/core/Mage/Sales/Model/Resource/Quote.php复制到app/code/local/Mage/Sales/Model/Resource/Quote.php (或创建自定义模块来覆盖此类(。

找到:

$bind = array(':increment_id' => (int)$orderIncrementId);

并将其替换为:

$bind = array(':increment_id' => $orderIncrementId);