When I have one, more or all child products of a grouped product with currently active special prices I'd like to see a 'sale' note in my frontend.

For simple products I do this in my template by

if ($_product->getFinalPrice() != $_product->getPrice()) { ... }

However a grouped product has no own price and I kind of fail trying to iterate over its child product in the template (I encountered errors, getPrice() didn't work on the child products as it seemed they weren't fully loaded or it took enormously long to load)...

So what would be a working and efficient way to do it (ideally starting only from the ID of the grouped product in the template)?

1 Answer 1


You don't want to iterate over all simple products in the template. It costs a lot of time and kills performance.

Instead either add an index table or add an attribute to your grouped products which marks sale. Then you can just check for it in the template $product->getIsForSale() or whatever the name of your attribute is.

You can update this attribute either by cron which runs every night (or every hour) or hook into catalog_product_save_after, but I recommend a cron. I don't think this is something which needs to be up to date all the time. But this is a business question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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