Thursday, January 5, 2012

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>
and you are done.

23 comments:

  1. I paste above code in my page but it did not work.

    THanks anyway

    ReplyDelete
    Replies
    1. Can you please describe your requirement.

      Delete
    2. Hi ,I need to create price slider using price control,can you help me how can i create this slider

      Delete
    3. How to add ajax function with multiple layered selection,please guide me

      Delete
  2. Worked a treat first time simple and easy to follow

    ReplyDelete
  3. Thanks! How do I get the name/label of the attribute to show instead of 'Choose an Option...'?
    For e.g. Show 'Choose Price', or 'Choose Color' etc depending on what filter it is?

    ReplyDelete
  4. this changes all the filters to drop downs though, what if we only wanted to make one of the filters a dropdown - such as manufacturer for example?

    ReplyDelete
  5. can any one tell how onle price value can be called in dropdownlist

    ReplyDelete
  6. thank you dude...works like a charm....can u plz suggest how we can use ajax to show results without refreshing the page??

    ReplyDelete
  7. Thanks for the tutorial. But I've recently found out that one of the extensions (improved layered navigation by amasty) I'm using lets create drop downs. Great!

    ReplyDelete
  8. I do agree with all the ideas you have presented in your post. They’re really convincing and will certainly work. Still, the posts are very short for newbies. Could you please extend them a little from next time?..Keep this great work
    magento development company in bangalore 

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here.
    Kindly keep blogging. If anyone wants to become a Front end developer learn from javascript and jquery training in chennai .
    or learn thru Javascript Training in Chennai.
    Nowadays JavaScript has tons of job opportunities on various vertical industry. javascript and jquery training in chennai

    ReplyDelete
  11. I appreciate your efforts because it conveys the message of what you are trying to say. It's a great skill to make even the person who doesn't know about the subject could able to understand the subject . Your blogs are understandable and also elaborately described. I hope to read more and more interesting articles from your blog. All the best.
    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training

    ReplyDelete
  12. Awesome! Education is the extreme motivation that open the new doors of data and material. So we always need to study around the things and the new part of educations with that we are not mindful.

    Android Training in Chennai

    Android Online Training in Chennai

    Android Training in Bangalore

    Android Training in Hyderabad

    Android Training in Coimbatore

    Android Training

    Android Online Training



    ReplyDelete
  13. When I initially commented, I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several emails with the same comment. Is there any way you can remove people from that service? Thanks.
    hardware and networking training in chennai

    hardware and networking training in tambaram

    xamarin training in chennai

    xamarin training in tambaram

    ios training in chennai

    ios training in tambaram

    iot training in chennai

    iot training in tambaram

    ReplyDelete
  14. I appreciate your efforts because it conveys the message of what you are trying to say. It's a great skill to make even the person who doesn't know about the subject could able to understand the subject
    web designing training in chennai

    web designing training in omr

    digital marketing training in chennai

    digital marketing training in omr

    rpa training in chennai

    rpa training in omr

    tally training in chennai

    tally training in omr

    ReplyDelete