1.后台system -> configuration -> catalog -> Search Engine Optimizations
中Use Categories Path for Product URLs
2.app/code/core/mage/catalog/model/product/url.php
修改getUrl函数
if (empty($requestPath) && $requestPath !== false) {
$idPath = sprintf('product/%d', $product->getEntityId());
//以下代码注释
//if ($categoryId) {
// $idPath = sprintf('%s/%d', $idPath, $categoryId);
//}
$rewrite = $this->getUrlRewrite();
$rewrite->setStoreId($storeId)
->loadByIdPath($idPath);
if ($rewrite->getId()) {
$requestPath = $rewrite->getRequestPath();
$product->setRequestPath($requestPath);
} else {
$product->setRequestPath(false);
}
}
本文详细介绍了如何在电商网站后台配置,将产品页面的关联产品URL路径从分类名改为仅包含产品ID,以提升用户体验和SEO效果。
605

被折叠的 条评论
为什么被折叠?



