I have looked at various ways of doing this, but is there a simple way to simply capture the email address entered on the Billing Information form and overriding the Account Email address when committing the order?

SCENARIO: We have a system where only a set number of retailers will assist the customer in the order process and then take delivery of the products (the customer will need to pick the product(s) up from the Retailer's Shipping address). Each Retailer has an account set up to use when ordering with the customer in store.

The process we want to follow is as follows when we reach the checkout:

  1. Retailer logs in (using their backend account id - email + password
  2. Billing information is shown - this is forced to be a new Billing Address with an email address field - all fields are empty
  3. Once complete, the Retailer's Shipping Address is shown, text only, not as a form
  4. The shipping method is selected
  5. The payment method is selected
  6. The Order Review page is selected
  7. The Place Order button is clicked
  8. The user is redirected to Worldpay where.... the Account email address is always displayed.

Therefore, we want the customer to enter their email address at the Billing Info stage and use this when it goes to Worldpay or Paypal for the Payment/Order confirmation email.

However, even though I can display the email address input field in the Billing Info form, the Account holders email address is sent to Worldpay (i.e. with the confirmed order).

Best method to do this please - if possible.

Reviewing other posts on the recommended methods to create an observer, I did the following, but as it has not worked, I have either used incorrect rendering tags, or misunderstood how it is achieved.

UPDATED on 25/11 at 12:55
I have still not managed to get this (probably simple) solution working. I have made some changes and retested, but to no avail. If anyone can shed some light on what is wrong with my configurations, I would appreciate it.

Firstly, I created the module declaration Pmw.xml in public_html/app/etc/modules/Pmw


I commented out: in case this was stopping it working.

I then created my config.xml file in public_html/app/code/local/Pmw/SwitchAccountEmail/etc/config.xml


Finally, I created my observer module, Observer.php in public_html/app/code/local/Pmw/SwitchAccountEmail/Model/Observer.php

    public function copyBillingEmailToAccountEmail(Varien_Event_Observer $observer)

    // Start Logging the process
    Mage::log('PMW - Email Switch observer Start ------');


        $order = $observer->getPayment()->getOrder();
        $customer = $order->getCustomer();

        $billingEmail = $order->getBillingAddress()->getEmail();
    Mage::log('Value of $billingEmail=', $billingEmail);

    // End of Logging
    Mage::log('PMW - Email Switch observer End ------');


I ran a further couple of transactions through and the same result occurred, the Account email was being passed to Worldpay, not the Billing Email address entered.

No data was logged in the system log either, so I guess the observer didn't even see the light of day. I assume writing to the log is allowed in the module?

I still have every faith that the observer (if set up correctly) will work.

I still suspect that it is the URL rendering not working, i.e. I have confused the system with incorrect tags and names. While we are looking for a different approach (long term), I am still keen to get this working in the interim.

  • "I have looked at various ways of doing this" - What did you try? If you used observers you were on the right track. Commented Nov 16, 2014 at 21:58
  • Well, I am new to the [more complex side of Magento] and real coding, beyond PHP/XML/PHTML. The various ways I have considered were through other posts, but I haven't implemented anything for real yet. I'm hoping that someone may advise before spending wasted time. But yes, it looks like a custom observer may be required. If you can oblige, I am happy to be advised :-) Commented Nov 16, 2014 at 22:19
  • Hoping that fschmengler or someone can review and enlighten me on what I may have configured incorrectly. Commented Nov 18, 2014 at 15:04
  • Pay attention to upper and lower case, Magento has some strict conventions: 1) the module name should be CamelCased and must start with an upper case letter, 2) the file name for PMW_SwitchAccountEmail_Model_Observer must match the case of the class (Observer.php, not observer.php) Commented Nov 18, 2014 at 15:57
  • I have re-visited this issue a couple of time over the last few days and simplified the tags / folder names to match, but still it does not work. If @Marius (whose original article I used as an example), or anyone else can throw more light on what I have wrongly configured, I would be grateful. Thanks. Commented Nov 25, 2014 at 13:14

1 Answer 1


Try it with an observer on the sales_order_payment_place_start event, which is triggered when a payment process begins (usually with an authorize request to the payment gateway). It is triggered in Mage_Sales_Model_Order_Payment::place() with the payment model as parameter.

I'll skip the steps where you create a module and configure the observer, you should easily find information about this, and go directly into the interesting parts - your observer method. It should look like this:

public function copyBillingEmailToAccountEmail(Varien_Event_Observer $observer)
    $order = $observer->getPayment()->getOrder();
    $customer = $order->getCustomer();

    $billingEmail = $order->getBillingAddress()->getEmail();

You'll probably want to switch the email address back after successful payment so that the retailer will be able to log in with his own address again. I'll leave the following open for exercise:

  • create customer attribute "original_email"
  • save original customer email in the observer above
  • create another observer that sets the account email back to the original email after payment has been proceeded (or cancelled!). Have a look at the other events in Mage_Sales_Model_Order_Payment to find a suitable one for your payment method.
  • Great feedback, I'm grateful. I will look into this and respond once I (hopefully) get it all to work. Commented Nov 16, 2014 at 23:40

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.