1function agec_init_ordersteps(items){ 2 // console.log('agec_init_ordersteps', items); 3 4 var deliveryInputs = document.querySelectorAll("[name=DELIVERY_ID]"); 5 if(deliveryInputs.length){ 6 deliveryInputs.forEach(function(item){ 7 var clickItem = item.parentElement; 8 if(!clickItem.classList.contains('agec_init')){ 9 clickItem.classList.add('agec_init'); 10 11 BX.bind(clickItem, "click", function(){ 12 var deliveryID = this.querySelector('input').value; 13 BX.ajax({ 14 url: '/bitrix/tools/arturgolubev.ecommerce/ajax.php', 15 data: {'action': 'get_delivery_name', 'deliveryID': deliveryID}, 16 17 method: 'POST', 18 dataType: "json", 19 20 async: true, processData: true, scriptsRunFirst: false, emulateOnload: false, start: true, cache: false, 21 22 onsuccess: function(data){ 23 // console.log("AGEC send delivery change", data.delivery_name); 24 var agec_add_shipping_info = {"shipping_tier": data.delivery_name, "items": items}; 25 gtag("event", "add_shipping_info", agec_add_shipping_info); 26 }, 27 onfailure: function(){ 28 console.log('Ecommerce filed'); 29 }, 30 }); 31 }); 32 } 33 }); 34 } 35 36 // payment 37 var paymentInputs = document.querySelectorAll("[name=PAY_SYSTEM_ID]"); 38 if(paymentInputs.length){ 39 paymentInputs.forEach(function(item){ 40 var clickItem = item.parentElement; 41 if(!clickItem.classList.contains('agec_init')){ 42 clickItem.classList.add('agec_init'); 43 44 BX.bind(clickItem, "click", function(){ 45 var paymentID = this.querySelector('input').value; 46 47 BX.ajax({ 48 url: '/bitrix/tools/arturgolubev.ecommerce/ajax.php', 49 data: {'action': 'get_payment_name', 'paymentID': paymentID}, 50 51 method: 'POST', 52 dataType: "json", 53 54 async: true, processData: true, scriptsRunFirst: false, emulateOnload: false, start: true, cache: false, 55 56 onsuccess: function(data){ 57 // console.log("AGEC send payment change", data.payment_name); 58 var agec_add_payment_info = {"payment_type": data.payment_name, "items": items}; 59 gtag("event", "add_payment_info", agec_add_payment_info); 60 }, 61 onfailure: function(){ 62 console.log('Ecommerce filed'); 63 }, 64 }); 65 }); 66 } 67 }); 68 } 69}
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.