1 2window.addArticleByCode = function(artikelcode, quantity) { 3 if (!artikelcode || quantity < 1) { 4 console.error("Invalid parameters"); 5 return; 6 } 7 8 let poststr = "Aantal=" + quantity + 9 "&ArtikelCode=" + artikelcode; 10 11 jQuery.ajax({ 12 type: 'POST', 13 url: '/ajax/diversen?page=ecommerceByArticleCode', 14 data: poststr, 15 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 16 dataType: 'json' 17 }) 18 .done(function(result) { 19 if (!result) { 20 console.warn("Add to card failed:", result ? result.message : "No response"); 21 return; 22 } 23 24 // Refresh cart UI (existing shop function) 25 if (typeof reloadShoppingCart === "function") { 26 reloadShoppingCart(); 27 } 28 29 // Facebook pixel 30 if (typeof facebookPixelAddToCart === "function") { 31 facebookPixelAddToCart(result.artikelID); 32 } 33 34 if(quantity > 0 && result.ecommerceTitle !== '' && result.ecommercePrice > 0) { 35 // Spotler / Google tracking 36 if (typeof googleEcommerceSpotlerActivateCartUpdate === "function") { 37 googleEcommerceSpotlerActivateCartUpdate( 38 'add', 39 result.artikelCode, 40 result.ecommerceTitle, 41 quantity, 42 result.ecommercePrice, 43 ); 44 } 45 } 46 }, 47 ) 48 .fail(function() { }); 49}; 50 51function googleEcommerceSpotlerActivateCartUpdate(Type, ArtikelCode, Title, Amount, Price) { 52 let eventName = 'add_to_cart'; 53 if(Type === 'remove') { 54 eventName = 'remove_from_cart'; 55 } 56 dataLayer.push({ 57 'event': eventName, 58 'ecommerce': { 59 'currency': 'EUR', 60 'value': (Price * Amount), 61 'items': [{ 62 'id': ArtikelCode, 63 'name': Title, 64 'price': Price, 65 'quantity': Amount 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.