Magento: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '100000001' for key 'UNQ_SALES_FLAT_ORDER_IN

前端 未结 5 1872
日久生厌
日久生厌 2021-02-06 07:55

I have installed Magento 1.9.0.1 and I am live since 1 month. The first order of a Client worked without Problem. But now following error message appears when the order should

相关标签:
5条回答
  • 2021-02-06 08:04

    You can try following.

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

    Search for isOrderIncrementIdUsed method

    In that method,

    replace

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

    with

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

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

    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.

    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.)

    0 讨论(0)
  • 2021-02-06 08:13

    I had been spending quite a bit of time trying to diagnose the same error I had, I couldn't submit orders through paypal with one store view but I could with my other views. After viewing this post I realized that my increment_last_id was the culprit! I just recently imported old customer info/orders from oscommerce->magento using cart2cart and it placed all my orders into my default store view without updating the increment_last_id. After updating that int to the last imported order number I could place orders again!

    0 讨论(0)
  • 2021-02-06 08:14

    I quite liked the answer given by Empiro Technologies. I used that answer as inspiration but took a different approach: in my case I had migrated sales_* tables from new database to old copy of database. However I had missed the eav_entity_store table. So I simply updated all of the rows across in that one table, from database to database. That worked fine in my case.

    0 讨论(0)
  • 2021-02-06 08:20

    first check into sales_flat_order table maximum increment_id and change into eav_entity_store table increment_last_id column by incrementing 1 for example your sales_flat_order table maximum increment_id is 100000001 and change eav_entity_store table increment_last_id is 100000002

    0 讨论(0)
  • 2021-02-06 08:22

    Try this solution. This would definitely help you.

    The order number 100000001 (i.e. increment ID or increment_id) already exists in your order table, sales_flat_order, and it's failing the order save when someone checks out because increment_ids must be unique.

    First, verify that you have these order numbers you see in the error messages are indeed already present in the sales_flat_order.increment column. Then, you need to modify the eav_entity_store.increment_id value(s), so that new increment IDs will never overlap with your the already 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 that.

    0 讨论(0)
提交回复
热议问题