magento 多网店部分域名url加站点code
1、后台System=>Web=>Url Options下的Add Store Code to Urls属性值选为Yes;2、修改app/code/core/Mage/Core/Model/Store.php文件下的getStoreInUrl函数,把public function getStoreInUrl(){return Mage::isInstalled()
·
1、后台System=>Web=>Url Options下的Add Store Code to Urls属性值选为Yes;
2、修改app/code/core/Mage/Core/Model/Store.php文件下的getStoreInUrl函数,把
public function getStoreInUrl()
{
return Mage::isInstalled() && $this->getConfig(self::XML_PATH_STORE_IN_URL);
}改为
public function getStoreInUrl()
{
if($this->getCode() == 'test1' || $this->getCode() == 'admin'){
return Mage::isInstalled() && $this->getConfig(self::XML_PATH_STORE_IN_URL);
}else{
return false;
}
}
3、修改app/code/core/Mage/Core/Controller/Request/Http.php下的setPathInfo函数,把
if ($this->_canBeStoreCodeInUrl()) {
$pathParts = explode('/', ltrim($pathInfo, '/'), 2);
$storeCode = $pathParts[0];
if (!$this->isDirectAccessFrontendName($storeCode)) {
$stores = Mage::app()->getStores(true, true);
if ($storeCode!=='' && isset($stores[$storeCode])) {
Mage::app()->setCurrentStore($storeCode);
$pathInfo = '/'.(isset($pathParts[1]) ? $pathParts[1] : '');
}
elseif ($storeCode !== '') {
$this->setActionName('noRoute');
}
}
}改为
if ($this->_canBeStoreCodeInUrl()) {
$pathParts = explode('/', ltrim($pathInfo, '/'), 2);
$storeCode = $pathParts[0];
if($storeCode == 'test1' || $storeCode == 'admin'){
if (!$this->isDirectAccessFrontendName($storeCode)) {
$stores = Mage::app()->getStores(true, true);
if ($storeCode!=='' && isset($stores[$storeCode])) {
Mage::app()->setCurrentStore($storeCode);
$pathInfo = '/'.(isset($pathParts[1]) ? $pathParts[1] : '');
}
elseif ($storeCode !== '') {
$this->setActionName('noRoute');
}
}
}
}
'test1'为要要添加code的子站点
更多推荐

所有评论(0)