Magento: Product dynamic price change on add to cart -
i'd have product calculator, build in javascript. want add cart process grab generated price page , submit cart - far have got.
i've created observer hook checkout_cart_product_add_after event , update quote item price based on field value in submitted form, works.
the problem have that, if add second or multiple versions of item different prices, updates other versions in cart same price - can never have multiples of same item in cart different prices.
anyone have ideas? here's code in observer:
public function modifyprice(varien_event_observer $observer) { $customprice = $_post["customprice"]; $item = $observer->getquoteitem(); $item = ( $item->getparentitem() ? $item->getparentitem() : $item ); if ($customprice > 0) { $item->setcustomprice($customprice); $item->setoriginalcustomprice($customprice); $item->getproduct()->setissupermode(true); } }
i think way working dynamically create new product new price or try work attributes replaces price, whereas have code logic shopping cart in checkout.
Comments
Post a Comment