I am trying to read config data for a custom module to enable or disable it based on the config setting. I am trying to read the config data in an Observer like this : $module_state = Mage::helper('stopcheckout')->moduleActive(); and here is my helper. My observer gets called when ever a product is added to cart. But i get a blank page when i try to read the config data with the above snipped of code. Here are the config.xml and system.xml files. Where am i going wrong? Thanks.
I am trying to read config data for a custom module to enable or
Share
Your helper method is not correct, as I’m sure you’ve guessed 🙂
Try this:
The
getStoreConfigFlag()method always returns a boolean. It evaluates the strings “false” and “0” asfalse, so this is appropriate because theadminhtml/system_config_source_yesnosource model uses 1 and 0 as the stored values.The parameter that is passed for values set via system.xml fields will always have three parts: one for the
<sections>node, one for the<groups>node, and one for the<fields>node.