title: Magento: Product dynamic price change on add to cart
body: <p>I'd like have a product that is basically a calculator, which I will build in Javascript.  I want the add to cart process to grab the generated price from the page and submit it to the cart - which is as far as I have got.  </p>
  
  <p>I've created an observer to hook into the checkout_cart_product_add_after event and update the quote item price based on a field value in the submitted form, which works.</p>
  
  <p>The problem I have is that, if you add a second or multiple versions of the item with different prices, it updates all the other versions in the cart to the same price - so you can never have multiples of the same item in the cart with different prices. </p>
  
  <p>Anyone have any ideas?  Here's the code in my observer:</p>
  
  <pre><code>public function modifyPrice(Varien_Event_Observer $observer) {
      $customprice = $_POST["customprice"];       
      $item = $observer-&gt;getQuoteItem();
      $item = ( $item-&gt;getParentItem() ? $item-&gt;getParentItem() : $item );
      if ($customprice &gt; 0) {
          $item-&gt;setCustomPrice($customprice);
          $item-&gt;setOriginalCustomPrice($customprice);
          $item-&gt;getProduct()-&gt;setIsSuperMode(true);
      }
  }
  </code></pre>