php中分组产品的Magento输出(最低)价格


Magento output (lowest) price of grouped products in view.phtml

我尝试在文件view. php中输出分组产品的最低价格。最低价格应该插在顶部附近。现在我们用一个额外的属性显示它。但这只是一个变通办法。

我尝试了不同的代码,但没有一个工作:

<?php echo $this->getPriceHtml($_product, true) ?>

<?php $_finalPriceInclTax = $this->helper('tax')->getPrice($_item, $_item->getFinalPrice(), true) ?>

但似乎什么都不起作用。

也许你有一些想法如何显示价格,提前谢谢你!

基督教

获取子元素,并且应该返回groupedProduct的最低价格。我没有测试这个。

public function prepareGroupedProductPrice($groupedProduct)
{
$aProductIds =    $groupedProduct->getTypeInstance()->getChildrenIds($groupedProduct->getId());
$prices = array();
foreach ($aProductIds as $ids) {
    foreach ($ids as $id) {
        $aProduct = Mage::getModel('catalog/product')->load($id);
        $prices[] = $aProduct->getPriceModel()->getPrice($aProduct);
    }
}
krsort($prices);
$prices = array_shift($prices);
return $prices;
}