Layered navigation filters are created in
app/design/frontend/base/theme/template/catalog/layer/filter.phtml
How can I retrieve the value of the highest product price in the current product collection from within this file?
I've tried what I thought was the obvious choice $this->getMaxPriceInt() from Mage_Catalog_Model_Layer_Filter_Price but that does not seem to work within filter.phtml.
Assuming $collection is a collection of 'catalog/product', this should do the trick:
$product = $collection->setOrder('price', 'DESC')->getFirstItem();
Get highest and lowest price in category listing you can use below code.
$min_price = Mage::getSingleton('catalog/layer')->setCurrentCategory(Mage::registry('current_category'))->getProductCollection()->getMinPrice();
$max_price = Mage::getSingleton('catalog/layer')->setCurrentCategory(Mage::registry('current_category'))->getProductCollection()->getMaxPrice();
But it is not working for search and advance search layer navigation.so you can use below code for all pages layer navigation.
$min_price = $this->getLayer()->getProductCollection()->getMinPrice();
$max_price = $this->getLayer()->getProductCollection()->getMaxPrice();
You can use below code on app/design/frontend/THEME/default/template/catalog/layer/view.phtml file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With