有人可以帮助我有以下问题:Magento的类路径改变
我想改变类别的URL。
现在如下http://tuinbeursnederland.nl.testbyte.nl/blokhutten-tuinhuizen/blokhutten/op-maat/
而且我希望它像这样:http://tuinbeursnederland.nl.testbyte.nl/blokhutten/op-maat/
但类别/ blokhutten-tuinhuizen /必须保持。
任何人有任何想法?
有人可以帮助我有以下问题:Magento的类路径改变
我想改变类别的URL。
现在如下http://tuinbeursnederland.nl.testbyte.nl/blokhutten-tuinhuizen/blokhutten/op-maat/
而且我希望它像这样:http://tuinbeursnederland.nl.testbyte.nl/blokhutten/op-maat/
但类别/ blokhutten-tuinhuizen /必须保持。
任何人有任何想法?
你可以通过url重写来实现这一点。
去URL重写和添加自定义URL重写,给唯一的ID路径。
并在请求路径中给出http://tuinbeursnederland.nl.testbyte.nl/blokhutten-tuinhuizen/blokhutten/op-maat/
此URL并在目标路径中给这个URL http://tuinbeursnederland.nl.testbyte.nl/blokhutten/op-maat/
magento在内部考虑它的使用目标路径。
有关网址更多相关资料重写,你可以在这里看到http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/urlrewrite/index
http://blog.beetleweb.com/2012/10/creating-custom-magento-url-rewrites/
class CP_Core_Model_Catalogurl extends Mage_Catalog_Model_Url
{
/**
* Retrieve Category URL
*
* @param array $params
* @return string
*/
public function getCategoryRequestPath($category, $parentPath)
{
$storeId = $category->getStoreId();
$idPath = $this->generatePath('id', null, $category);
$suffix = $this->getCategoryUrlSuffix($storeId);
if (isset($this->_rewrites[$idPath])) {
$this->_rewrite = $this->_rewrites[$idPath];
$existingRequestPath = $this->_rewrites[$idPath]->getRequestPath();
}
if ($category->getUrlKey() == '') {
$urlKey = $this->getCategoryModel()->formatUrlKey($category->getName());
}
else {
$urlKey = $this->getCategoryModel()->formatUrlKey($category->getUrlKey());
}
$categoryUrlSuffix = $this->getCategoryUrlSuffix($category->getStoreId());
if (null === $parentPath) {
$parentPath = $this->getResource()->getCategoryParentPath($category);
}
elseif ($parentPath == '/') {
$parentPath = '';
}
$parentPath = Mage::helper('catalog/category')->getCategoryUrlPath($parentPath,
true, $category->getStoreId());
$parentPath = '';
$requestPath = $parentPath . $urlKey . $categoryUrlSuffix;
if (isset($existingRequestPath) && $existingRequestPath == $requestPath . $suffix) {
return $existingRequestPath;
}
if ($this->_deleteOldTargetPath($requestPath, $idPath, $storeId)) {
return $requestPath;
}
return $this->getUnusedPath($category->getStoreId(), $requestPath,
$this->generatePath('id', null, $category)
);
}
}
请重写模块就像我上面做自定义此功能。
你好Dharmesh Hariyani, 我应该准确调整哪个文件? –