1$(document).ready(function() { 2 3 getDiscountsToProducts(); 4 $('button').click(function () { 5 getDiscountsToProducts(); 6 }); 7 8 var discountsales_complects = new Object(); 9 10 //alert($('.row_carusel_40_3').outerWidth()); 11 //css(«width») и outerWidth() 12}); 13 14function addComplectToCart(complects,cart){ 15 if(complects){ 16 var product_id; 17 for(product_id in complects){ 18 addProductToComplectToCart('cart_discountsales_complect_data' + product_id + complects[product_id]); 19 } 20 } 21} 22 23 24function addProductToComplectToCart(product_complect_id){ 25 26 $.ajax({ 27 url: 'index.php?route=checkout/cart/add', 28 type: 'post', 29 data: $('#'+product_complect_id+' input[type=\'hidden\']'), 30 dataType: 'json', 31 beforeSend: function() { 32 //$('#button-cart').button('loading'); 33 }, 34 complete: function() { 35 //$('#button-cart').button('reset'); 36 }, 37 success: function(json) { 38 $('.alert, .text-danger').remove(); 39 $('.form-group').removeClass('has-error'); 40 41 if (json['error']) { 42 if (json['error']['option']) { 43 for (i in json['error']['option']) { 44 var element = $('#input-option' + i.replace('_', '-')); 45 46 if (element.parent().hasClass('input-group')) { 47 element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>'); 48 } else { 49 element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>'); 50 } 51 } 52 } 53 54 if (json['error']['recurring']) { 55 $('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>'); 56 } 57 58 // Highlight any found errors 59 $('.text-danger').parent().addClass('has-error'); 60 } 61 62 if (json['success']) { 63 $('.breadcrumb').after('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>'); 64 65 $('#cart > button').html('<i class="fa fa-shopping-cart"></i> ' + json['total']); 66 67 $('html, body').animate({ scrollTop: 0 }, 'slow'); 68 69 $('#cart > ul').load('index.php?route=common/cart/info ul li'); 70 } 71 } 72 }); 73 74} 75 76 77function getDiscountsToProducts(){ 78 var links =[]; 79 var location_href = encodeURIComponent(window.location.href); 80 $(".caption h4 a").map(function(el){ 81 links[el] = this.href; 82 }); 83 var json_links = encodeURIComponent(JSON.stringify(links)); 84 $.ajax({ 85 url: 'index.php?route=total/discountsales/getDiscountsToProducts', 86 type: 'post', 87 data: '&location_href= ' + location_href + '&links=' + json_links, 88 beforeSend: function() { 89 }, 90 complete: function() { 91 }, 92 success: function(response) { 93 if(response===''){ 94 return; 95 } 96 $('.discountsales_container').remove(); 97 $('.discountsales_container_uph4').remove(); 98 var result = jQuery.parseJSON(response); 99 var i; 100 var discount_to_product; 101 var container_image; 102 var container_uph4; 103 for(i in result){ 104 discount_to_product = $('a[href = "' + result[i].link + '"]').parent('h4'); 105 container_image = '<div class="discountsales_container">'; 106 container_uph4 = '<div class="discountsales_container_uph4">'; 107 if(typeof result[i].discount!='undefined'){ 108 if(result[i].discount.position=='image'){ 109 container_image += result[i].discount.title; 110 } 111 if(result[i].discount.position=='uph4'){ 112 container_uph4 += '<div style="color:'+result[i].discount.colour+'">
112'+result[i].discount.title_string+'</div>'; 113 } 114 } 115 if(typeof result[i].discount_category!='undefined'){ 116 if(result[i].discount_category.position=='image'){ 117 container_image += result[i].discount_category.title; 118 } 119 if(result[i].discount_category.position=='uph4'){ 120 container_uph4 += '<div style="color:'+result[i].discount_category.colour+'">'+result[i].discount_category.title_string+'</div>'; 121 } 122 } 123 if(typeof result[i].discount_manufacturer!='undefined'){ 124 if(result[i].discount_manufacturer.position=='image'){ 125 container_image += result[i].discount_manufacturer.title; 126 } 127 if(result[i].discount_manufacturer.position=='uph4'){ 128 container_uph4 += '<div style="color:'+result[i].discount_manufacturer.colour+'">'+result[i].discount_manufacturer.title_string+'</div>'; 129 } 130 } 131 if(container_image!='<div class="discountsales_container">'){ 132 container_image += '</div>'; 133 discount_to_product.before(container_image); 134 } 135 if(container_uph4!='<div class="discountsales_container_uph4">'){ 136 container_uph4 += '</div>'; 137 discount_to_product.after(container_uph4); 138 } 139 } 140 } 141 142 }); 143 144}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.