Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(".single-product").ready(function(){
- var qtity = 1;
- var disc = 0;
- var extPrice = <?php echo $tot_price; ?>;
- var getPid = '<?php echo $pid; ?>';
- var qmp = extPrice * qtity;
- var cp = qmp * disc/100;
- var tot_amt = qmp - cp;
- arrayOfProducts.push(getPid+"/"+qtity+"/"+tot_amt);
- var productsBought = arrayOfProducts;
- $(".quantity").on("change", function(){
- var qtity = $(this).val();
- var getPid = $(this).attr("id");
- extPrice = $(this).parents(".single-product-details").text().replace(/[^0-9.]/g, ' ').replace(/s+/g,' ').trim().split(" ").pop();
- var tot_amt = extPrice * qtity;
- $(this).parents("tr").find(".discount").val("0");
- var newArrayOfProducts = arrayOfProducts.filter(function(str) {
- return !str.startsWith(getPid);
- });
- /*newArrayOfProducts.push(getPid+"/"+qtity+"/"+tot_amt);*/
- var productsBought = newArrayOfProducts;
- console.log(qtity+" "+getPid+" "+tot_amt+" "+newArrayOfProducts);
- $.post("ajax-req-handler.php",
- {
- key: "cart-total-price",
- key2: "Array-of-products",
- extractedPrice: tot_amt,
- productsInCart: productsBought
- },
- function( data ){
- $('.prices-col').find("."+getPid).html("₹ "+data+" /-<br/>");
- });
- });
Add Comment
Please, Sign In to add comment