Mage :: getStoreConfig always returns null for my custom admin option

I have a module: app/code/local/Namespace/Resize/

so I turned on the option to disable / enable the option using Magento admin.

System > Configuration > Namespace > Resize

but when I try to access this option, I always get NULL with Mage::getStoreConfig , although the parameter is set to Yes.

 Mage::getStoreConfig('resize/settings/enabled', Mage::app()->getStore()->getId()); 

or

 Mage::getStoreConfig('resize/settings/enabled'); 

returns null

config.xml

 <?xml version="1.0"?> <config> <modules> <Namespace_Resize> <version>0.0.1</version> </Namespace_Resize> </modules> <global> <helpers> <resize> <class>Namespace_Resize_Helper</class> </resize> </helpers> <events> <catalog_product_save_after> <observers> <resize> <type>singleton</type> <class>namespace_resize_model_observer</class> <method>catalog_product_save_after</method> </resize> </observers> </catalog_product_save_after> </events> </global> </config> 

system.xml

 <?xml version="1.0" ?> <config> <tabs> <resizing module="resize" translate="label"> <label>Resize</label> <sort_order>100</sort_order> </resizing> </tabs> <sections> <resize module="resize" translate="label"> <label>Resize</label> <sort_order>200</sort_order> <show_in_default>0</show_in_default> <show_in_website>0</show_in_website> <show_in_store>1</show_in_store> <tab>resizing</tab> <groups> <settings module="resize" translate="label"> <label>Settings</label> <sort_order>10</sort_order> <show_in_default>0</show_in_default> <show_in_website>0</show_in_website> <show_in_store>1</show_in_store> <fields> <enabled translate="Enable resize"> <label>Enabled</label> <comment>Backend Resizing</comment> <frontend_type>select</frontend_type> <source_model>adminhtml/system_config_source_yesno</source_model> <show_in_default>0</show_in_default> <show_in_website>0</show_in_website> <show_in_store>1</show_in_store> </enabled> </fields> </settings> </groups> </resize> </sections> </config> 

adminhtml.xml

 <?xml version="1.0" ?> <config> <acl> <resources> <admin> <children> <system> <children> <config> <children> <resize> <title>Resize Settings</title> </resize> </children> </config> </children> </system> </children> </admin> </resources> </acl> </config> 

helper app/code/local/Namespace/Resize/Helper/Data

 <?php class Namespace_Resize_Helper_Data extends Mage_Core_Helper_Abstract { } 
  • The module is working fine

  • Caching Disabled

  • I am sure that this option has been saved because I can see the record in the updated database.

  config id |  scope |  scope id |  path |  value
 785 |  stores |  1 |  resize / settings / enabled |  1

Can anyone help me what is wrong?

thanks

+4
source share
2 answers

Use PHP my admin and make sure the settings are saved in the core_config_data table p>

Use this query

 SELECT * FROM `core_config_data` where path like "%YOUR_CONFIG_FIELD_NAME%"; 

and make sure you find your setting. If not, then something is wrong on the side of your module.

+1
source

You want to rename this tag name to system.xml

 <tabs> <resizing module="resize" translate="label"> <label>Resize</label> <sort_order>100</sort_order> </resizing> </tabs> 

Replace resizing with resizing

and try again.

0
source

All Articles