
Untitled
By: a guest on
Jun 27th, 2012 | syntax:
None | size: 1.48 KB | hits: 15 | expires: Never
In an Observer method, how do you tell Magento to not process code after the dispatched event
public function checkForOrdKey(Varien_Event_Observer $observer)
{
$controllerAction = $observer->getControllerAction();
$request = $controllerAction->getRequest();
$controllerName = $request->getControllerName();
$stepData = $this->_getCheckoutSession()->getStepData();
$ordKeyRemoved = $this->_getCheckoutSession()->getOrdKeyRemoved();
// if it is the checkout onepage controller or inventory controller don't do anything
if (isset($controllerName) && $controllerName === "onepage" && $stepData['shipping']['complete'] && $ordKeyRemoved) {
$this->_getCheckoutSession()->setStepData('shipping', 'complete', false);
$result['goto_section'] = 'billing';
Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
$this->_getCheckoutSession()->setOrdKeyRemoved(false);
}
}
$request = Mage::app()->getRequest();
$action = $request->getActionName();
Mage::app()->getFrontController()->getAction()->setFlag($action, Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
$response = Mage::app()->getResponse();
$response->setHttpResponseCode(500); //adjust to be whatever code is relevant
$json = Mage::helper('core')->jsonEncode($this->__('Your message here')); //adjust
$response->setBody($json);
//don't need to sendResponse() as the framework will do this later