/** * @param Zend_Controller_Request_Http $request * @param Zend_Controller_Response_Http $response * @return Mage_Core_Model_Url */ public function rewrite(Zend_Controller_Request_Http $request = null, Zend_Controller_Response_Http $response = null) { if (is_null($request)) { $request = Mage::app()->getFrontController()->getRequest(); } if (!Mage::helper('ecommerceteam_sln')->forceLayered()) { if (true == parent::rewrite($request, $response)) { return true; } } /** @var $helper EcommerceTeam_Sln_Helper_Request */ $helper = Mage::helper('ecommerceteam_sln/request'); $helper->rewrite($request); return true; }
function rewrite(Zend_Controller_Request_Http $request = null, Zend_Controller_Response_Http $response = null) { if (is_null($request)) { $request = Mage::app()->getFrontController()->getRequest(); } if (is_null($response)) { $response = Mage::app()->getFrontController()->getResponse(); } $this->request = $request; $this->uri = $request->getRequestUri(); if ($this->isProductListingRequest()) { return $this->rewriteProductListing(); } if ($this->isVehicleProductRequest()) { $this->rewriteVehicleProductRequest(); } return parent::rewrite($request, $response); }
public function rewrite(Zend_Controller_Request_Http $request = null, Zend_Controller_Response_Http $response = null) { $h = Mage::helper('gomage_checkout'); if ($h->getConfigData('general/enabled')) { if (is_null($request)) { $request = Mage::app()->getFrontController()->getRequest(); } $requestPath = trim($request->getPathInfo(), '/'); if ($requestPath == 'checkout/onepage' || $requestPath == 'checkout/onepage/index') { if (in_array(Mage::app()->getStore()->getWebsiteId(), $h->getAvailavelWebsites())) { if (!($h->isMobileDevice() && (bool) $h->getConfigData('general/disable_mobile'))) { $request->setAlias(self::REWRITE_REQUEST_PATH_ALIAS, $this->getRequestPath()); $request->setPathInfo('gomage_checkout/onepage'); return true; } } } } parent::rewrite($request, $response); }
public function rewrite(Zend_Controller_Request_Http $request = null, Zend_Controller_Response_Http $response = null) { $result = parent::rewrite($request, $response); if (false !== $result) { return $result; } if (!Mage::isInstalled()) { return false; } if (is_null($request)) { $request = Mage::app()->getFrontController()->getRequest(); } $initialRequestPath = trim($request->getPathInfo(), '/'); $suffix = Mage::getStoreConfig('catalog/seo/category_url_suffix'); $pqSuffix = self::SEO_SUFFIX . $suffix; if ($pqSuffix == substr($initialRequestPath, strlen($initialRequestPath) - strlen($pqSuffix))) { $requestPath = substr($initialRequestPath, 0, strlen($initialRequestPath) - strlen($pqSuffix)); if (is_null($this->getStoreId()) || false === $this->getStoreId()) { $this->setStoreId(Mage::app()->getStore()->getId()); } $this->loadByRequestPath($requestPath . $suffix); if ($this->getId()) { $request->setPathInfo('productquestions/index/index/'); $request->setParam('id', $this->getProductId()); if ($this->getCategoryId()) { $request->setParam('category', $this->getCategoryId()); } if (Mage::getConfig('productquestions/seo/cache_requests')) { try { $this->setUrlRewriteId(null)->setRequestPath($initialRequestPath)->setTargetPath('productquestions/index/index/id/' . $this->getProductId() . '/category/' . $this->getCategoryId())->setIdPath($this->getIdPath() . '/questions')->setIsSystem(0)->save(); } catch (Exception $e) { Mage::logException($e); } } return parent::rewrite($request, $response); } } return false; }
public function testRewriteNonExistingRecordCorrectStore() { $response = new Magento_Test_Response(); $_GET['___from_store'] = Mage::app()->getDefaultStoreView()->getCode(); $this->assertFalse($this->_model->rewrite(null, $response)); }