1

Customer email is required in one step checkout Magento 1.9.3.8 but last some time I have had a few orders that have not captured the customers email or at least not saved it to the Magento order.

Usually it happen when customer try to select as Guest and place order. As i checked in database it missing the info in sales_flat_order.

It's not happening any particular payment method. this missing email happening randomly

please help to sort out this issue .

Thanks in advance

5
  • Do you have a validation for the email field on the checkout? Jul 6, 2018 at 11:51
  • may be you are using some checkout extension or some custom code which is doing this, so this way it could not be answerable Jul 6, 2018 at 12:03
  • We are having the same issue. Its one single droplet in the ocean of magento issues, which is why we are moving away from it. In my best Obi-Wan voice: "You don't want to use Magento 1.9. You want to go home and rethink your life." Jul 10, 2018 at 9:05
  • yes we have email validation, Actually i notice it's happening only when a already register user , do not login and select as guest for checkout and place order. Most of the time it's working well, even already register user , without login and checkout as guest and place order, but some time it's missing .. Jul 11, 2018 at 4:56
  • Same problem here with the latest v1.9.4.2. Spent roughly 50 hours on this issue, spread over the last 2 years, without any luck. Still crossing fingers I can find something. Though the few voters on the question tell me that this may be an issue with custom code.
    – Anse
    Sep 13, 2019 at 8:56

1 Answer 1

0

You can reproduce the issue by logging in, adding something to cart (starting a quote), logging out again, putting something to the cart and entering checkout. The quote then still has the customer_id, gustomer_group_id from the previous quote, even the same entity_id. You can then checkout as guest using the same email address from the previous customer account, but when saving the checkout with Mage_Checkout_Model_Type_Onepage::saveOrder(), Mage_Checkout_Model_Type_Onepage::getCheckoutMethod() will return 'login_in' (in app/code/core/Mage/Checkout/Model/Type/Onepage.php lines 802ff.) and start Mage_Checkout_Model_Type_Onepage::_prepareCustomerQuote(), although being in a guest checkout. The method _prepareCustomerQuote() will rely on an existing customer session to retrieve customer data, but the session does not exist any more.

To fix this issue, you can simply copy app/code/core/Mage/Checkout/Model/Type/Onepage.php to app/code/local/Mage/Checkout/Model/Type/Onepage.php (or rewrite the class using your own custom module), and then replace (inside saveOrder() method):

switch ($this->getCheckoutMethod()) {
            case self::METHOD_GUEST:
                $this->_prepareGuestQuote();
                break;
            case self::METHOD_REGISTER:
                $this->_prepareNewCustomerQuote();
                $isNewCustomer = true;
                break;
            default:
                $this->_prepareGuestQuote();
                break;
        }

with this code:

switch ($this->getCheckoutMethod()) {
            case self::METHOD_GUEST:
                $this->_prepareGuestQuote();
                break;
            case self::METHOD_REGISTER:
                $this->_prepareNewCustomerQuote();
                $isNewCustomer = true;
                break;
            default:
                if(Mage::getSingleton('customer/session')->isLoggedIn()) $this->_prepareCustomerQuote();
                else $this->_prepareGuestQuote();
                break;
        }

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.