Magento News

 

How To Remove The “Position” Sort Option

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 ?>
    </option>
<?php endforeach; ?>
</select>

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 ?>
        </option>
    <?php endif; // End for removing "Position" sort option ?>
<?php endforeach; ?>
</select>

And you’ve done!

How To Remove The “Position” Sort Option

Possibly Related Posts:


 

Leave a Reply