I have a module: app/code/local/Namespace/Resize/
so I've included a option to disable/enable an option through Magento admin.
System > Configuration > Namespace > Resize
but when I try to access to this option I always receives an NULL with Mage::getStoreConfig
although the option 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 {
}
Module is working fine
Cached is disabled
I'm sure the option is saved because I can see an entry in the database that is updated.
config id | scope | scope id | path | value 785 | stores | 1 | resize/settings/enabled | 1
Anyone can help me what's wrong?
thanks
Use PHP my admin and make sure you setting is saved on core_config_data table
Use this query
SELECT * FROM `core_config_data` where path like "%YOUR_CONFIG_FIELD_NAME%";
and make sure you will find your setting. If not then something is wrong on your module side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With