cancel
Showing results for 
Search instead for 
Did you mean: 

Highest product price in filtered category

Highest product price in filtered category

I use this code for getting the highest price for my price slider:

 

            $maxPrice=Mage::getSingleton('catalog/layer')
                ->setCurrentCategory(Mage::registry('current_category'))
                ->getProductCollection()
                ->getMaxPrice();



And i get the highest price from the category, for example from products

    Pen ---------- Black ---------5$
    Pen ---------- Blue ----------12$
    Pen ---------- Blue ----------2.5$
    Pen ---------- Red -----------3.5$
    Pen ---------- Red -----------6$
    Pen ---------- Red -----------9$
    Pen ---------- Black ---------11$
    Pencil ------- Red -----------16$
    Pencil ------- Black ---------1.3$



If i, from the frontend UI, try to filter for first for Pens -> my maxPrice is 12$. Next when i filter for Red ones -> my maxPrice is 9$. And finally when i set price range to from 1$-7$ my maxPrice is 6$.

How can i get 9$ again as the max price in filtered products to let my buyers use slider to slide up to 9$ back after they selected the price.

I able to get the highest price in Pen-s category, but from Red ones i cant?

There is a solution for this?

Tags (2)