1

I am customizing Magento's native one page checkout (ee 1.13). We have been modifying it so that customers could order without authentication (but without guests orders). I'm having an issue with quotes. The flow of my checkout is :

  1. Billing
  2. Shipping
  3. Shipping Method
  4. Payment
  5. Order Review

The whole flow works well except for one case. If the customer enters his email, goes to the second step, then goes back to the first step and changes his email, the quote is flushed and the shopping cart is empty. Please note that it bugs only when the second mail entered already exists on the DB (so, in a case we would have to force the authentication).

I've been debugging from index.php and I have no clue on which request could empty the cart.

Any clue that could help me ?

Cheers

  • Did you have a look in the sales_flat_quote table? Is the old quote still in there with the old e-mail address? – Anna Völkl Aug 27 '15 at 19:15
  • Yes, it is still with the old email adress. Also, the bug only happens when I enter an e-mail that already exists in the database. – Laila Aug 27 '15 at 21:29
1

It would help to know your custom code where you handle the entered email address but I assume that you log in the customer, which would explain this behavior:

When you have items in the cart and log in, the guest quote (your current cart) is merged into the customer's latest quote (the cart that the customer had when he was logged in the last time). At this point, the cart belongs to the customer and the previous guest quote does not exist anymore.

If you then log in a different customer, the latest quote of this customer is used. No merging this time, because there is no guest quote.

You will have to copy the previous quote to the other customer when a new email address is entered.

  • Thank you for the explanation. I'm forcing the authentication on the _validateCustomerData method of the class Mage_Checkout_Model_Type_Onepage. I guess I should login the customer earlier in the process? – Laila Aug 27 '15 at 21:33
  • This would not help. Either do it later, i.e. just before the order is placed, or copy the quote as suggested. – Fabian Schmengler Aug 27 '15 at 21:43
  • Thing is I don't know when I am supposed to copy the quote. I don't know when the quote is flushed. When I try to clone the quote as soon as a new email is entered, it looks like it is flushed by an other process when I pass into the saveBilling action... – Laila Aug 27 '15 at 22:08
  • 1
    Renewing the session (i.e. disconnectiong it from current quote) happens here, immediately after authentication: github.com/OpenMage/magento-mirror/blob/… And if it helps, merging guest quote happens here: github.com/OpenMage/magento-mirror/blob/… – Fabian Schmengler Aug 27 '15 at 22:17

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.