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 Answers 3

4

Managed to get this by adding:

{{var order.getCustomerEmail()}} 

underneath:

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

in the transactional email templates in admin

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.

3
  • 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() Commented Mar 16, 2020 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? Commented Mar 17, 2020 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. Commented Mar 23, 2020 at 5:53
0

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

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.