/** * Redirect to entity (category or product) in new store * * @param int $rewriteId * * @return null|void */ public function _checkStoreRedirect($rewriteId) { if ($this->_prevStoreId == $this->_storeId) { return; } $redirect = $this->_redirectResource->getRedirectByRewriteId($rewriteId); if (!empty($redirect['product_id'])) { $requestPath = $this->_getProductRequestPath($redirect, $redirect['category_id']); } elseif (!empty($redirect['category_id'])) { $requestPath = $this->_getCategoryRequestPath($redirect); } if (!empty($requestPath)) { $this->_response->setRedirect($requestPath, 301); $this->_request->setDispatched(true); } }
/** * Redirect to category from another store if custom url key defined * * @param int $rewriteId */ protected function _checkStoreRedirect($rewriteId) { if ($this->_prevStoreId != $this->_storeId) { $categoryId = $this->_categoryResource->getCategoryIdByRewriteId($rewriteId); if (!empty($categoryId)) { $rewrite = $this->_categoryResource->getRewriteByCategoryId($categoryId, $this->_storeId); if (!empty($rewrite)) { $requestPath = $rewrite['request_path']; if (!empty($this->_newStoreSeoSuffix)) { $requestPath .= '.' . $this->_newStoreSeoSuffix; } $requestPath = $this->_getBaseUrl() . $requestPath; $this->_response->setRedirect($requestPath, 301); $this->_request->setDispatched(true); } } } }
/** * @param $url */ protected function _handleRedirect($url) { $redirectUrl = Mage::getUrl($url); $this->_response->setRedirect($redirectUrl); $this->_controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, TRUE); }