3

We have a issue with a Magento 1 store in that order emails are being changed after an order has been placed. This specifically happening after repeat orders. I will try to explain.

  1. Admin takes a call to place an order. This first order is a fresh order, not a repeat.
  2. Admin then takes another call and its a repeat order. When the order is placed all the details are correct including the email address.
  3. After placing the repeat order you notice that the email address has changed to that of the first order.

Any ideas or comments would be greatly appreciated.

3
  • The same problem found, any updates on this issue?
    – davidselo
    Apr 26, 2019 at 9:01
  • @davidselo - I fixed this by creating a custom extension that checked the customers stored email and overwrote the order email if there was a difference between the two.
    – ItsJhonny
    May 1, 2019 at 7:58
  • @davidselo - I've added the observer code below
    – ItsJhonny
    May 1, 2019 at 9:02

1 Answer 1

0

As mentioned in my comment to Davidselo... I fixed this by creating a custom extension that checked the customers stored email and overwrote the order email if there was a difference between the two. Do this by creating a model observer and use

<?php 
class Companyname_extensionname_Model_Observer {
    public function admin(Varien_Event_Observer $observer) {
        $order = $observer->getEvent()->getOrder();
        $customer_id = $order->getCustomerId();
        $order_email = $order->getCustomerEmail();
        $customerData = Mage::getModel('customer/customer')->load($customer_id);
        $customer_email = $customerData->getData('email');

        // if email addresses are incorrect change the order email address to the customers default one.
        if($customer_email != $order_email{
            $order->setCustomerEmail($customer_email);
            $order->getResource()->saveAttribute($order, "customer_email");
        }
    } 
}
2
  • Hello @rupi, Thanks for your answer, we want to test the solution you propose. could you please tell us which is the event you are capturing?
    – davidselo
    May 16, 2019 at 9:23
  • @davidselo - Its the "<sales_order_place_before>" event.
    – ItsJhonny
    May 21, 2019 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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