My Magento version -> 1.6.2
I am using an external php file that receives the $product_id
and $my_price
parameter via jQuery post.
var priceNewValue = XX; // My custom price value
var product_id = optionsPrice.productId; // Product id
jQuery.post("http://flyingcakes.in/eshop/ajaxPriceCal.php", { price: priceNewValue, pid: product_id });
On my "ajaxPriceCal.php" page, I catch the values:
$product_id = $_POST['pid'];
$my_price = $_POST['price'];
Now I want Magento to set the price of this product ($product_id
) equal to $my_price
.
So that:
- This changed price is reflected when product is added to the cart.
- The price of the product is changed only temporarily i.e. not saved to the database.
How should I do this?