3

Hi I have created a module with a custom transactional email, which works fine when I place the default template file in

app/locale/de_DE/template/email/sales/mymail.html

but I need to place it into my template

app/design/frontend/ultimo/custom/locale/de_DE/templete/email/sales/mymail.html

but on this path it isn't found, I even tried other places like

app/design/frontend/base/default/locale/de_DE/templete/email/sales/mymail.html
app/design/adminhtml/default/default/locale/de_DE/templete/email/sales/mymail.html

but neither works. Isn't there any fallback mechanism for these file? If yes, can anyone explain it to me?

7ochem
  • 7,532
  • 14
  • 51
  • 80
wutzebaer
  • 207
  • 1
  • 6

2 Answers2

5

There is no fallback mechanism for the e-mail templates.
I mean there is one, but not the way you want it.
The e-mail templates are searched in app/locale/{lang_ISO}/template/email/.
If the template is not found then it searches in the app/locale/en_US/template/email/.
That's the whole fallback mechanism.

But if you need some templates that depend on the theme, then you can do it like the sales e-mails do it.
Include this in the e-mail template located in app/locale/de_DE/template/email/sales/mymail.html.

{{layout handle="my_email_layout_handle"}}

You can even pass some variables to it like this

{{layout handle="my_email_layout_handle" var1=$var1 var2=$var2}} 

where $var1 and $var2 are variables you pass to the email template itself.

Now in one of your layout files create the layout handle you used above.

<my_email_layout_handle>
    <block type="core/template" template="my_email/template.phtml" />
</my_email_layout_handle>

Then create the template file my_email/template.phtml in your theme (or themes) where you can fill in your content.

Read this for more details

Marius
  • 197,939
  • 53
  • 422
  • 830
1

I hope you forgive me the self-promotion, but I accidently bumped into this question and would like to add that our free open source extension Yireo EmailOverride allows you to add email templates to the theme, including fallback support: https://github.com/yireo/Yireo_EmailOverride

Jisse Reitsma
  • 1,639
  • 15
  • 24