Price update in Add to cart functionality from product detail page to cart page
Question
Can anyone tell me in magento, when we click Add to Cart button in product detail page, where and how is Product Price and Qty input multiplied and updated in shopping cart page Subtotal column. I want to customize the action for my custom pricing module.
Solution
The subtotal logic on the cart page is implemented in the below template file.
app/design/frontend/rwd/default/template/checkout/cart/item/default.phtml
Override this file into your local and modify it as per your requirement.
OTHER TIPS
Guess that
You want to change cart item unit price.I
So in this case,you can use magento event/observer
.
Basically there are two events,by which you can change the cart price of that products:
checkout_cart_product_add_after
checkout_cart_update_items_after
checkout_cart_product_update_after
This 3 event is need because of:
Event1:checkout_cart_product_add_after
This event is fire when first time a product is cart for current session
of current input values from frontend
Event2:checkout_cart_product_update_after
This event is fire when a current exiting cart item
edited from edit link of cart item.
Event3:checkout_cart_update_items_after
This event is fire whenever cart items update from cart page.
As per as magento system, a cart item price
change using setter
functions setCustomPrice(), setOriginalCustomPrice
of cart item Object.
Just like:
$EachCartitem->setCustomPrice($price);
$EachCartitem->setOriginalCustomPrice($price);
// Enable super mode on the product.
$EachCartitem->getProduct()->setIsSuperMode(true);
If you can cart each unit price then automatically change subtotal
An example: Custom options operations