The error “UNQ_SALES_FLAT_ORDER_INCREMENT_ID” is usually seen when magento uses alphanumeric order numbers. When the old customer buys a product again, magento instead of increasing the ordre increment from the latest order, increases the increment from the last order of the same old customer. This creates a duplicate entry and magento refuses to take an order.
You can also receive an email containing “SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘AB100082765’ for key ‘UNQ_SALES_FLAT_ORDER_INCREMENT_ID‘” error or “There was an error processing your request” during placing an order.
There is an easy fix to this problem. It requires a core modification of a code which can be done if you have access to ftp credentials. It cannot be performed from backend.
[alert variation=”alert-error”]BACKUP YOUR DATABASE FIRST. I’M NOT RESPONSIBLE FOR ANYTHING THAT HAPPENS WITH THE FOLLOWING PROCESS. USE IT AT YOUR OWN RISK[/alert]
Open the ftp channel and Go to
app/code/core/Mage/Sales/Model/Resource/Quote.php
Find:
isOrderIncrementIdUsed
There at its bottom you will find a line and you will have to replace it with another code (just remove a part of code)
Replace
$bind = array(':increment_id' => (int)$orderIncrementId);
with
$bind = array(':increment_id' => $orderIncrementId);
Save it.
[signoff icon=”icon-thumbs-up”]Now the alphanumeric order will start working again.[/signoff]
5 comments