I've been working on having a two sets of layered navigation to make it easier to navigate my website. I have successfully added categories and manufacturers as a tab in the center. When I enabled price (or any other attribute) to be used in the left hand layered navigation, it became visible in the center. (See picture bellow)
The code for the center navigation:
<?php if($this->canShowBlock()): ?>
<div class="block-content">
<?php if($this->canShowOptions()): ?>
<?php $_filters = $this->getFilters() ?>
<ul id="tabs">
<?php $counterOne =0; ?>
<?php $counterTwo =0; ?>
<?php foreach ($_filters as $_filter): ?>
<?php $counterOne++; ?>
<?php if($_filter->getItemsCount()): ?>
<li><a href="#" title="tab<?php echo $counterOne; ?>"><?php echo $this->__($_filter->getName()) ?></a></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div id="content">
<?php foreach ($_filters as $_filter): ?>
<?php $counterTwo++; ?>
<?php if($_filter->getItemsCount()): ?>
<div id="tab<?php echo $counterTwo; ?>"><?php echo $_filter->getHtml() ?></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
<script type="text/javascript">decorateDataList('narrow-by-list')</script>
<?php endif; ?>
</div>
How can I implement a filter in the above so that only the Category and Manufacturer will appear in the center layered navigation?
EDIT:
When I add:
<?php if($_filter->getName() == 'Category' || $_filter->getName() == 'Manufacturer' ): ?>
Directly bellow the first
<?php foreach ($_filters as $_filter): ?>
It works, however when I click on the Manufacturer under the manufacturer tab I receive a
You cannot define a correlation name 'manufacturer_idx' more than once
Any thoughts?
EDIT
What I am looking to achieve is to have Category and Manufacturer in the center while all other filterable attributes appear on the left. Is this possible?
Best Answer
You will only be able to do this hardcoded.
So filtering out the manufacturer and category on the left side and creating a custom PHTML file that generates links/dropdowns for the manufacturer and category in the center.
so in
app/design/frontend/[template]/[package]/template/catalog/layer/view.phtml
around line 49 editWould eliminate
manufacturer
andcategories
from the list. Optionally try to usegetCode
, I think that would return theattribute_code
instead of the name.For your center layered navigation create a new PHTML file and add it to the layout
and in the file
catalog/layer/center.phtml
something like thiswhen a user selects a manufacturer it should add manufacturer to the layered navigation URL.
Manufacturer
does have to be a filterable attribute tho.This is highly untested code so may need a tweak or two but it's basically what you need. And I'm in no way pretending this is best practice but as far as I know it's the only way to do it.