What I want to achieve is to add a custom variable in the header, which displays me if I am on account related template to show "Account" or if I am on invoice template to show "Invoice" and so on.
I read this article and I didn't find this kind of variable. Is there a way to create this kind of variable:

{{ var custom_email_name }}


Thx in advance


There is a function which is responsible for sending letters in magento:


Here is params list:

 * Send transactional email to recipient
 * @param   int $templateId
 * @param   string|array $sender sender information, can be declared as part of config path
 * @param   string $email recipient email
 * @param   string $name recipient name
 * @param   array $vars variables which can be used in template
 * @param   int|null $storeId
 * @throws Mage_Core_Exception
 * @return  Mage_Core_Model_Email_Template

5th param $vars, which contain values for output in template. It can contain simple variables or objects. E.g. order object or customer object. In that case you can call methods of these objects inside templates.

For example {{var order.getId}} return order ID.

So in your case you need to find where this method calls and add new variable/object and then call inside template. Or if can be covered by calling existing method - you can do it without any method call modification.


For invoice this function is using:

enter image description here

And here is $vars variable:

enter image description here

| improve this answer | |
  • are u sure that the sendTransctional function is responsible for displaying the template?. I put an exit in the beginning of the fc, and nothing happens when I press the preview button . – Attila Naghi Feb 23 '16 at 14:44
  • Which email do you want to send? – zhartaunik Feb 23 '16 at 14:50
  • For example for new invoice, order invoice ... I want that my variabile contains the value "Invoice", for any account related temaplate(pass. recovery, new account...) i want that my variable contains the value "acccount". – Attila Naghi Feb 24 '16 at 7:17
  • Updated......... – zhartaunik Feb 24 '16 at 8:07
  • If you still don't know how to resolve your problem, do not hesitate to ask more questions. Maybe if you more specify your question - it would be more easy to answer. E.g. I'd like to add to ..... template this ...... variable – zhartaunik Feb 24 '16 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.