[SOLVED] UNQ_SALES_FLAT_ORDER_INCREMENT_ID in Magento

5 comments 51 views

The errorUNQ_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.

magentologo

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

Jack April 18, 2014 - 6:06 pm

it works . thank you

Reply
Marc June 13, 2014 - 2:29 pm

Perfect solution, many thanks!

Reply
Vishal Sanwar July 12, 2014 - 7:04 am

Hey,

Have u ever solved this?

I had the same error code. the increment number and the last order number are not synchronize anymore. what we did is the following:

go to admin->sales-> orders and look up the highest order number (for each store view!)

Then look at your database. In the table eav_entity_type you will find all entity types listed. The one of interest to change is where the order number starts, ie. order sales/order. Remember the entity_type_id.\” (in my install it is 24)

Next go to the table eav_entity_store. Look up the entity_type_id. Now you can change the value of increment_last_id to your last actual order number. (That is, if you wanted to have your next orderId to be 15000 set increment_last_id to 14999.)

Hope that this helps.

Reply
Chief December 6, 2014 - 9:44 pm

Perfect .. solved it perfectly .. thank you 🙂

Reply
Nishit May 24, 2016 - 11:40 am

Thank you very much

Reply

Leave a Comment


Search

About Me

Jane Taylor

Jane Taylor

Passionate interior designer who love sharing knowledge and memories.
More About Me

Newsletter

Subscribe To Our Newsletter for new blog posts, tips & ideas. Let's stay updated!

Top Selling Multipurpose WP Theme

About Us

The Vortex Code

The Vortex Code

Our mission is simple: to make complex concepts accessible, ignite curiosity, and inspire innovation through our blogs and tutorials.

Newsletter

Subscribe To Our Newsletter for new blog posts, tips & ideas. Let's stay updated!

© 2013-23 TheVortexCode. All Right Reserved.