Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would Magento fail to save a customer after generating an ID?

Tags:

php

mysql

magento

I'm attempting to track down the cause of a rare bug (love those intermittent bugs) where a customer selects to Register at time of checkout, but when the order is completed, Magento somehow fails to save the customer record. This results in an orphan order with no email address, a difficult customer service situation.

Here are the results of my investigations so far:

  • The Sales Order View in adminhtml reports that the customer is a Guest and the email address is blank. Billing and Shipping addresses are visible.
  • customer_is_guest is false in sales_flat_order
  • The sales_flat_order entry links to a valid record in sales_flat_order_address.
  • The sales_flat_order_address record contains values for customer_id and customer_address_id however those linked records do not exist.
  • There is no discernible pattern in customer information, products ordered, payment methods.
  • There are no relevant entries in system.log, exception.log, apache error logs, var/reports or any other logs that I'm aware of.

Thoughts:

  • the customer save is progressing far enough that an ID is generated.
  • there is an observer on customer_save_after that is causing a rollback of the save?
  • a low-level database error is causing the save to fail.

Does anyone have any suggestions on how to track this down?

Version is Enterprise 1.9.

like image 372
Jonathan Day Avatar asked May 24 '11 08:05

Jonathan Day


1 Answers

I would add lots of extra logging, try to log it well enough to capture the bug - and to save those logs if the bug can be detected.

Once you have logs that show the bug, you can then isolate the problematic code more easily.

For this, you may need to log the database queries, which might, unfortunately, be tricky if the volume of data is high and/or subject to privacy concerns.

like image 198
Arafangion Avatar answered Sep 23 '22 21:09

Arafangion