I need to execute my observer just after an actionController end or when paymentMethod is saved on database.

1 Answer 1


You can just use controller_action_postdispatch_<router_name>_<controller_name>_<action_name> formula to derive the event name. You can also do this for predispatch aswell (Just replace postdispatch with predispatch).

Core Example:

Observing Magento Checkout Onepage controller saveOrderAction on the Paypal module:


<router_name>: checkout
<controller_name>: onepage
<action_name>: saveOrder

Using the previous formula to create the event name to observe we finally end up with:

Derived event name for our controller action method:


Then in the etc/config.xml


Getting the controller action in the Observer class:

 * @param Varien_Event_Observer $observer
public function setResponseAfterSaveOrder(Varien_Event_Observer $observer)
    /* @var $controller Mage_Core_Controller_Varien_Action */
    $controller = $observer->getEvent()->getData('controller_action');

    // Do stuff here
  • 1
    When controller is not Mage, Router Name should include extension vendor. Eg. IWD_Opc_JsonController should be "controller_action_postdispatch_iwd_opc_json_saveBillingAddress" not as implied "controller_action_postdispatch_opc_json_saveBillingAddress"
    – Flipmedia
    Aug 1, 2018 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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