0

I have custom configuration fields (added from system.xml file in my module) in Shipping Methods section in the admin panel:

System -> Configuration -> Sales -> Shipping Methods page.

It's not a new shipping method, just few fields to work with the default Table Rates method.

Is there a way to catch when this data is saved/changed? Or where can I dispatch a custom event to catch it? Simply I have to check if my custom fields are changed and to perform some updates with the new values.

Answer: In my case the event was admin_system_config_changed_section_carriers. I've found it in Mage_Adminhtml_System_ConfigController::saveAction.

Mage::dispatchEvent("admin_system_config_changed_section_{$section}",
    array('website' => $website, 'store' => $store)
);
2

I have used this event before to capture the post data and do something with it: admin_system_config_changed_section_[yoursection]

public function exampleObserver($observer) {

    $post = Mage::app()->getRequest()->getPost();
    // do something
}
|improve this answer|||||
  • 1
    Actually I found the answer few minutes after submitting the question. You're right, this is the event. In my case it was admin_system_config_changed_section_carriers. Thanks. – enenen Oct 21 '14 at 12:10
2

Using admin_system_config_changed_section_[yoursection] might be too late if you want to get the old value to compare it with the new one or what ever you wonna do.

You could try this event: model_config_data_save_before

|improve this answer|||||
  • after save, the value is updated, so even in save_after the value is already gone. So you are right. To check whether the old and new value is the same, you have at least to save the value in save_before, if you can not do EVERYTHING in save before. – Fabian Blechschmidt Oct 23 '14 at 12:51

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.