I want to calculate price based on the customer selected options.
For example,there are two configurable attributes length,width
Before adding product to cart,I want to modify price based on selected length & width
$finalPrice=$rrp+($length*$width)
Is there any event available to achieve this?
I would look at catalog_product_get_final_price, and for an example usage, see Mage_CatalogRule_Model_Observer::processFrontFinalPrice(). Note that options-based pricing is processed after this event; see Mage_Catalog_Model_Product_Type_Price::getFinalPrice() and Mage_Catalog_Model_Product_Type_Configurable_Price::getFinalPrice().
Please keep in mind that customizing this functionality requires lots of testing with different quote states, customer states, product types, etc. For example, consider a product which is added to the cart for the first time, then having its quantity updated from the cart. Often it is necessary to implement logic in a couple of methods/observers to handle all permutations.
Full list for events fired in CE1.7 when customer not logged in, new cart, simple product:
controller_front_init_routers
Mage_Cms_Controller_Router::initControllerRouters()controller_action_predispatch
Mage_Log_Model_Visitor::initByRequest()Mage_PageCache_Model_Observer::processPreDispatch()Mage_Persistent_Model_Observer::emulateQuote()Mage_Persistent_Model_Observer_Session::renewCookie()Mage_Persistent_Model_Observer::checkExpirePersistentQuote()Mage_Persistent_Model_Observer::emulateCustomer()catalog_product_load_after
Mage_CatalogInventory_Model_Observer::addInventoryData()custom_quote_process
Mage_Persistent_Model_Observer::setLoadPersistentQuote()sales_quote_config_get_product_attributes
Mage_SalesRule_Model_Observer::addProductAttributes()prepare_catalog_product_collection_prices
Mage_CatalogRule_Model_Observer::prepareCatalogProductCollectionPrices()sales_quote_item_collection_products_after_load
Mage_CatalogInventory_Model_Observer::addInventoryDataToCollection()sales_quote_item_qty_set_after
Mage_CatalogInventory_Model_Observer::checkQuoteItemQty()sales_quote_collect_totals_before
Mage_Tax_Model_Observer::quoteCollectTotalsBefore()sales_quote_address_collect_totals_before
Mage_Sales_Model_Observer::changeQuoteCustomerGroupId()sales_quote_address_collect_totals_after
Mage_Sales_Model_Observer::restoreQuoteCustomerGroupId()sales_quote_address_collect_totals_before
Mage_Sales_Model_Observer::changeQuoteCustomerGroupId()catalog_product_get_final_price
Mage_CatalogRule_Model_Observer::processFrontFinalPrice()sales_quote_address_collect_totals_after
Mage_Sales_Model_Observer::restoreQuoteCustomerGroupId()sales_quote_collect_totals_after
Mage_Sales_Model_Observer::setQuoteCanApplyMsrp()sales_quote_save_before
Mage_Persistent_Model_Observer::setQuotePersistentData()sales_quote_save_after
Mage_Checkout_Model_Observer::salesQuoteSaveAfter()Mage_Log_Model_Visitor::bindQuoteCreate()sales_quote_item_save_before
Mage_Reports_Model_Event_Observer::checkoutCartAddProduct()checkout_cart_add_product_complete
Mage_Wishlist_Model_Observer::processAddToCart()controller_action_postdispatch
Mage_Log_Model_Visitor::saveByRequest()controller_front_send_response_after
Mage_Persistent_Model_Observer_Session::synchronizePersistentInfo()If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With