4

I need to insert some values to custom database table based on the values of changed custom field, if the specific custom field value (in a custom shipping method) had changed.I need to check this in my Observer.php event that I'm firing is admin_system_config_changed_section_carriers

is there any possible way to do this ?

4

If this custom field comes from your own module, you can use a backend model to do additional things before save:

Add this to the field definition in system.xml

<backend_model>your_module/system_config_backend_custom</backend_model>

And write the model like this:

class Your_Module_Model_System_Config_Backend_Custom extends Mage_Core_Model_Config_Data
{
    protected function _afterSave()
    {
        if ($this->isValueChanged()) {
            // do your thing here
        }
    }
}

Actually this also works for existing modules without changing their code: you can override the backend model in your own system.xml and make your module depend on the original one to make sure, yours is loaded afterwards.

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.