在类别页面上的可配置产品的产品列表中显示第一个关联产品的价格,而不是常规价格


show price of first associated product in place of regular price in product listing for configurable product on category page

我想在Magento中配置一个产品。在可配置产品中,如果我们不设置常规价格,则默认显示 0.00 价格。

我已经在可配置产品详细信息页面上进行了设置,以便在页面加载时从下拉列表中自动选择第一个关联的产品。

在产品列表中,可配置产品的常规价格仍显示为 0.00。

但是,如果第一个关联产品的价格是洋红色类别页面上的可配置产品,如何在产品列表中自动显示第一个关联产品的价格而不是常规价格?

您是否尝试过从可配置产品中获取简单产品的价格并在类别页面上打印。?如果没有尝试,请尝试以下代码。

<?php
    if($_product->getTypeId()=='configurable'){
    $childProducts = Mage::getModel('catalog/product_type_configurable')
                    ->getUsedProducts(null,$_product);
                    foreach($childProducts as $child){
                        echo $child->getFinalPrice();
                        break;  //it will stop you to print other prices
                    }           
    }
?>

希望对您有所帮助!