Stop Controller Dispatch

Updated . Posted . Visible to the public.

In an action controllers preDispatch() method you can stop dispatch by calling the following:

$this->setFlag('', self::FLAG_NO_DISPATCH, true);

If you were listening via an observer, your code would look like this:

public function someObserver(Varien_Event_Observer $observer)
{
    $action = $observer->getEvent()->getControllerAction();
    $action->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
}

Mike Whitby
Last edit
Posted by Mike Whitby to Magento (2012-05-11 10:56)