/** * Retrieve route URL * * @param string $routePath * @param array $routeParams * @return string */ public function getRouteUrl($routePath = null, $routeParams = null) { $url = parent::getRouteUrl($routePath, $routeParams); $baseUrl = trim($this->getBaseUrl(), '/'); $vdeBaseUrl = $baseUrl . '/' . $this->_helper->getFrontName(); if (strpos($url, $baseUrl) === 0 && strpos($url, $vdeBaseUrl) === false) { $url = str_replace($baseUrl, $vdeBaseUrl, $url); } return $url; }
/** * return the Route URL * * @param string $routePath * @param array $routeParams * @return string */ public function getRouteUrl($routePath = null, $routeParams = null, $getOriginalData = false) { if (!Mage::getSingleton('Flagbit_Typo3connect/Core')->isEnabled() || $getOriginalData) { return parent::getRouteUrl($routePath, $routeParams); } $this->unsetData('route_params'); if (!is_null($routePath)) { $this->setRoutePath($routePath); } if (is_array($routeParams)) { $this->setRouteParams($routeParams, false); } $url = $this->getRoutePath($routeParams); //$url = $this->getBaseUrl().$this->getRoutePath($routeParams); return $url; }
/** * Note: isolation flushes the URL memory cache * @magentoAppIsolation enabled */ public function testGetRouteUrl() { $this->assertEquals('http://localhost/index.php/', $this->_model->getRouteUrl()); $this->assertEquals('http://localhost/index.php/catalog/product/view/id/50/', $this->_model->getRouteUrl('catalog/product/view', array('id' => 50))); $this->assertEquals('http://localhost/index.php/fancy_uri', $this->_model->getRouteUrl('core/index/index', array('_direct' => 'fancy_uri'))); }