1

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.