Categories
Magento

Magento – Run an Event or Function After System Configuration Save

Open the config.xml of your module and add an event within the global declaration.

<global>
<events>
<admin_system_config_changed_section_nameofyoursection>
<observers>
<yourmodule>
<type>singleton</type>
<class>yourmodule/observer</class>
<method>adminSystemConfigChangedSectionNameofyoursection</method>
</yourmodule>
</observers>
</admin_system_config_changed_section_nameofyoursection>
</events>
</global>

Now create a PHP file, Observer.php, under your module’s Model folder. Model/Observer.php. Add the following code.

<?php
class Your_Module_Model_Observer
{
public function adminSystemConfigChangedSectionNameofyoursection()
{
// Do something here - e.g. send an email, log the action, etc.
}
}
?>

Make sure you clear Magento’s cache before testing the code.

4 replies on “Magento – Run an Event or Function After System Configuration Save”

Comments are closed.