1

I'm trying to determine if a child products configurable parent has a price rule applied.

I can get the correct price on the parent product by loading the parent, and then calling getFinalPrice(), but the challenge is that on configurable products that do not have a rule applied, getFinalPrice() on the parent returns the lowest price of it's child components:

$product = Mage::getModel('catalog/product')->load($child_id);
$child_price = $product->getFinalPrice(); // Full price of child

$parent_product_ids = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($child_id);
$parent_id = $parent_product_ids[0]; // presume 1 parent config product
$parent_product = Mage::getModel('catalog/product')->load($parent_id);
$parent_product_price = $parent_product->getFinalPrice(); // Price with catalog rule applied

I want to display the price with the rule applied to the child product (which is what you see in the cart after adding the child product from the product page.

Any tips appreciated.

1

You could try using the function calcProductPriceRule this will return the price including price rule calculations.

Mage::getModel('catalogrule/rule')->calcProductPriceRule($parent_product, $parent_product->getFinalPrice())

Looking into that function it seems to take into account if the product has a parent so maybe you could try it with the child product and price.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.