I want to show the price range Like this
Up to Rs 10000
From 10000 to 25000
From 25000 to 50000
From 50000 to 100000
From 100000 to 300000
Above 300000
How to implement this?
You can refer to this to show price range for custom options for simple products
Add custom price range filter using block. Create a custom block file and then create one function for that fixed price range and call this "getPrice()" function in this file rwd\default\template\catalog\layer\view.phtml and it's working for me.
Block File :
class VendorName_ModuleName_Block_Sidebar extends Mage_Catalog_Block_Product_List {
public function getPrice(){
$currentUrl = Mage::registry('current_category')->getUrl();
//$currentUrl = Mage::helper('core/url')->getCurrentUrl();
$productCollection = $this->getLoadedProductCollection();
$productCollection->addAttributeToSort('price', 'desc')
->setPageSize(1)
->load();
$maxPrice = round($productCollection->getFirstItem()->getPrice(),2);
$minPrice = round($productCollection->getFirstItem()->getMinimalPrice(),2);
$priceFilterHtml = '';
if($maxPrice <= 500){
$priceFilterHtml .= "<ul>
<li><a href= ".$currentUrl."?price=1%2C500>0.00 - ".$maxPrice."</a></li>
</ul>";
}else{
$priceFilterHtml .= "<ul>
<li><a href=".$currentUrl."?price=1%2C10000>0.00 - 10,000</a></li>
<li><a href=".$currentUrl."?price=1.6666667%2C15000>10,000 - 25,000</a></li>
<li><a href=".$currentUrl."?price=2%2C25000>25,000 - 50,000</a></li>
<li><a href=".$currentUrl."?price=2%2C50000>50,000- 100,000</a></li>
<li><a href=".$currentUrl."?price=1.5%2C200000>100,000- 300,000</a></li>
<li><a href=".$currentUrl."?price=1.05%2C6000000>300,000 above</a></li>
</ul>";
}
return $priceFilterHtml;
}