Monday, 16 March 2015

Magento: Change the ‘Price’ sort by option to ‘Price: Low > High’ and ‘Price: High > Low’

Magento: Change the ‘Price’ sort by option to ‘Price: Low > High’ and ‘Price: High > Low’

Posted on
This is a quick way of change the Price sort by option in Magento, to ‘Price: Low > High’ and ‘Price: High > Low’.
I know there is the sort by direction ‘arrow’ next to the sort by option, but it is not clearly visible to the customers.

So, make the following changes to the /app/design/frontend/base/default/template/catalog/product/list/toolbar.phtml file.
Change
1
2
3
<option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
    <?php echo $this->__($_order) ?>
</option>
to
1
2
3
4
5
6
7
8
9
10
11
12
<?php if ($_order != 'Price'): ?>
<option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
    <?php echo $this->__($_order) ?>
</option>
<?php else: ?>
<option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key) && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>>
    <?php echo $this->__($_order) . ': Low > High' ?>
</option>
<option value="<?php echo $this->getOrderUrl($_key, 'desc') ?>"<?php if($this->isOrderCurrent($_key) && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
    <?php echo $this->__($_order) . ': High > Low' ?>
</option>
<?php endif; ?>


No comments:

Post a Comment