I have created the custom groups and fields under System->Configuration->Design I used the below event.
<admin_system_config_changed_section_design>
<observers>
<custom>
<type>singleton</type>
<class>Custon_Custom_Observer</class>
<method>save</method>
</custom>
</observers>
</admin_system_config_changed_section_design>
There are three types of scope in magento.
1) Default
2) Websites
3) Stores
I want all the values of my custom fields in admin panel to store the values in custom table. enter image description here
for example, you get description field value in store level.
Mage::getStoreConfig('design/custom/description');
I want the above value in website level and current store level. I have tried this link
-
It seems there are 2 questions. One is to save sys/conf data in a custom table, one is how to get the value of sys/conf on different levels. Is that correct?Sander Mangel– Sander Mangel2015年01月13日 07:17:58 +00:00Commented Jan 13, 2015 at 7:17
-
If get the value I will save in my custom tablesaravanavelu– saravanavelu2015年01月13日 07:20:59 +00:00Commented Jan 13, 2015 at 7:20
-
alanstorm.com/magento_loading_config_variables refer thisKeyul Shah– Keyul Shah2015年01月13日 07:30:28 +00:00Commented Jan 13, 2015 at 7:30
1 Answer 1
In config.xml,
<global>
<events>
<admin_system_config_changed_section_design>
<observers>
<custom>
<type>singleton</type>
<class>Custon_Custom_Observer</class>
<method>saveSystemConfig</method>
</custom>
</observers>
</admin_system_config_changed_section_design>
</events>
</global>
In observer.php,
public function saveSystemConfig(Varien_Event_Observer $observer)
{
$postData = $observer->getEvent()->getData();
if (is_null($postData['store']) && $postData['website']) //check for website scope
{
$scopeId = Mage::getModel('core/website')->load($postData['website'])->getId();
$description = Mage::app()->getWebsite($scopeId)->getConfig('design/custom/description');
$currentScope = 'websites';
}
elseif($postData['store']) //check for store scope
{
$scopeId = Mage::getModel('core/store')->load($postData['store'])->getId();
$description = Mage::app()->getStore($scopeId)->getConfig('design/custom/description');
$currentScope = 'stores';
}
else //for default scope
{
$scopeId = 0;
$description = Mage::getStoreConfig('design/social-meta-tags/design/custom/description')
$currentScope = 'default';
}
}
From the above you can get individual field values in all scopes.