【问题标题】:show price of first associated product in place of regular price in product listing for configurable product on category page在类别页面上的可配置产品的产品列表中显示第一个相关产品的价格以代替常规价格
【发布时间】:2016-03-04 06:01:32
【问题描述】:

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

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

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

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

【问题讨论】:

    标签: php magento magento-1.8


    【解决方案1】:

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

    <?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
                        }           
        }
    ?>
    

    希望对您有所帮助!

    【讨论】:

    • 非常感谢您的回答!它对我来说几乎没有修改。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-29
    • 1970-01-01
    相关资源
    最近更新 更多