Magento: SQLSTATE [23000]: integrity violation: 1062 Duplicate record '100000001' for key 'UNQ_SALES_FLAT_ORDER_IN

I installed Magento 1.9.0.1 and I live from 1 month. The first customer order worked without problems. But now, when the order has to be processed, the following error message appears: "Error processing your order. Please contact us or try again later."

The log file says: "PDOException" exception with the message "SQLSTATE [23000]: integrity violation: 1062 Duplicate the entry" 100000001 "for the key" UNQ_SALES_FLAT_ORDER_INCREMENT_ID "in / home / www / web81 / html / lib / Zend / Db / Statement / Pdo .php: 228

I read a lot of threads and also used Google, but could not find a solution. I am new, and the store should work again tomorrow :-( I really appreciate your help!

Thanks so much for your help and best wishes.

+6
source share
4 answers

You can try the following.

In app/code/core/Mage/Sales/Model/Resource/Quote.php

Search for isOrderIncrementIdUsed Method

In this method

replace

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

with

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

----------------------------------------------- --- ---------- OR------------------------------------ --- ----------------------------------------

Go to admin-> sales-> orders and see the highest order number (for each type of store!)

Then look at your database. In the eav_entity_type table, you will find all of the listed object types. Interested in a change where the order number begins, i.e. order / order order. Remember entity_type_id.

Then go to the eav_entity_store table. Find the entity_type_id object. Now you can change the increment_last_id value to the last number of the actual order. (That is, if you want your next orderId to be 15000, set increment_last_id to 14999.)

+9
source

Try this solution. It will definitely help you.

The order number 100000001 (i.e., an incremental identifier or increment_id ) already exists in your sales_flat_order order table , and this does not allow you to save the order when someone checks because increment_ids must be unique.

First, make sure that the order numbers you see in the error messages are actually present in the sales_flat_order.increment column. Then you need to change the values โ€‹โ€‹of eav_entity_store.increment_id so that the new increment identifiers never overlap with your existing order numbers.

Check the maximum value in sales_flat_order.increment_id and update eav_entity_store.increment_id with a value greater than this.

+3
source

I really liked the answer from Empiro Technologies. I used this answer as inspiration, but took a different approach: in my case, I moved the sales_ * tables from the new database to the old copy of the database. However, I skipped the eav_entity_store table. So I just updated all the rows in one table, from database to database. This works fine in my case.

0
source

I spent a lot of time trying to diagnose the same error as me, I could not send orders through paypal with one kind of store, but I could with my other views. After looking at this post, I realized that my increment_last_id was the culprit! I recently imported old customer information / orders from oscommerce-> magento using cart2cart and placed all my orders in my default warehouse view without updating increment_last_id. After updating this int to the last imported order number, I could place orders again!

0
source

Source: https://habr.com/ru/post/979141/


All Articles