You cannot use {{depend}}
and {{config}}
in that combination for 2 reasons.
The first and most important is that the regex match is screwed up like this. If you have a text like this {{depend name}} some text {{/depend}}
the matches array looks like this:
Array
(
[0] => Array
(
[0] => {{depend name}} some text {{/depend}}
[1] => name
[2] => some text
)
)
This means that if the value for the variable name
evaluates to something else than null
false
0
the value in [0] (the expression) will be replaced with the value from [2] (some text).
If you try it with {{depend {{config path="some/path/here"}}}} some text {{/depend}}
the matches look like this:
Array
(
[0] => Array
(
[0] => {{depend {{config path='some/path/here'}}}} some text {{/depend}}
[1] => {{config path='some/path/here'
[2] => }} some text
)
)
The second reason is that the depend conditions must be a variable passed to the template (element inside the _templateVars
member).
The work around for this is to pass the value from the config as a variable to the template and then use that variable in the depend
statement.
Let's take for example the new order e-mail sending. In Mage_Sales_Model_Order::sendNewOrderEmail()
$mailer->setTemplateParams(array(
'order' => $this,
'billing' => $this->getBillingAddress(),
'payment_html' => $paymentBlockHtml
)
);
Turn it into this:
$mailer->setTemplateParams(array(
'order' => $this,
'billing' => $this->getBillingAddress(),
'payment_html' => $paymentBlockHtml,
'my_config_var'=> Mage::getStoreConfig('some/path/here')
)
);
Now you should be able to use:
{{depend my_custom_var}} some text {{/depend}}