Magento - Layered navigation on product pages by MageWorld

 

Magento - Layered navigation on product pages

Published at 2010-07-20 02:47:07
To attract more potential customers to your online store, you must create an ease for them when browsing products they need. In Magento, Layered Navigation is a useful feature that allows customers to find item according to two default properties: Price and Categories.
 

However, as you know, Layered Navigation basically can work only on category page. Now, I will share you how to make it work on product pages, too.
Just follow these steps:

Step 1:
In folder \app\design\frontend\default\your theme\template\catalog\layer, create 1 layeredview.phtml file

Step 2:
Copy the following code into layeredview.phtml file:
<?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; ?>

Step 3 :
Go to app\design\frontend\default\your theme\layout\catalog.xml
And find this line of code:
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
Then put right under it the following code:
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/ layeredview.phtml "/>
If Layered Navigation is on the right side, then you write <reference name="right">

If you have any further problem please email us at: support@mage-world.com

 
 
 
 
 
© 2009 Mage-World.com. All Rights Reserved.

Powered by Magento ver 1.5.1.0. Designed by Mage-World.com .