Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. function update_prices_product_slider_m_f(product_id, minimumvalue) {
  2. input_val = $('#slider_m_f .product_'+product_id+' .plus-minus').val();
  3. if (input_val > minimumvalue) {
  4. input_val = minimumvalue;
  5. $('#slider_m_f .product_'+product_id+' .plus-minus').val(minimumvalue);
  6. }
  7. <?php if ($recalc_price) { ?>
  8.  
  9. quantity = parseInt(input_val);
  10. <?php } else { ?>
  11. quantity = 1;
  12. <?php } ?>
  13. data = $('#slider_m_f .product_'+product_id+' .options input[type=\'text\'], #slider_m_f .product_'+product_id+' .options input[type=\'hidden\'], #slider_m_f .product_'+product_id+' .options input[type=\'radio\']:checked, #slider_m_f .product_'+product_id+' .options input[type=\'checkbox\']:checked, #slider_m_f .product_'+product_id+' .options select');
  14. $.ajax({
  15. type: 'post',
  16. url: 'index.php?route=product/product/update_prices',
  17. data: data.serialize() + '&product_id=' + product_id + '&quantity=' + quantity,
  18. dataType: 'json',
  19. success: function(json) {
  20.  
  21. <?php if ($img_slider) { ?>
  22. $('#slider_m_f .product_'+product_id+' .image .owl-item:first-child img').attr('src', json['opt_image']);
  23. <?php } else { ?>
  24. $('#slider_m_f .product_'+product_id+' .image img').attr('src', json['opt_image']);
  25. <?php } ?>
  26.  
  27. <?php if ($description_options['zamena_description'] && $description_options['model']) { ?>
  28. $('#slider_m_f .product_'+product_id+' .pr_model_'+product_id).html(json['opt_model']);
  29. <?php } ?>
  30.  
  31. var start_quantity = parseFloat($('#slider_m_f .pr_quantity_'+product_id).html().replace(/\s*/g,''));
  32. var end_quantity = json['option_quantity'];
  33. $({val:start_quantity}).animate({val:end_quantity}, {
  34. duration: 500,
  35. easing: 'swing',
  36. step: function(val) {
  37. $('#slider_m_f .pr_quantity_'+product_id).html(number_format(val, product_id));
  38. }
  39. });
  40.  
  41. <?php if ($description_options['zamena_description'] && $description_options['weight']) { ?>
  42. var start_weight = parseFloat($('#slider_m_f .pr_weight_'+product_id).attr('data-weight'));
  43. var weight = json['weight'];
  44. $({val:start_weight}).animate({val:weight}, {
  45. duration: 500,
  46. easing: 'swing',
  47. step: function(val) {
  48. $('#slider_m_f .pr_weight_'+product_id).html(weight_format(val, product_id));
  49. }
  50. });
  51. $('#slider_m_f .pr_weight_'+product_id).attr('data-weight', json['weight']);
  52. <?php } ?>
  53.  
  54. <?php if ($stikers_status) { ?>
  55. var start_price = parseFloat($('#slider_m_f .special_no_format'+product_id).html().replace(/\s*/g,''));
  56. var price = json['price_n'];
  57. $({val:start_price}).animate({val:price}, {
  58. duration: 500,
  59. easing: 'swing',
  60. step: function(val) {
  61. $('#slider_m_f .special_no_format'+product_id).html(price_format(val));
  62. }
  63. });
  64. <?php } ?>
  65.  
  66. var start_special = parseFloat($('#slider_m_f .price_no_format'+product_id).html().replace(/\s*/g,''));
  67. var special = json['special_n'];
  68. $({val:start_special}).animate({val:special}, {
  69. duration: 500,
  70. easing: 'swing',
  71. step: function(val) {
  72. $('#slider_m_f .price_no_format'+product_id).html(price_format(val));
  73. }
  74. });
  75.  
  76. }
  77. });
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement