Magento Call custom action after “Save Config” in admin part


Open your module config.xml file and add this event.

<global>
        <events>
            <admin_system_config_changed_section_yoursectionname>
                <observers>
                    <mymodule>
                        <type>singleton</type>
                        <class>mymodule/observer</class>
                        <method>adminSystemConfigChangedSection</method>
                    </mymodule>
                </observers>
            </admin_system_config_changed_section_yoursectionname>
        </events>
    </global>

Next create file in Model/Observer.php in model folder and add code.
class My_Module_Model_Observer
{
    public function adminSystemConfigChangedSection()
    {
        echo "Test: oberver is working!";exit;
    }
} 

And clear cache and refresh browser ;)

4 comments:

  1. Trying to get this test working. 2 questions. where would I see the "Observer is working" and how do I know the yoursectionname? Is that just the module name or?

    ReplyDelete
  2. Thanks for the best blog.it was very useful for me.keep sharing such ideas in the future as well.this was actually what i was looking for,and i am glad to came here!
    magento development company in bangalore 

    ReplyDelete