Magento different sort dropdown.

      No Comments on Magento different sort dropdown.

Sometimes you need/want a better dropdown for magento sorting.  Here’s an example of how to make one.

Try using this code for template/catalog/product/list/toolbar.phtml

[code language=”php”]
<fieldset class="sort-by">
<label><?php echo $this->__(‘Sort by’) ?></label>
<select onchange="setLocation(this.value)">
<option value="<?php echo $this->getOrderUrl(‘position’, ‘asc’) ?>"<?php if($this->isOrderCurrent(‘position’) && $this->getCurrentDirection() == ‘asc’): ?> selected="selected"<?php endif; ?>>
Featured
</option>
<option value="<?php echo $this->getOrderUrl(‘price’, ‘asc’) ?>"<?php if($this->isOrderCurrent(‘price’) && $this->getCurrentDirection() == ‘asc’): ?> selected="selected"<?php endif; ?>>
Lowest Price
</option>
<option value="<?php echo $this->getOrderUrl(‘price’, ‘desc’) ?>"<?php if($this->isOrderCurrent(‘price’) && $this->getCurrentDirection() == ‘desc’): ?> selected="selected"<?php endif; ?>>
Highest Price
</option>
<option value="<?php echo $this->getOrderUrl(‘name’, ‘asc’) ?>"<?php if($this->isOrderCurrent(‘name’) && $this->getCurrentDirection() == ‘asc’): ?> selected="selected"<?php endif; ?>>
Name A-Z
</option>
<option value="<?php echo $this->getOrderUrl(‘name’, ‘desc’) ?>"<?php if($this->isOrderCurrent(‘name’) && $this->getCurrentDirection() == ‘desc’): ?> selected="selected"<?php endif; ?>>
Name Z-A
</option>
<option value="<?php echo $this->getOrderUrl(‘entity_id’, ‘desc’) ?>"<?php if($this->isOrderCurrent(‘entity_id’) && $this->getCurrentDirection() == ‘desc’): ?> selected="selected"<?php endif; ?>>
Newest to Oldest
</option>
<option value="<?php echo $this->getOrderUrl(‘entity_id’, ‘asc’) ?>"<?php if($this->isOrderCurrent(‘entity_id’) && $this->getCurrentDirection() == ‘asc’): ?> selected="selected"<?php endif; ?>>
Oldest to Newest
</option>
</select>
</fieldset>
[/code]

This code was pulled from an answer to a blog post here. http://magentoexpert.com/ascending-descending-sort-by-order/

Leave a Reply

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