How to use ifconfig two times in one action?

<action method="setTemplate" ifconfig="example/general/enabled">

Now I want to add another if condition in this action. I have two configuration fields.

If one is set as "yes" and the second is also set as "yes" then my template will be displayed. So how to use two if condition in a layout XML file?

2 Answers 2


I think it's likely better to allow the setTemplate action to execute based on the example/general/enabled and then wrap the contents of the template in an if statement for the other setting.

File: example/catalog/product/view/examples.phtml

<?php if(Mage::getStoreConfig('example/general/other_setting')):?>
 // do your other stuff
<?php endif;?>

This usually can be tightened up by putting your store config check in a helper or block method that returns the enabled status. You'll see this in Magento as isEnabled or canRender - something descriptive for those who have to manage this code base after you've gone.

  • its only for template but i want this condition in addTab than how to do that
    – ND17
    Commented Mar 27, 2015 at 13:16
  • Use a helper at the top of the addTab method
    – philwinkle
    Commented Mar 27, 2015 at 18:48

This is not possible to use several "ifconfig" statements.

As alternative you can use helper to choose which template to use

<action method="setTemplate" ifconfig="example/general/enabled">
    <template helper="mymodule/getTemplate"/>

Then you just need to create helper with method

public function getTemplate()
    //return template path depending on your conditions
    // example/catalog/product/view/examples.phtml

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.