VAT price wrong for grouped products

There is a serious bug in Magento for grouped products and it has been there for a couple years but Magento still has not issued a fixed. It was originally reported here

To fix the problem is actually relatively easy. Just loop through the products, get the minimal price of the associated products and display it at the right place.

$_product = $this->getProduct();

$aProductIds = $_product->getTypeInstance()->getChildrenIds($_product->getId());
$minprice = 99999999999999;
$_finalPriceIncTax = '';
$_finalPriceExclTax = '';
foreach ($aProductIds as $ids)
foreach ($ids as $id)
$aProduct = Mage::getModel('catalog/product')->load($id);
//get the smallest price for a product
if ($minprice > $aProduct->getPriceModel()->getPrice($aProduct))
$minprice = $aProduct->getPriceModel()->getPrice($aProduct);
$_finalPriceIncTax = $_taxHelper->getPrice($aProduct, $aProduct->getFinalPrice(), true);
$_finalPriceExclTax = $_taxHelper->getPrice($aProduct, $aProduct->getFinalPrice(), false);

and then display the prices:

From currency($_finalPriceIncTax, true, false);

(ex VAT currency( $_finalPriceExclTax, true, false);

This entry was posted in Magento. Bookmark the permalink.