0

So I have attributes that I want customers to be able to use in Magento's layered navigation. The problem is I will have many Fabrics, Brands, Materials, etc. and I don't want it to show too many links. My theme includes a custom menu to replace the Category in layered navigation but not other attributes. How can I replace these links with a select menu? Or some other method that can condense all of the options?

I'm also open to an extension (hopefully a responsive one) that addresses this.

Here is an image of how it looks right now:

http://linenwoods.com/Capture.JPG

1 Answer 1

1

I just finished doing a bunch of modifications to the layered nav for a site with similar issues. There are two ways to go, and either will work. I'm not sure what template you might be using, so I am referring to the rwd theme with the file locations.

1. Changing to dropdowns manually. You would need to edit the app\design\frontend\rwd\default\template\catalog\layer\filter.phtml file. In that file you will find this:

    `<?php if ($_item->getCount() > 0): ?>
        <a href="<?php echo $this->urlEscape($_item->getUrl()) ?>">
            <?php echo $_item->getLabel() ?>
            <?php if ($this->shouldDisplayProductCount()): ?>
            <span class="count">(<?php echo $_item->getCount() ?>)</span>
            <?php endif; ?>
        </a>
    <?php else: ?>`

That code is within a loop, that is generating <li>s inside of an <ol>. Depending on your styling goals, you could use that part of the loop (for items with sub items) to make the header for the dropdown, then fill in the dropdown options. You could possibly make everything with more than 5 options into a select or something like that. That actually shouldn't be too painful, though again, depending on your styling goals it may get busy. Still, totally doable.

2. Use a layered nav extension. I just finished a project which used AheadWorks Layered Nav. While I try not to build sites by stacking up bought extensions, this layered nav was great to work with, and easily customizable. I don't think you would even need to do coding, as one can select the type of display on a per-attribute basis. Really easy to use, integrates well with 1.9.x, and will provide other benefits besides the easy availability of selects. They also use separate .phtml files for each filter display (checkbox, radio group, etc etc), which makes it easy to style or modify a particular filter.

So, the choice is yours. Either way will work, it just depends on how much customization you will need for the entire menu system, and whether or not you want to code all of that. AW layered nav will probably take care of most of the coding for you, but it is still easy to modify. Coding the stock Magento files yourself will give you a leaner result but may get time consuming if you will be needing to display filters with many different display types.

Good luck, I hope that's helpful!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.