Friday, 6 July 2012

Removing dropdowns from Product List Pager in magnto

Magento styles the “Sort By” and “Show x per page” with a drop down, however for one of our sites we needed to put these into a link list. The change was easier to enact than I thought (or at least by Magento’s standards). So if you want to do it yourself:

1. Open up template/catalog/product/list/toolbar.phtml, and look for the “Sort By” div. Completely replace the select and dropdown options with:
<?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
<a href=”<?php echo $this->getOrderUrl($_key, ‘asc’) ?>” ><?php echo $this->__($_order) ?></a>
<?php endforeach; ?>

2. In the same file, look for the “Limiter” div and replace with:
<div class=”limiter”>
<label><?php echo $this->__(‘Show’) ?></label>
<?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
<a href=”<?php echo $this->getLimitUrl($_key) ?>”><?php echo $_limit ?></a>
<?php endforeach; ?>
<?php echo $this->__(‘per page’) ?>
</div>
The result:

1 comment:

Note: only a member of this blog may post a comment.