I have a situation where i have a slider and need to be able to filter the loaded products by min and max price. But the only products in use are group products that don't have direct prices.

Any suggestions on filtering Group Products by price.

Using the minPrice and maxPrice price generation functions.


My solutions was to run a loop over the category and do a price comparison

  public function priceIds($min, $max, $catid)
        $products = Mage::getModel('catalog/category')->load($catid)

        $ids = array();

        foreach ($products as $product) {
            if($product->getTypeId() == 'simple') {

                $price = $product->getPrice();
                echo $price;
                if($price >= $min  && $price <= $max)
                    $ids[] = $price->getId();
            }elseif($product->getTypeId() == 'grouped')
                $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);

                foreach($associatedProducts as $aproduct)
                    //echo $aproduct->getPrice();
                    //echo $aproduct->getId();
                    if($aproduct->getPrice() >= $min  &&  $aproduct->getPrice() <= $max )

                        $ids[] = $product->getId();

        return $ids;


And in the filter check if the product entity_id is in the reutrned id array.


you can use bellow code to filter collection.


I hope this will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.