I was successfully able to change the value of the "price" class on this page using this jQuery script:
jQuery("#options_46_2").click(function(){
var priceOldValue = parseInt(jQuery('.product-options-bottom .price-box .price').text().replace(/[^0-9.]/g, ""));
if (this.checked) {
var selectedWeight = jQuery("#select_32 option:selected").text();
selectedWeight = parseFloat(selectedWeight);
var priceNewValue = priceOldValue + 50 * selectedWeight;
jQuery(".product-options-bottom .price-box .price").html("Rs" + priceNewValue + ".00");
}
else {
jQuery(".product-options-bottom .price-box .price").html("Rs" + priceOldValue + ".00");
}
});
Now, I want this changed value to be the actual value of the product's price when a user clicks on "Add to cart" button. How should I do it?
Also, is there any more elegant way to do this, for other products?
[EDIT]
then you can achieve this using observer create one module and add event sales_quote_add_item
this event fire after product add to cart
and in your observer you can get product price and check option is selected or not if option is selected then you can set quote price using
$quote_item->setOriginalCustomPrice($Custom price)