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

问题描述:

当客户在Magento的结账过程中,并被重定向到他的后台网站完成付款。如果他们取消付款和重定向回Magento的店这是不可能再下订单,我得到这个错误电子邮件:Magento - SQLSTATE [23000]:完整性约束违规:1062重复条目

SQLSTATE [23000]:完整性约束违规:1062重复项“MF00000007”关键 'UNQ_SALES_FLAT_ORDER_INCREMENT_ID',查询是:INSERT INTO sales_flat_ordercoupon_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_suffix,customer_taxvat,discount_description,global_currency_code, order_currency_code,remote_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)VALUES(?,?,?,?,?,?,?,?, ,??,?????????????????????????????????????????????? ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'2016-02-11 15:39:09' ,'2016-02-11 15:39:09',?,?,?,?,?,?,?,?)

有人可以帮我解决这个问题吗?与th的magento商店是同一个问题...

最好的问候, 罗伯特

+0

http://www.thevortexcode.com/solved-unq_sales_flat_order_increment_id-in-magento/ – Matt

+0

http://stackoverflow.com/questions/27303536/magento-sqlstate23000-integrity-constraint-violation-1062-duplicate-entry – Matt

+0

周围有很多解决方案 – Matt

复制文件app/code/core/Mage/Sales/Model/Resource/Quote.phpapp/code/local/Mage/Sales/Model/Resource/Quote.php (或创建一个自定义模块覆盖这个类)。

查找:

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

,并替换此:

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