How to use ifconfig
two times in one action?
<action method="setTemplate" ifconfig="example/general/enabled">
<template>example/catalog/product/view/examples.phtml</template>
</action>
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?
Best Answer
I think it's likely better to allow the
setTemplate
action to execute based on theexample/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
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
orcanRender
- something descriptive for those who have to manage this code base after you've gone.