How to Reset sort order on new search in Magento?



Today one of the my client has sent a new problem in his Magento Store, He has the problem with the sort order of the product in new search. In the Magento search it remembers the Sort By Order selected by the user on the new search. Let me explain the problem here visit your Magento Store and make a search and on the search result page click on the Sort By Position or Name or Price, Suppose you have selected the Sort By Price in Descending Order, and now make a new search and analyze the search result it will display all the products Sorted by the Price in Descending Order Although the default might be relevance. Where as whenever you are making a new search it should display the products with the default sort by options. In this post I am trying to describe how to get rid of such kind of problem, it is very easy just follow the steps given below:

If you want Add Custom “Sort By” Drop Down options In Magento visit thie page.

Step 1: Navigate to the app/design/frontend/base/default/template/catalogsearch/form.mini.phtml if you are using the default Magento and if you are using your custom template navigate to the app/design/frontend/base/default/template/catalogsearch/form.mini.phtml and search for the form.mini.phtml

Step 2: Now Open this file in your favourite editor.
Step 3: Now Search for the starting form tag.
Step 4: Add the code just below to the form tag

<input type="hidden" name="dir" value="desc" />
<input type="hidden" name="order" value="relevance" />

So whenever user will use the quick search, it will show the data by default sort by descending relevance.

Hope it helps and if you need the professional Magento Development we can help you, just Click on the Link and send me your requirements.

Please Like the Post on Facebook or Google+.