Magento – getFinalPrice() on associated simple product returns base price not parent product special price

administrationconfigurable-productpriceproductprogramming

I have 2 products one is configurable and has a special price of 100 and the associated product has no special price assigned and Final Price is not being returned on the associated product.

I am programmatically loading these…

How do I get the typical "cart" behavior that would assign the associated product the final price value of 100?

$configurable_product = Mage::getModel('catalog/product')->load(1);

$configurable_product->getFinalPrice(); // returns 100

$associated_product = Mage::getModel('catalog/product')->load(2);

$associated_product->getFinalPrice(); // returns 200

Best Answer

I actually figured this out by looking at the source and you can pass an associated child product into getFinalPrice:

$qty = 1
$configurable_product->getFinalPrice( $qty, $associated_product );
Related Topic