Customising Magento Transactional Emails

As part of a recent project customising Magento emails I discovered a few useful bits and pieces that make creating custom transactional emails a little easier.

Static Blocks

I am not sure why I hadn’t thought of this but you can use static blocks in your emails in the same way as you would a CMS page. This is great because it allows you to make blocks that you can include in every email such as:
- Header
- Footer
- Promotional Content Area
- Social Links
etc and centrally manage it or allow the client to manage it rather than editing every email individually. The code you need is as follows:

You can place this code either in the emails you have setup within “system/transactional emails” or within your site directory “app/locale/en-us/template/email/email-file-name.html” with en-us being whatever locale you happen to be using.

Another cool thing about this is that you can easily upload images and include them within the static block admin screen rather than including the images in your theme. This makes it easy for clients to refresh certain sections themselves or write promotional content.

Referencing Store Information

Magento as standard references a few of the fields in the admin to populate the email eg. Store Name. However it is useful to also know that you can reference a lot more of the store information. For example if you are creating an email footer to state the stores name, address, telephone number, vat number etc you can pull all this information in dynamically so that your emails are kept up to date. The code required is:

and if you require anything else the easiest way to see how the field would be called is to browse to the section in the admin and inspect the field for its “name”. You would then write the code as follows: