/** * Rewriting this method to output new urls. * Checks if a rewrite already exists, otherwise creates it. */ public function getReviewUrl() { $product = $this->getProduct(); $routePath = ''; $routeParams = array(); $storeId = Mage::app()->getStore()->getId(); $this->setStoreId($storeId); if (!$product) { if ($this->getEntityId() != 1) { return parent::getReviewUrl(); } $product = Mage::getModel('catalog/product')->load($this->getEntityPkValue()); } $product->setStoreId($storeId); $idPath = sprintf('review/%d', $this->getId()); $rewrite = $this->getUrlRewrite(); $rewrite->setStoreId($storeId)->loadByIdPath($idPath); $storeUrl = Mage::getBaseUrl(); if (substr($storeUrl, strlen($storeUrl) - 1, 1) != '/') { $storeUrl .= '/'; } if ($rewrite->getId()) { // REWRITE RULE EXISTS $url = $storeUrl . $rewrite->getRequestPath(); } else { // CREATE REWRITE RULE $model = Mage::getModel('reviewsearchfriendlyurls/url'); $url = $storeUrl . $model->addSingleReviewUrlRewrite($this, $product); } return $url; }