【发布时间】:2014-03-07 04:40:22
【问题描述】:
如何更改我的 magento 快速搜索产品结果 url 以包含类别?
url.com/product.html 到 url.com/category/product.html
我知道规范 URL 有一些选项。但我还是想改。
我的产品是单一类别的,但如果它有更多选择第一个的故障保险将很棒。
【问题讨论】:
标签: magento magento-1.8
如何更改我的 magento 快速搜索产品结果 url 以包含类别?
url.com/product.html 到 url.com/category/product.html
我知道规范 URL 有一些选项。但我还是想改。
我的产品是单一类别的,但如果它有更多选择第一个的故障保险将很棒。
【问题讨论】:
标签: magento magento-1.8
在后台进入
系统>配置>目录>搜索引擎优化
并为产品 URL 设置使用类别路径
或在搜索页面中,
$product = Mage::getModel('catalog/product')->load($product_id);
$category_id = $product->getCategoryIds();
$category = Mage::getModel('catalog/category')->load($category_id[0]);
$url = $product->getUrlPath($category);
【讨论】: