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

标签 php magento checkout onepage-checkout

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

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'MF00000007' for key 'UNQ_SALES_FLAT_ORDER_INCREMENT_ID', query was: INSERT INTO sales_flat_order (coupon_code, protect_code, shipping_description, is_virtual, store_id, customer_id, base_discount_amount, base_grand_total, base_shipping_amount, base_shipping_tax_amount, base_subtotal, base_tax_amount, base_to_global_rate, base_to_order_rate, discount_amount, grand_total, shipping_amount, shipping_tax_amount, store_to_base_rate, store_to_order_rate, subtotal, tax_amount, total_qty_ordered, customer_is_guest, customer_note_notify, customer_group_id, quote_id, base_shipping_discount_amount, base_subtotal_incl_tax, shipping_discount_amount, subtotal_incl_tax, weight, customer_dob, increment_id, applied_rule_ids, base_currency_code, customer_email, customer_firstname, customer_lastname, customer_middlename, customer_prefix, customer_suffix, customer_taxvat, discount_description, global_currency_code, order_currency_code, remote_ip, shipping_method, store_currency_code, store_name, x_forwarded_for, customer_note, created_at, updated_at, total_item_count, customer_gender, hidden_tax_amount, base_hidden_tax_amount, shipping_hidden_tax_amount, base_shipping_hidden_tax_amnt, shipping_incl_tax, base_shipping_incl_tax, gift_message_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '2016-02-11 15:39:09', '2016-02-11 15:39:09', ?, ?, ?, ?, ?, ?, ?, ?, ?)

谁能帮我解决这个问题,我们的另一位客户也遇到了同样的问题...

最好的问候, 罗伯特

最佳答案

复制文件 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);

关于php - Magento - SQLSTATE [23000] : Integrity constraint violation: 1062 Duplicate entry,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35356489/

相关文章:

php - AuthenticationFailedServer 无法对 azure 中的请求进行身份验证

php - 如何优化从 php 输入匹配多部分 rar 文件的算法

magento - 在自定义电子邮件 magento 中添加取消订阅链接

javascript - 在哪里/如何添加自定义 js magento

Magento 版1.4.1.1 一页结账不显示paypal支付信息

javascript - 如何在 Shopify 结帐页面中包含 JavaScript

php - 结帐时的 WooCommerce 自定义字段

php - 在结账时向运费添加 Logo - WooCommerce

php - 如何在 YII 中创建迁移?

php - PHP中良好的错误处理实践-如果函数在应有的情况下未返回,该怎么办