Guest User

Untitled

a guest
Nov 20th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. $(".single-product").ready(function(){
  2. var qtity = 1;
  3. var disc = 0;
  4. var extPrice = <?php echo $tot_price; ?>;
  5. var getPid = '<?php echo $pid; ?>';
  6. var qmp = extPrice * qtity;
  7. var cp = qmp * disc/100;
  8. var tot_amt = qmp - cp;
  9. arrayOfProducts.push(getPid+"/"+qtity+"/"+tot_amt);
  10. var productsBought = arrayOfProducts;
  11. $(".quantity").on("change", function(){
  12. var qtity = $(this).val();
  13. var getPid = $(this).attr("id");
  14. extPrice = $(this).parents(".single-product-details").text().replace(/[^0-9.]/g, ' ').replace(/s+/g,' ').trim().split(" ").pop();
  15. var tot_amt = extPrice * qtity;
  16. $(this).parents("tr").find(".discount").val("0");
  17. var newArrayOfProducts = arrayOfProducts.filter(function(str) {
  18. return !str.startsWith(getPid);
  19. });
  20. /*newArrayOfProducts.push(getPid+"/"+qtity+"/"+tot_amt);*/
  21. var productsBought = newArrayOfProducts;
  22. console.log(qtity+" "+getPid+" "+tot_amt+" "+newArrayOfProducts);
  23. $.post("ajax-req-handler.php",
  24. {
  25. key: "cart-total-price",
  26. key2: "Array-of-products",
  27. extractedPrice: tot_amt,
  28. productsInCart: productsBought
  29. },
  30. function( data ){
  31. $('.prices-col').find("."+getPid).html("&#8377; "+data+" /-<br/>");
  32. });
  33. });
Add Comment
Please, Sign In to add comment