【问题标题】:Change search results product url to include category更改搜索结果产品网址以包含类别
【发布时间】:2014-03-07 04:40:22
【问题描述】:

如何更改我的 magento 快速搜索产品结果 url 以包含类别?

url.com/product.html 到 url.com/category/product.html

我知道规范 URL 有一些选项。但我还是想改。

我的产品是单一类别的,但如果它有更多选择第一个的故障保险将很棒。

【问题讨论】:

    标签: magento magento-1.8


    【解决方案1】:

    在后台进入

    系统>配置>目录>搜索引擎优化

    并为产品 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);
    

    【讨论】:

    • 默认情况下已经是“是”。这个问题只有在你按类别去时才有效。但是,如果您搜索产品,它始终是 website.com/product.html
    • 目录/产品/list.phtml。但是这个文件也用于其他产品集合。您可能只需要为搜索结果创建不同的另一个 phtml 文件
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-08
    • 2014-09-06
    相关资源
    最近更新 更多