2

I am the support developer for a project on Magento 1.3.1. There is a problem I can't reproduce. Some customers wrote that they receive emails of orders of other persons. In admin I saw that person X made an order (practically at the time as another) and it got assigned to another person. How is this possible. I spent a day without success :(

2

I'm assuming you can see this customer order overlap in the admin panel as well. From my experience, this can occur when the increment field known as entity_id from the customer_entity table and the customer_id field from sales_flat_order are out of sync.

I came across this when I had to merge two completely separate stores into one and I didn't adjust either's set of customer_ids from sales_flat_order.

If you are experiencing the issue for NEW customer accounts then you need to bump the AUTO INCREMENT value in the customer_entity table. Go to sales_flat_order.customer_id and sort descending - see what the last value is. Let's say the last value you find is 5000, you would execute the following.

ALTER TABLE customer_entity AUTO_INCREMENT = 5001;

Going forward, all customer IDs would start from 5001.

If you examine sales_flat_order.customer_id and customer_entity.entity_id and find they aren't out of sync and that this only affects prior orders then you have a bit of data parsing to do. Specifically, you'll need to hopefully find out how this happened (potentially a bad merge of two sets of order/customer data) and plan on shifting whatever customer_ids are overlapping between the customer_entity table and the sales_flat_order table.

If this doesn't help then I have to ask what type of setup you are running: Single application server containing both the web server and database OR distributed servers containing different parts of the web stack (e.g. database contained on another server, 3 load balanced application servers, sessions stored as files instead of in the database, etc).

  • Well, I forgot to say that second person was a guest, and the account for it wasn't created but assigned to another account. P.S. Database is on the same server and as I see magento saves session files in var/session. – Marin Bînzari Dec 9 '14 at 7:28
  • Find those two orders in sales_flat_order and see what they are showing in the customer_id column. Do they show the same thing or different customer_id values? – sparecycle Dec 9 '14 at 13:44
  • The isn't such table. It's Magento 1.3. But in sales_order the customer_id is the same – Marin Bînzari Dec 9 '14 at 14:16
  • So you can't recreate it but you say you can see this occurring in the database. I would run this query to narrow down every time that it occurs. Would be interesting to know if it occurs within a minute of each other, within a second of each other, etc. Just modify the table "sales_flat_order" with "sales_order" and it should work for you: magetricks.com/tricks/… – sparecycle Dec 9 '14 at 14:37
  • 1
    If you have a few examples of customers who have experienced this issue, find their customer ID in the results and determine how often it is occurring. Do you have any idea of when this first started occuring? Is it possible to disable local or community extensions to see if it still occurs? Maybe disable customer account creation until you can determine the cause. This is a stretch but maybe your Magento instance is running slow enough so as to actually respond with the same ID before an order can be fully processed. Maybe time to consider an upgrade? – sparecycle Dec 9 '14 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.