我有几个属于多个类别的产品。 我需要的是像这样的分层导航 我有这种类别树:
CAT A品牌,CAT B是产品类型。
在我去Cat b1的目录中,我想添加一个过滤器,以便显示产品的所有品牌。所以过滤器为Cat a1和Cat a2,如果我过滤Cat a1,它只会显示Cat b1中属于Cat a1的产品。
我的意思是两个类别的交集,并且它将总是像分层导航一样显示。 每次我输入一个类别时,它必须显示其中的产品也属于的类别。
设计/前端///目录/层/ view.phtml
<?php if($this->canShowBlock()): ?>
<div class="block block-layered-nav">
<div class="block-title">
<strong><span><?php echo $this->__('Shop By') ?></span></strong>
</div>
<div class="block-content">
<?php echo $this->getStateHtml() ?>
<?php if($this->canShowOptions()): ?>
<dl id="narrow-by-list">
<?php $_filters = $this->getFilters() ?>
<?php $counter=1; foreach ($_filters as $_filter): ?>
<?php if($_filter->getItemsCount()): ?>
<span>
<dt id="filter_heading"><?php echo $this->__($_filter->getName()) ?><span class="toggleBtn highlight" id="toggleBtn<?php echo $counter; ?>"></span></dt>
<dd id="filter_content<?php echo $counter; ?>" style="display:block;"><?php echo $_filter->getHtml() ?></dd>
<script type="text/javascript">
jQuery('#toggleBtn<?php echo $counter; ?>').click(function() {
jQuery('#filter_content<?php echo $counter; ?>').slideToggle('slow');
jQuery(this).toggleClass("highlight");
});
</script>
</span>
<?php endif; $counter++; ?>
<?php endforeach; ?>
</dl>
<script type="text/javascript">decorateDataList('narrow-by-list')</script>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
主题catalog.xml
<catalog_category_layered translate="label">
<label>Catalog Category (Anchor)</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" after="catalog.magicat" template="catalog/layer/view.phtml"/>
</reference>
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<!-- <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> -->
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
<!-- The following code shows how to set your own pager increments -->
<!--
<action method="setDefaultListPerPage"><limit>10</limit></action>
<action method="setDefaultGridPerPage"><limit>8</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>10</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>20</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>30</limit></action>
<action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
<action method="addPagerLimit"><mode>grid</mode><limit>8</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>16</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>24</limit></action>
<action method="addPagerLimit" translate="label"><mode>grid</mode><limit>all</limit><label>All</label></action>
-->
</block>
<!--action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action-->
<action method="setColumnCount"><count>3</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</block>
</reference>
</catalog_category_layered>
任何帮助表示赞赏。