0

I need to do some customization to the configurable products behavior in particular to the way Magento calculate the price on the base of the attribute selection.

How is Magento calculating the final price ?
- I know how it works on the product page (js) but the cart/server side behavior is different.

I need to understand where the calculation is processed (method/class) so I can change this behavior.

Bounty target

I would consider proper answers, only the ones that cover at least one of the following 2 points:

  • class/method related to the question with explanations
  • example of customization of price calculation behaviour

1 Answer 1

1

Found out the solution:

  • The price is for cart is calculated by 'Mage_Sales_Model_Quote_Address_Total_Subtotal' ... $product->getFinalPrice(...)

  • Final price is calculated using the <price_model> model for that precise product type ( assigned in config.xml )

  • For configurable products the price model is Mage_Catalog_Model_Product_Type_Configurable_Price

  • getTotalConfigurableItemsPrice() method extracts additional price from the attributes values and adds it to product price

So in case you want to have a special price calculation for your product you have to override these method.

In my case I have created a new product type so make sense to create a new model for the price calculation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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