Magento: How To Remove The "Position" Sort Option

Magento Icon

I had a client ask me today to remove the “Position” option from the toolbar on the category product listing. I realized that there are probably a lot of people that don’t ever utilize position, and therefore it is basically useless and should be removed so it doesn’t cause any confusion for the people browsing the store.

Unfortunately, this is not a listed attribute that you can easily turn on or off as far as sorting goes. So, we have to do it the harder way and dive into the code.

There may be a “better” way to do this, I’m not sure, but this is super easy and it works. All you have to do is edit the file /app/design/frontend/yourpackage/yourtheme/template/catalog/product/list/toolbar.phtml. Towards the bottom, you’ll find the sort by code that outputs a select element. It looks like this:

<?php echo $this->__('Sort by') ?> <select onchange="setLocation(this.value)">
<?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
    <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
        <?php echo $_order ?>
<?php endforeach; ?>

Change that to this (just adds an if statement):

<?php echo $this->__('Sort by') ?> <select onchange="setLocation(this.value)">
<?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
    <?php if ($_order != 'Position') : // Remove "Position" from the sort option list ?>
        <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
            <?php echo $_order ?>
    <?php endif; // End for removing "Position" sort option ?>
<?php endforeach; ?>

And that all it takes. If anyone knows of a better/easier way to do it, please let me know.

This entry was posted in Magento, PHP. Bookmark the permalink.

35 Responses to Magento: How To Remove The "Position" Sort Option

  1. asra says:

    worked for me!! thanks !!

  2. PrepMaster says:

    Awesome! Works beautifully.

  3. Anwar says:

    First i have been created a new attribute “Featured” input type “yes/no”. If i select yes product should be featured. My Problem i can’t show default sorting featured .
    I try to edit toolbar.phtml this way. would you help me
    <option value="getOrderUrl(‘featured’, ‘asc’) ?>”isOrderCurrent(‘featured’) && $this->getCurrentDirection() == ‘asc’): ?> selected=”selected”>Featured
    <option value="getOrderUrl(‘sku’, ‘asc’) ?>”isOrderCurrent(‘sku’) && $this->getCurrentDirection() == ‘asc’): ?> selected=”selected”> sku – Low to High
    <option value="getOrderUrl(‘sku’, ‘desc’) ?>”isOrderCurrent(‘sku’) && $this->getCurrentDirection() == ‘desc’): ?> selected=”selected”> sku – High to Low
    <option value="getOrderUrl(‘name’, ‘asc’) ?>”isOrderCurrent(‘name’) && $this->getCurrentDirection() == ‘asc’): ?> selected=”selected”> name- A to Z
    <option value="getOrderUrl(‘name’, ‘desc’) ?>”isOrderCurrent(‘name’) && $this->getCurrentDirection() == ‘desc’): ?> selected=”selected”> name- Z to A

  4. vivek says:


    I have best seller and most viewed block but i need to call by link to sort by in to solve it…please advise me..(say for my English..)

    {{block type=”catalog/product_mostviewed” template=”catalog/product/mostviewed.phtml”}}

  5. victorzz says:

    Thank you so much :)

  6. Praful says:

    Thank You,

    Very useful help I mean code :)

  7. mahesh babu bokkisam says:

    in toolbar.phtml
    $notAllowbleKeys = array(‘position’, ‘price’);
    // Loop and print the sort by options
    foreach($this->getAvailableOrders() as $_key=>$_order){
    // Allow only selected sort by options
    if ( ! in_array($_key, $notAllowbleKeys )) { }

  8. Jelle says:

    For those who have issues with multi language, change ‘Position’ in the if to $this->__(‘Position’) . This will make Magento remove the translated ‘Position ‘.

  9. GLOKAL says:

    Hi there

    I would like to echo position no. on the product listing on frontend. But how can I do this? It sorts by position no. but I cannot get it to echo the numbers in the listing?

    Please advice:-)

  10. elvar says:

    How to reorder the attributes for sorting?

    Currently I have now 3 – Name, Price and Newest (without Position)

    I want to have it listed differently and column ‘Position’ in table ‘`catalog_eav_attribute’ does not affect it. Also even if Position method for sorting is pulled out – category listing is still by default with it.

    • Mo says:

      To answer the last part of your question:

      Prattski’s solution does work, you could also insert this line in the same spot (no if and closing if clause needed):

      removeOrderFromAvailableOrders(‘position’); ?>

      Anyways once done, head down to Magento backend:

      System > Configuration > Catalog > Catalog > Frontend

      Change “product listing sort by” from “best value” to “[your default sort attribute]”

      I noticed the same odd thing but it was a simple fix :)

  11. Daco says:

    Or, you could just set manually the order field you want to use (in this case ‘price’)
    <a href="getOrderUrl(‘price’, ‘desc’) ?>” title=”__(‘Set Descending Direction’) ?>”>Desc
    in toolbar.php

  12. Priya says:

    Thanks for the Information, I was looking for it for a long time,

    After installing the google webmaster file, I saw 10000 of unnecessary links cached by google, I even block the URL but that was not the full solution.

    After removing this I think I get the solution.

    Million thanks.

  13. jimboboy says:

    you can also select only the attribtues you want to use in the sort by dropdown menu, in the catalog > manage categories > display settings… just uncheck the “Use All Available Attributes” checkbox and select only the attributes you want to use

    • eramos says:

      Thanks jimboboy, your solution by doing the following did work and it is flexible to edit it by “category”
      catalog > manage categories > display settings… just uncheck the “Use All Available Attributes” checkbox and select only the attributes you want to use

  14. Harsh says:

    Thanks dude , 😉

  15. Pingback: Removing Default Catalog Sort Options in Magento | Spenser Baldwin

  16. Oh, the xml for the config has been removed from my post. Here is it again, but replaced “” with “/” and “\”


  17. The best way to remove “Position” from Sort-By-List is the following:

    Create a new PHP class in app/code/local/$MyCompany/Catalog/Model/Config.php which extends Mage_Catalog_Model_Config and overwrite the Method “getAttributeUsedForSortByArray()”.

    If this is done, you extend your module’s config xml file with:


    This is not the easiest way, but the cleanest 😉

  18. Istvan Nonn says:

    I tried and it doesn’t work, probably because I have

    The solution is this line in magento :
    removeOrderFromAvailableOrders('position'); ?>
    and you need to insert before:
    getAvailableOrders() as $_key=>$_order): ?>

    I think with this solution you can remove name and price as well or other attribute where you defined sortable.

    • Istvan Nonn says:

      and you need to insert before:
      foreach($this->getAvailableOrders() as $_key=>$_order):

    • MageDeveloper says:

      Thanks dude,, this is working for me in

  19. Pingback: Wöchentliche Linktipps | User Agent - Websites, Online-Marketing, Berlin

  20. Chris says:

    This worked perfectly – thanks for being such a great resource!

  21. Paeddl says:

    It is better to use the array index for this issue, because the array value contains the localization. Use this code instead:

  22. Rich says:

    Is there a way to just modify the way the option ‘Position’ sorts? That is the only one that I want to sort desc. All the rest I want to sort asc.

    • Josh Pratt says:

      Rich – I know there is a way to do it, I just don’t remember off the top of my head… With a little searching around, you should be able to find it.

  23. toniyecla says:

    in 1.4, you can try to comment this in app/code/core/Mage/Catalog/Model/Config.php:

    public function getAttributeUsedForSortByArray()
    $options = array(
    // ‘position’ => Mage::helper(‘catalog’)->__(‘Position’)
    foreach ($this->getAttributesUsedForSortBy() as $attribute) {
    /* @var $attribute Mage_Eav_Model_Entity_Attribute_Abstract */
    $options[$attribute->getAttributeCode()] = $attribute->getStoreLabel();

    return $options;

    • Josh Pratt says:

      I do not suggest doing the above (DO NOT EDIT CORE CODE).

      At a bare minimum, move the above mentioned file to app/code/local/Mage/Catalog/Model/Config.php and then make the edit.

  24. Mrnl says:

    Hi Josh Pratt,

    Just looking at your site again.
    And saw that you answered my question. tried it and it works.
    Thanks very much.
    That a simple yes or no can make so much difference.

    Maybe an idea for you , when you or someone else answers a comment that the people who left a comment get an e-mail.

  25. Mrnl says:

    I am working on a local host to test if i want to start a shop and i can design it. I have a question for U.

    If u make attributes for products they come in additional information, now i have implemented a video and made a new tab for it, but the video keeps showing up in additional also and i do not want that. Do you know how i can fix it.


    • Josh Pratt says:


      The reason it is showing up in the Additional Information is most likely because for that attribute you have “Yes” selected for the “Visible on Product View Page on Front-end” option. You need to turn that to “No”.

  26. Andy says:

    Thank you . This was a big help. I have a quick question. Is there a way to change to sort order from asc to desc for just one category?

    • Josh Pratt says:


      Sure there is. You’ll have to do a check for the category you are wanting to reverse, then change the line that says ‘asc’ to ‘desc’.