Advertisement
valeraplusplus

Наценка на доп поля Главный файл

Apr 14th, 2022
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. Nacenka na dop polya
  2. https://staff.megagroup.ru/staff/client/plan.php?object_type_id=1&object_id=2466561&plan_id=38814838#plan_id_38814838
  3. https://redmine.oml.ru/issues/45474
  4.  
  5. Otkrepil shabloni:
  6. shop2.v2-white-cart-product.tpl https://pastebin.com/A3xAeVAV
  7. shop2.v2-cart-product.tpl https://pastebin.com/T1Qv34JV
  8. shop2.v2-product-options-not-mod.tpl https://pastebin.com/hKKAFFWd
  9.  
  10. JS shop2.2.js https://pastebin.com/TkwFMQwF
  11.  
  12. obekt js => shop2.margin_price
  13. metod shop2.margin_price.price_change
  14.  
  15. viziv metodov mnogo gde DOCUMENT_READY shop2.queue.margin_price sobitie change 'select.additional-cart-params'
  16.  
  17.  
  18. shop2.margin_price = {
  19. price_change: function(j_this, selector_parent){
  20.  
  21. if( shop2.mode == 'cart' ){
  22.  
  23. form = $('#shop2-cart');
  24. shop2.cart.update(form);
  25.  
  26. return;
  27. }
  28.  
  29. var
  30. $form = $(j_this).closest(selector_parent),
  31. form = $form.get(0),
  32. kind_id = form.kind_id.value,
  33.  
  34. adds = $form.find('.additional-cart-params'),
  35. len = adds.length,
  36. el;
  37.  
  38.  
  39. var param = {
  40. 'kind_id': form.kind_id.value,
  41. 'params': {}
  42. }
  43.  
  44. if (len) {
  45.  
  46. for (var i = 0; i < len; i += 1) {
  47. el = adds[i];
  48. if (el.value) {
  49. param.params[el.name] = el.value;
  50. }
  51. }
  52. }
  53. $.ajax({
  54. url: '/my/s3/xapi/public/?method=shop2/getPrice',
  55. type: "get",
  56. data: {"param": param},
  57. dataType: "json",
  58. success: function(data){
  59.  
  60. $form.find('.price-current').replaceWith( data.result.data.html.price );
  61. $form.find('.price-old ').replaceWith( data.result.data.html.price_old );
  62. }
  63.  
  64. });
  65. },
  66. select_change: function(){
  67. if( !shop2.cf_margin_price_enabled ){
  68. return;
  69. };
  70.  
  71. var additional_cart_params = $('select.additional-cart-params');
  72.  
  73. if( additional_cart_params.length ){
  74. additional_cart_params.each(function(index, elem ){
  75.  
  76. $.on( elem , {
  77. change: function(e) {
  78. shop2.margin_price.price_change( $( e.target ), 'form');
  79. }
  80. });
  81. })
  82. }else {
  83. return;
  84. }
  85.  
  86.  
  87.  
  88. }
  89. };
  90. shop2.queue.margin_price = function() {
  91. shop2.margin_price.select_change();
  92. };
  93.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement