May 13, 2014

Magento email overrides

Yireo Blog Post

When customizing Magento transactional emails, you have two ways to modify the email content: By using the Magento Admin Panel, which means editing HTML in a plain textarea. Or by using the HTML templates-files using your preferred code editor. Our free EmailOverride extension comes to the rescue to help you with the last option.

Editing email template files

I've never really understood the Magento Admin Panels ability to modify transactional emails. Yes, you can easily click around and select emails. But editing the HTML of those emails is horrible - a simple textarea is used, without code completion, syntax highlighting, etcetera. Instead I always modified the files in the folder app/locale directly. 

There is one but: All files in the app/locale folder - or at least the app/locale/en_US folder - are considered to be core files and should not be modified directly. It is not theme specific or customer specific. It is overwritten with any Magento upgrade. To bypass this problem, the EmailOverride extension was created. And it is available to you for free.

Override email files in your own Magento theme

The EmailOverride extension allows for a simple thing: Theme overrides of email files, similarly to XML layout files and PTML templates. Take for instance, the following file:

app/locale/en_US/template/email/sales/order_new.html

This file is used every time a Magento order confirmation is sent to a customer. Most likely, you want this mail to be modified: Mentioning things about your reaction time, about when the order will usually be shipped, and some additional contact data like emailaddresses or social media accounts. But modifying this file directly is a no-no.

Instead, using our EmailOverride extension, you can copy the file to the following location (where default/YOURTHEME is the actual location of your theme):

app/design/frontend/default/YOURTHEME/locale/en_US/template/email/sales/order_new.html

Now you can modify it at will, without worrying about upgrades overriding your changes. And you can use your favorite code editor (Sublime, Coda, Eclipse, PhpStorm) to edit things conveniently.

Custom emails per Website, Store, Store View

It gets better: Magento by default allows you to set the various emails that are used, and allows you to configure these settings per scope (per Website, per Store, per Store View) in the System Configuration. If you have 10 email templates you want to customize for 2 Stores (Mens Clothing, Womens Clothing) with 3 Store Views (English, German, French) each, this requires you to create 60 email customization which are all normally configured within the Magento Admin Panel under Transactional Emails. If you've ever tried this, you will see the problem: It gives a mess.

Organizing the various files in the Magento theming structure, and not configuring anything extra in the System Configuration except for the theming options, allows for a much cleaner approach. And our Magento module gives you that freedom.

We can't live without it anymore. Download the extension to see if it fits your needs as well.

Posted on May 13, 2014

About the author

Author Jisse Reitsma

Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.

Sponsor Yireo

Looking for a training in-house?

Let's get to it!

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.

Do not miss out on what we say

This will be the most interesting spam you have ever read

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.