Magento Layered navigation on Item Detail Page(Product Page)
Step 1:
create layeredview.phtml file
In folder path given below.
[php]
\app\design\frontend\default\your theme\template\catalog\layer
[/php]
Step 2:
Copy the following code into layeredview.phtml:
[php]
<?php if($this->canShowBlock()): ?>
<div class="block block-layered-nav">
<div class="block-content">
<?php echo $this->getStateHtml() ?>
<?php if($this->canShowOptions()): ?>
<dl id="narrow-by-list">
<?php $_filters = $this->getFilters() ?>
<?php foreach ($_filters as $_filter): ?>
<?php if($_filter->getItemsCount()): ?>
<dt><?php echo $this->__(‘Shop by ‘) ?><?php echo $this->__($_filter-
>getName()) ?></dt>
<?php $url= $this->helper(‘core/url’)-
>getCurrentUrl();?>
<?php
//$re_url=$_category;
//temporary hard coded
$re_url=’/bbbcshop/index.php/products.html’;
?>
<dd>
<?php echo
str_replace(array($url.’?’,$url.’/?’),array($re_url.’?’,’/’.$re_url.’?’),$_filter->getHtml()) ?>
</dd>
<?php endif; ?>
<?php endforeach; ?>
</dl>
<script type="text/javascript">decorateDataList(‘narrow-by-list’)</script>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
[/php]
Step 3 :
Go to
[php]
app\design\frontend\default\your theme\layout\catalog.xml
[/php]
And find this line of code:
[xml]
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
[/xml]
Then put right under it the following code:
[xml]
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/ layeredview.phtml "/>[/xml]
I have followed this step by step and I still have no navigation. Any assistance you can give me is greatly appreciated.
find the code below in your catalog.xml
[xml]
<catalog_product_view translate="label">
<label>Catalog Product View (Any)</label>
<!– Mage_Catalog –>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
[/xml]
under this code paste the code given below
[xml]
<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/layeredview.phtml "/>
</reference>
[/xml]
refresh your cache in var folder.
Better solution for Step 2:
helper('core/url')->getCurrentUrl();
$category_url = strrchr($url, '/');
$category_url = str_replace($category_url, '', $url);
$filter_url = strrchr($url, '.html?');
$new_url = $category_url.$filter_url;
?>
canShowBlock()): ?>
getStateHtml() ?>
canShowOptions()): ?>
__('Maak uw keuze:') ?>
getFilters() ?>
getItemsCount()): ?>
__($_filter->getName()) ?>
getHtml()) ?>
decorateDataList('narrow-by-list')