/** * Get new store category path * * @param int $categoryId * @return string */ protected function _getNewStoreCategoryPath($categoryId) { $categoryPath = ''; if (!empty($categoryId)) { $rewrite = $this->_categoryResource->getRewriteByCategoryId($categoryId, $this->_storeId); if (!empty($rewrite)) { $categoryPath = $rewrite['request_path']; } } return $categoryPath; }
/** * 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); } } } }