Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Order duplicated: SQLSTATE [23000]: Integrity constraint violation: 1062 Duplicate entry ‘T00008286’ for key ‘UNQ_SALES_FLAT_ORDER_INCREMENT_ID’
 
omitsis2
Jr. Member
 
Total Posts:  23
Joined:  2010-10-20
 

In some cases, customer orders and registered gives me this error when you reorder.

SQLSTATE [23000]Integrity constraint violation1062 Duplicate entry 'T00008286' for key 'UNQ_SALES_FLAT_ORDER_INCREMENT_ID'

My Magento version is 1.6.2 and I have installed a onestepcheckout (I think that its not related with the bug).

It only happens on clients who have already made a previous order. I can not confirm if those customers have canceled orders and that somehow have been left hanging. But the problem is clearly in those cases Magento is not increasing the ID of the orders and each time you want to place another order get this error of duplicate entry.

Any solution? I’m pretty desperate on this topic. I’ve seen on google that there are people with similar errors, even the same mistake in customer orders registered but have not found solution.

I’ve tried some things proposed in the net as: increasing the final value of the id in the DB, or set logs removing every day, but nothing seems to fix the problem.

Is there anybody could help me with that?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Surf Web Design
Member
 
Avatar
Total Posts:  31
Joined:  2011-07-28
Calgary, Alberta, Canada
 

Did you ever find a solution to this? I am having the same problem:

http://www.magentocommerce.com/boards/viewthread/283313/

 
Magento Community Magento Community
Magento Community
Magento Community
 
kajal
Member
 
Total Posts:  60
Joined:  2010-06-27
 

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.

 
Magento Community Magento Community
Magento Community
Magento Community
 
gilmr
Jr. Member
 
Total Posts:  10
Joined:  2011-03-01
 

Error after canceling payment and try again: integrity constraint violation

After placing an order, the payment is canceled. The customer returns with a full cart and try again. Now Magento shows the following error:

  SQLSTATE [23000]: Integrity constraint violation: 1062 Duplicate entry for key ‘UNQ_SALES_FLAT_ORDER_INCREMENT_ID’

solution

It is a bug in Magento 1.6.x and 1.7.x versions, and possibly other versions. The solution is as follows.
Copy the file / app / code / core / Mage / Sales / Model / Resource / Quote.php to
/ app / code / local / Mage / Sales / Model / Resource / Quote.php.

Change the line into the new file:

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

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

Make sure that the compiler is refreshed (if used). Go to System> Tools> Compilation and click Run Compilation Process.

thats it

 
Magento Community Magento Community
Magento Community
Magento Community
 
tmp2000
Jr. Member
 
Total Posts:  9
Joined:  2011-07-14
 
gilmr - 24 January 2013 04:25 AM

Error after canceling payment and try again: integrity constraint violation

After placing an order, the payment is canceled. The customer returns with a full cart and try again. Now Magento shows the following error:

  SQLSTATE [23000]: Integrity constraint violation: 1062 Duplicate entry for key ‘UNQ_SALES_FLAT_ORDER_INCREMENT_ID’

solution

It is a bug in Magento 1.6.x and 1.7.x versions, and possibly other versions. The solution is as follows.
Copy the file / app / code / core / Mage / Sales / Model / Resource / Quote.php to
/ app / code / local / Mage / Sales / Model / Resource / Quote.php.

Change the line into the new file:

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

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

Make sure that the compiler is refreshed (if used). Go to System> Tools> Compilation and click Run Compilation Process.

thats it

Thanks for this.It is ok for 1.7

 
Magento Community Magento Community
Magento Community
Magento Community
 
jaccoermers
Jr. Member
 
Total Posts:  30
Joined:  2013-01-23
 

Hi there,

I made the change but sometimes still get this problem. The customer that gets this problem will after that always stay stuck in this error.

Any way to solve this problem?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top