Magento - 在顶部导航中获取类别的可用过滤器

时间:2012-03-19 17:52:02

标签: php magento

我正在使用Magento 1.6.2进行开发。

我想在顶部导航栏中显示我的类别中的下拉列表(颜色,大小等)。

到目前为止(在/app/design/fontend/package/theme/template/catalog/navigation/top.phtml)我有:

<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-&gt; getFilters()没有返回任何内容。 如何在类别的内容中获取过滤器?

1 个答案:

答案 0 :(得分:1)

catalog/navigation/top.phtml使用Mage_Catalog_Block_Navigation并且它没有实现方法getFilter(),除非您添加了这样的...此块负责显示顶部导航菜单/

我认为您正在寻找在类别视图工具栏中使用的Layered Navigation并负责类别过滤器。