/** * Ensure required addon is installed * */ public function preDispatch() { if ($this->getRequest()->getActionName() !== 'upgrade') { if (!$this->isAddonInstalled()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); $e = new Mage_Core_Controller_Varien_Exception(); throw $e->prepareForward('upgrade'); } } return parent::preDispatch(); }
/** * @return Mage_Sales_Model_Order * * @throws Mage_Core_Controller_Varien_Exception */ protected function initOrder() { $id = $this->getRequest()->getParam('order', $this->getRequest()->getParam('order_id')); /** @var Mage_Sales_Model_Order $order */ $order = Mage::getModel('sales/order')->load($id); if ($order->isObjectNew()) { $e = new Mage_Core_Controller_Varien_Exception(); throw $e->prepareForward('noroute'); } $this->getHelper()->setCurrentOrder($order); return $order; }
/** * Force Magento ro redirect to a different route * This will happen without changing the current URL * * @param string $action * @param string $controller = '' * @param string $module = '' * @param array $params = array * @return void */ protected function _forceForwardViaException($action, $controller = '', $module = '', $params = array()) { if ($action === 'noRoute') { $controller = 'index'; $module = 'cms'; } else { if ($controller === '') { $controller = $this->getRequest()->getControllerName(); } if ($module === '') { $module = $this->getRequest()->getModuleName(); } } $this->setFlag('', self::FLAG_NO_DISPATCH, true); $e = new Mage_Core_Controller_Varien_Exception(); throw $e->prepareForward($action, $controller, $module, $params); }
/** * Cause the current action to be undispatched and redirect * * @param string $path */ protected function _redirect($path) { $exception = new Mage_Core_Controller_Varien_Exception(); throw $exception->prepareRedirect($path); }
/** * Cause the current action to be undispatched and redirect * * @param string $path */ protected function _redirect($path) { header('Location: ' . Mage::getUrl('', array('_direct' => $path))); exit; $exception = new Mage_Core_Controller_Varien_Exception(); throw $exception->prepareRedirect($path); }