开发者

Get the tier prices of an associated product in Magento

开发者 https://www.devze.com 2023-03-27 13:59 出处:网络
I\'m using Magento 1.4.1.1 How can I get the tier prices of the associated product? I\'m only getting the price of the configurable product. I\'ll site ang example:开发者_运维百科

I'm using Magento 1.4.1.1

How can I get the tier prices of the associated product?

I'm only getting the price of the configurable product. I'll site ang example:

开发者_运维百科

Example: 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.

My question here, is how can I get the value of my Associated products.

Thanks and Have a good Day!


Try getting the associated products collection and iterating through them, like so:

        // this just checks to ensure it's a configurable product;
        // if you know the product is configurable already, you don't need
        // this step
        if ($product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE){

            $associated_products = $product->getTypeInstance()->getUsedProductCollection($product);

            foreach ($associated_products as $associated_product){

            //print_r( $associated_product->getTierPrice() );

            }

        }

Edit: just a quick note. This code assumes Magento 1.6. I don't remember if 1.4 had the TYPE_CONFIGURABLE class constant, but I believe it did. If not, this code may require adjustments for older versions of Magento.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号