When I do any search we can see a list of products with the field "Sort by", but I need get rid of the option "Relevance": enter image description here

If I go to a category from menu I don't have this sorter.

Any idea?

2 Answers 2


To remove relevance sort order in searching you can rewrite below class


Mage_CatalogSearch_Block_Result in your custom module

and rewrite this method in this class setListOrders

and comment below code

 $availableOrders = array_merge(array(
        'relevance' => $this->__('Relevance')
    ), $availableOrders);

Sort options are set in Mage_CatalogSearch_Block_Result::setListOrders()

To override this you can add something like this to your local.xml

    <reference name="search_result_list">
        <action method="setAvailableOrders">

This would give you 2 sorting options (Name and Price). You can also use a helper method to make it more flexible ...

Edit: bit more flexible ... you dont have to care about other sort options, it just removes relevance:

    <reference name="search_result_list">
        <action method="setAvailableOrders">
            <sort helper="[your_helper]/removeRelevanceFromSortOptions" />

For you helper you can use this:

public function removeRelevanceFromSortOptions()
    $availableOrders = Mage::getSingleton('catalog/layer')

    # no need to to this ... see setListOrders()
    # unset($availableOrders['relevance']);

    return $availableOrders;
  • 1
    Bro I think Op ask for search , not for category Jun 28, 2018 at 10:10
  • You always welcome bro :) , but how we can remove one sorting with this, because , Relevance is hard coded in PHP code over there Jun 28, 2018 at 10:55
  • but +1 for this answer as I am not aware of it Jun 28, 2018 at 10:58
  • @MurtuzaZabuawala You do not remove one particular item, you (re-)set all sort options.
    – sv3n
    Jun 28, 2018 at 10:58
  • @sv3n Yes, But I only need remove one sorting.
    – str_lml
    Jun 28, 2018 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.