Search This Blog

May 9, 2012

Magento: Fixed Order Number Duplication

I know that duplication of order number in magento is rare to happen but it is better to know the tables and fields that we need to edit just in case. Several instances might be the reason why this issue will arise. One of these is due to the server migration.

For example, in our case, we are migrating one of our client magento site from Hostgator server to Amazon server during the peak hours (meaning there are possibilities to have a new order in between of migration). And that happen to us, 11 orders have duplicated order number. Since they we’re using a fulfillment center to process those orders, it gives confusion to them.

So what I do to solve this issue are the following:

1. There are three tables that you need update in order to fix it
a. sales_flat_order_grid
b. sales_flat_order
c. eav_entity_store

2. Please edit the incremented_id field for both sales_flat_order_grid and sales_flat_order. Please make sure that entity id of the two table must be the same as you edit the incremented id. Edit their value by starting on the last correct order number.

3. Then, on the eav_store_entity edit the incremented_last_id value to the last incremented_id value in your sales_flat_order table. With that said magento will query the correct last incremented id and avoid further duplication.

You can now create a test order to see if the issue was fixed. For questions regarding the steps just add your comment below.