we have an extension with only a system.xml giving us some config parameters per store that we can access. Now I would like to access these in an email template and use them in a depend or if statement as follows

{{depend my_custom_var}}

Or by using something like

{{depend var path/to/config}}

The problem is that Magento wont't accept

{{depend {{config path='some/value/here'}}}} text here 

Please find more information here: Magento {{depend}} combined with {{config path='some/value/here'}}

Question: Now how would I add something to my new extension where I make the variable config path='some/value/here' available in a manner that I can use it in the depend statement?

many thanks

  • Why don't you override the method that sends the e-mail and pass your config value as a parameter, as described here magento.stackexchange.com/a/6511/146 ?
    – Marius
    Sep 6, 2013 at 14:41
  • @snh_nl did you find a solution for this problem yet? Perhaps the suggestion Marius gave? Sep 9, 2013 at 11:46

1 Answer 1


I would handle this similar to my response to your other email question: Create a custom block and provide the output based on your setting

protected function _toHtml()
    $html = '';
    if (Mage::getStoreConfig('path/to/setting')) {
        $html = 'YOUR CUSTOM CONTENT';
    return $html;


The problem with the {{depend my_custom_var}} approach is that you would need to rewrite the code that populates the variables for the template that is being sent. You didn't say which email template you are interested in but for example for the order email the relevant code in Mage_Sales_Model_Order would be

            'order'        => $this,
            'billing'      => $this->getBillingAddress(),
            'payment_html' => $paymentBlockHtml

In the above you would need to additionally populate my_custom_var. Since events around email sending are generally sparse you would need to work with rewrites. And if you are targetting multiple emails you end up with a range of significant rewrites which are better avoided. This is why I suggest the custom block approach.

{{depend {{config path='some/value/here'}}}} would not work since Magento would need to be able to parse the template twice.

If you are only needing them in email templates that you are adding yourself you can use the setTemplateParams approach.

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.