I am customizing Magento's transactional emails and am trying to remove the Telephone/Fax from displaying in the email as they are displaying as:


The transactional mail template for new orders in the CMS is calling:

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

Which is defined in the top of the (cms based) email template as:

"var order.getShippingAddress().format('html')":"Shipping Address"

I don't quite understand what the purpose of this 'variable' definition is, but I also see no reference to this in the sales.xml file.

Does anyone know how to adjust this html? Is there a clear methodology for finding where things are defined/pulled from in Magento? I am clearly confused coming from working primarily with Wordpress theming.


Apologies for the endless string of transactional email questions. Hopefully this will help build the beta stack exchange as a valuable resource :)

  • 1
    No apologies necessary - I, for one, am glad to help.
    – philwinkle
    Commented Sep 3, 2013 at 18:28

1 Answer 1


Actually the variables defined at the top of the email are 'injected' when the template is called. In this case it's the order object.

If you check out the file app/code/core/Mage/Sales/Model/Order.php you can find around the line 948 the method getShippingAddress. This is the actual function you're referencing here.

Now for the format('html') part, this is where you can actually start making some changes. And the best part is, no coding is required.

Go to your backend System > Configuration > Customer configuration > Addresslayout and look for the field HTML. By default it will look like this:

{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}<br/>
{{depend company}}{{var company}}<br />{{/depend}}
{{if street1}}{{var street1}}{{/if}}
{{depend street2}}{{var street2}}{{/depend}}
{{depend street3}}{{var street3}}<br />{{/depend}}
{{depend street4}}{{var street4}}<br />{{/depend}}
{{if postcode}}{{var postcode}}{{/if}} {{if city}}{{var city}}  {{/if}}{{if region}}{{var region}} {{/if}}<br/>
{{var country}}<br/>
{{depend telephone}}T: {{var telephone}}{{/depend}}
{{depend fax}}<br/>F: {{var fax}}{{/depend}}
{{depend vat_id}}<br/>VAT: {{var vat_id}}{{/depend}}

As you can see removing telephone and fax altogether is just a matter of deleting the last 2 lines before the VAT line.

  • Ah, this is amazing, thank you. I'm also amazed at how you can keep track of where everything is in Magento, it really takes a lot of time to understand your way around things. I had one quick question, is there a way to affect these if and depend statements with any logic? (eg: if fax="-") Or what are these statements called?
    – waffl
    Commented Sep 3, 2013 at 20:44
  • From what I can tell here and here maybe it isn't really possible?
    – waffl
    Commented Sep 3, 2013 at 20:58
  • hm no I don't think so. It's just simple conditions without much logic. But if it is possible please share :) Commented Sep 4, 2013 at 7:11
  • your mention of order.php really helped me on the issue thank you so much
    – Nickool
    Commented Jul 10, 2014 at 23:41

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.