Magento – Why checkout_onepage_controller_success_action is dispatched after the layout is loaded

event-observeronepage-checkout

Is there any reason checkout_onepage_controller_success_action event is dispatched after the layout is loaded. Here is an extract from Mage_Checkout_OnepageController::successAction:

    $session->clear();
    $this->loadLayout();
    $this->_initLayoutMessages('checkout/session');
    Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
    $this->renderLayout();

Best Answer

I would say to do things after the rendering (and after sending away the response?)

If you want to do things before rendering, just use:

\Mage_Core_Controller_Varien_Action::renderLayout
app/code/core/Mage/Core/Controller/Varien/Action.php:385
Mage::dispatchEvent('controller_action_layout_render_before_'.$this->getFullActionName());
Related Topic