I have severall products that belong to multiple categories. What i need is some kind of layered navigation like this I have this kind of category tree:
- CAT A
- *Cat a1
- *Cat a2
- CAT B
- *Cat b1
- *Cat b2
CAT A its Brands, and CAT B is type of product.
In catalog when i go to Cat b1, i want to add a filter so it shows all the brands of the products. So the filter as Cat a1 and Cat a2, and if i filter Cat a1 it will only show products from Cat b1 that belong to Cat a1.
What i mean, is a intersection of both categories, and it will allways display like in layered navigation. Every time i enter a category, it must display the categories that the products inside of it also belongs to.
design/frontend///catalog/layer/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; ?>
Theme 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>
Any help appreciatted.