mononym
mononym

Reputation: 2636

Magento - getting the available filters for a category in top navigation

I am developing with Magento 1.6.2.

I want to display a drop down containg filters (colour, size etc) from my categories in my top navigation bar.

So far (in /app/design/fontend/package/theme/template/catalog/navigation/top.phtml) I have:

<ul>    
<?php foreach ($this->getStoreCategories() as $_category): ?>
<li><a href="<?php echo $this->getCategoryUrl($_category); ?>" title="<?php echo $this->htmlEscape($_category->getName()); ?>"><?php echo $this->htmlEscape($_category->getName()); ?></a>
    <?php $_filters = $this->getFilters() ?>
    <div>
            <?php foreach ($_filters as $_filter): ?>
            <dl>
            <?php if($_filter->getItemsCount()): ?>
                <dt><?php echo $this->__($_filter->getName()) ?></dt>
                <dd><?php echo $_filter->getHtml() ?></dd>
            <?php endif; ?>
            </dl>
            <?php endforeach; ?>        
    </div>          
</li>
<?php endforeach ?> 
</ul>

$this->getFilters() is not returning anything. How can I get the filters in the content of the category?

Upvotes: 1

Views: 3439

Answers (1)

xyz
xyz

Reputation: 2282

catalog/navigation/top.phtml uses Mage_Catalog_Block_Navigation and it doesn't implement method getFilter() unless you've added such... This block is responsible for displaying Top Navigation Menu/

I think that you're looking for Layered Navigation which is used in Category View Toolbar and is responsible for category filters.

Upvotes: 1

Related Questions