HTML/JavaScript

Tuesday, August 27, 2013

Magento Layered Navigation in Drop-Down

Magento Layered Navigation in Drop-Down

It is very simple.
We just need to replace the contents of file
/app/design/frontend/default/your-magento-template/template/catalog/layer/filter.phtml
with

<select onchange="setLocation(this.value)">
  <option value=""><?php echo 'Choose an Option...' ?></option>
<?php foreach ($this->getItems() as $_item): ?>
    <option
        <?php if ($_item->getCount() > 0): ?>
        value="<?php echo $this->urlEscape($_item->getUrl()) ?>">
<?php echo $_item->getLabel() ?>
        <?php else: echo '>' . $_item->getLabel() ?>
        <?php endif; ?>
        (<?php echo $_item->getCount() ?>)
    </option>
<?php endforeach ?>
</select>

No comments:

Post a Comment