Home    Articles

 

Magento search results - how to change the default sort order from Relevance

 

Hi.

It is extreamly easy to change the default sort order by just adding 2 hidden input fields.

1. Change the default sort order

Magento's default sort order is Relevance, if you want to change default sort order to price or name you should add this code:

<input type="hidden" name="order" value="price" />
<input type="hidden" name="dir" value="asc" />

to this file: app/design/frontend/*/*/template/catalogsearch/form.mini.phtml anywhere between <form> tags.

This code will set the default sort order from relevance to price in ascending order.

If you want to change the default sort order to name you can replace value="price" with value="name".

If you want to make this change into magento advanced search, use the same code in this file in the same way:

app/design/frontend/*/*/template/catalogsearch/advanced/form.phtml

That's all.

 

by