在Magento1.7或
以前的版本中,当你启用多语言或多店铺,并在“系统->配置->Web”里设置Url Options “Add Store
Code to Urls”为YES
。这个时候,很多SKU多语言或多店铺的产品URL也会跟关不同的语言或店铺发生变化,直接切换语言或店铺时就会出现404页面。
解决方法:
1、修改文件: /app/code/core/Mage/Core/Model/Url/Rewrite.php 第252行:
// $targetUrl = $request->getBaseUrl(). ‘/’ .
$this->getRequestPath();
注释掉,添加这段代码:
if (Mage::getStoreConfig(‘web/url/use_store’) && $storeCode
= Mage::app()->getStore()->getCode()) { $targetUrl =
$request->getBaseUrl(). ‘/’ .
Mage::app()->getStore()->getCode() . ‘/’ .
$this->getRequestPath(); } else $targetUrl =
$request->getBaseUrl(). ‘/’ . $this->getRequestPath();
关于后台的index.php/admin的修改:
2、修改文件:
/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php
第526行:
//$this->_getOptionDownloadUrl($urlRoute, $urlParams),
添加这段代码:
str_replace(“index.php/admin”,
ONE_OF_YOUR_STORE_CODE,$this->_getOptionDownloadUrl($urlRoute,
$urlParams)),
不知道大家有更好的方法,请给本文留言分享,谢谢!