2011-06-10 114 views
5

如何将排序顺序更改为Magento搜索结果页中的名称?Magento - 更改排序顺序到搜索结果中的名称

感谢您的帮助。

+0

你没有在那里分选方法中,选择工具栏? – 2011-06-10 09:26:40

+0

我掩盖了它,我的厨师不想展示它。任何解决方案按产品名称进行默​​认排序 – Bizboss 2011-06-10 15:09:21

回答

7

&order=name添加到您的查询字符串中。为了做到这一点去/app/design/frontend/{your-interface}/{your-theme}/template/catalogsearch/advanced/form.phtml和刚刚闭幕</form>标记前新增

<input type="hidden" name="order" value="name"/> 

+0

非常感谢,你救了我的命! 我只将它添加到form.mini.phtml – Bizboss 2011-06-10 15:50:22

+0

您是否也知道如何订购Autocomplete搜索表单中的建议? – Bizboss 2011-06-10 15:51:23

+0

这将会复杂得多。我建议提出另一个问题。 – 2011-06-10 17:21:24

21

在你的主题(例如/app/design/frontend/{your-interface}/{your-theme}/layout/)创建一个文件local.xml具有以下内容:

<?xml version="1.0" encoding="UTF-8"?> 
<layout> 
    <catalogsearch_result_index> 
     <reference name="search_result_list"> 
      <action method="setDefaultDirection"><param>asc</param></action> 
      <action method="setSortBy"><param>name</param></action> 
     </reference> 
    </catalogsearch_result_index> 
    <catalogsearch_advanced_result> 
     <reference name="search_result_list"> 
      <action method="setDefaultDirection"><param>asc</param></action> 
      <action method="setSortBy"><param>name</param></action> 
     </reference> 
    </catalogsearch_advanced_result> 
</layout> 
+2

在Magento'1.7.0.2'上,我必须将这个文件放在'/ app/design/frontend/default/{theme}/layout/local.xml'中。除此之外,完美的工作。 – Maurice 2013-01-20 16:41:58

+1

这个方法的+1,因为简单地添加查询字符串来设置排序是有问题的。 – pspahn 2013-01-22 18:38:19

+0

这个真的很整洁!完成了这项工作。 – anshuman 2013-07-19 13:56:02