How to change magento search results in alphabetical order

Magento Quick Search Default Sorting

Magento Quick Search functionality by default orders the results based on relevance. Sometimes we may need to change the search results to be ordered alphabatically or any custom order based on product attribute. We can achieve this by adding a simple code snippet in our themes layout file.

Make Sure the Product Name Attribute is Searchable

In Order to Sort the search results by product name, the name attribute should be configured properly in Magento Admin Panel. Navigate to Catalog -> Manage Attributes and search by the attribute code. For Product name the attribute code is name. The Attribute configuration must be changed to use in the Product Listing and Sorting.

Finally in your current theme create a file name local.xml to override the default behaviour and add the below code snippet.

Compatability :- Magento 1.8,1.9

Leave a Comment

Your email address will not be published. Required fields are marked *