首页 文章

获取Magento 1.8.0中相关产品的等级价格

提问于
浏览
0

我正在使用Magento 1.8.0

如何获得相关产品的等级价格?

我只得到可配置产品的价格 . 以下是我的网站示例:

示例: Product Apple is a configurable product thas has tier prices, $10,$20,$30. Product Apple has also an associated product like Green Apple, it has tier prices, $15,$20,$30 .

我的问题是,如何才能获得我的Associated产品的 Value .

谢谢,祝你有个美好的一天!

1 回答

  • 0

    您必须首先获得相关产品

    $product = Mage::getModel('catalog/product')->load(1); //your_product_id
    $childProducts = Mage::getModel('catalog/product_type_configurable')
                        ->getUsedProducts(null,$product);   
    foreach($childProducts as $child) {
        $id = $child->getId();
        $pro = Mage::getModel('catalog/product')->load($id); //load associated product id
        if($pro['tier_price'] != NULL) {
            foreach($pro['tier_price'] as $tier){
                echo $tier['price'].'
    '; } } }

相关问题