Magento – show empty grouped products

Magento doesn’t show in the catalog view empty grouped products. In other words, Grouped products with no associated products. This is because a grouped product doesn’t have price. And it takes the max and min price for the catalog view from its simple products.

I’m showing on this post a way to show empty grouped products by removing the price index from the catalog query.

The objective

By default Magento performs a query as follow:

SELECT (...) FROM `catalog_product_flat_1` AS `e`
INNER JOIN `catalog_category_product_index` AS `cat_index` ON (...)
INNER JOIN `catalog_product_index_price` AS `price_index` ON (...)
WHERE (...)

Therefore, the items without entries on the catalog_product_index_price won’t appear.

But if we change that query and avoid the price indexes:

SELECT (..) FROM `catalog_product_flat_1` AS `e`
INNER JOIN `catalog_category_product_index` AS `cat_index` ON (...)
WHERE (...)

We can have empty grouped products on our catalog views.

The code

To perform that, we need to rewrite the method of the class Mage_Catalog_Model_Resource_Product_Collection that adds that INNER JOIN to our catalog collection.

The method we need to rewrite is addPriceData, we need to change

$this->_productLimitationFilters['use_price_index'] = true;


$this->_productLimitationFilters['use_price_index'] = false;

Remember to rewrite the Model correctly and do not edit the core class.

class JokiRuiz_Catalog_Model_Resource_Product_Collection
    extends Mage_Catalog_Model_Resource_Product_Collection
    public function addPriceData($customerGroupId = null, 
        $websiteId = null)
        $this->_productLimitationFilters['use_price_index'] = 
0 0 votes
Article Rating
Notify of
1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
6 years ago

great solution!

But there’s a bug… or i got one! 😉
When you are in a category page, and sort by price the products, something goes wrong.
Also if you add “price” to the layered navigation the page shit off.

Any ideas?

Would love your thoughts, please comment.x