4

I need to show the customer email on my order confirmations in the Shipping Information section. I know it is called in:

System > Configuration > Customers > Customer Configuration > Address Templates

like so: (telephone number as example)

{{depend telephone}}Contact Number: {{var telephone}}

I have tried:

{{depend email}}Email Address: {{var email}}

and

Email Address: {{var order.getBillingAddress().getEmail()}}

but both come up empty. Is this possible?

3

Managed to get this by adding:

{{var order.getCustomerEmail()}} 

underneath:

{{var order.getShippingAddress().format('html')}}

in the transactional email templates in admin

| improve this answer | |
1

This doesn't work, because the address template is for the address, but the email belongs to the user.

It might work to setEmail on the address BEFORE it is formatted. The event customer_address_format should work for this.

| improve this answer | |
  • No, unfortunately this doesn't work because the "email" doesn't belong to the "customer_address" eav entity type so it's not loaded in Mage_Customer_Helper_Address::getAttributes() – ahe_borriglione Mar 16 at 18:07
  • @ahe_borriglione You say that hooking into customer_address_format and adding the mail to the address object from the customer doesn't work? – Fabian Blechschmidt Mar 17 at 20:55
  • 1
    Yes, because "email" exists already incl. value in address object because sales_flat_order_address and sales_flat_quote_address have an email column. But it is later (after event hook in) not overtaken in address format handler because "email" doesn't belong to address eav entity :/. So a rewrite would be necessary. – ahe_borriglione Mar 23 at 5:53
0

I have suggested a PR that fixes this for OpenMage LTS: https://github.com/OpenMage/magento-lts/pull/1009

| improve this answer | |

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.