ALUMINIUMvakman

Zoekresultaten voor ""
Filters
Geen producten gevonden...

Tags

© Copyright 2025 ALUMINIUMvakman - onderdeel van Roca Online B.V.
Manage cookies
// if ((document.referrer).includes('services/challenge') && template == 'pages/account-login.rain') { // // window.dataLayer = window.dataLayer || []; // dataLayer.push({ // 'event': 'sign_up' // }); // } // if ((document.referrer).includes('account/login') && template == 'pages/account-dashboard.rain') { // // window.dataLayer = window.dataLayer || []; // dataLayer.push({ // 'event': 'login', // 'user_id': '', // 'user_email_hash': 'd41d8cd98f00b204e9800998ecf8427e' // }); // } $('#addedModal .btn1').on('click', function() { var btn = $(this); console.log(btn.attr('data-product')); var productData = JSON.parse(btn.attr('data-product')); var price = btn.attr('data-price'); var categories = btn.attr('data-categories'); if (btn.closest('.product-modal-related').find('.variant-select select').length) { price = btn.closest('.product-modal-related').find('.variant-select select option:selected').attr('data-price'); } if (!$(this).hasClass('added')) { $(this).addClass('added'); var url = $(this).attr('data-href'); $.ajax({ url: url, type: 'POST' }).done(function() { updateCart(); // dataLayer.push({ // 'event': 'add_to_cart', // 'ecommerce': { // 'add': { // 'products': [{ // 'name': productData.title, // 'id': productData.id, // 'price': price, // 'category': categories, // 'quantity': 1 // }] // } // } // }); }); } }); $('#product-actions').on('submit', function(e) { console.log('test'); $('.loading-cart').css('display','block'); $('.error-msg-custom').remove(); var form = $('#product-actions'); var url = $(form).attr('action'); var productTitle = form.attr('data-title'); var variantTitle = form.attr('data-variant'); var inStock = form.attr('data-stock'); var added = $('#quantity').val(); var btn = $(this).find('.btn1[data-price]'); var productData = JSON.parse(btn.attr('data-product')); var categories = ''; $.each(productData.categories, function(index, category) { categories += category.title + '/'; }); categories = categories.substring(0, categories.length - 1); var price = btn.attr('data-price'); var inputs = form.find('select[required], input[required]'); var error = false; var addCartButton = form.find('.add-to-cart'); inputs.each(function() { var val = $(this).val(); if ($(this).closest('div').hasClass('radio')) { if ($(this).closest('.wrapper').find('input[required]:checked').length) { $(this).closest('label').removeClass('error'); } else { error = true; $(this).closest('label').addClass('error'); } } else { if (!val) { error = true; $(this).addClass('error'); } else { $(this).removeClass('error'); } } }); if (!error) { $.ajax({ type: "POST", url: url, data: $("#product-actions").serialize(), success: function(msg){ updateCart(productTitle, variantTitle, inStock, added); $('.loading-cart').css('display','none'); // dataLayer.push({ // 'event': 'add_to_cart', // 'ecommerce': { // 'add': { // 'products': [{ // 'name': productData.title, // 'id': productData.id, // 'price': price, // 'category': categories, // 'quantity': added // }] // } // } // }); }, error: function() { $('.loading-cart').css('display','none'); alert("Er ging iets mis"); } }); } else { setTimeout(function(){ $('.loading-cart').css('display','none'); }, 300); $('
Niet alle velden zijn correct ingevuld
').insertBefore(addCartButton); } e.preventDefault(); }); $('#gui-form-cart .gui-number input').each(function() { var value = $(this).val(); $(this).attr('data-value', value); }); $('#gui-form-cart .gui-number .gui-handle a').live('click', function(){ var cur = $(this); var way = $(this).attr('class').replace('gui-',''); updateCartQuantity(way, cur); }); // var cartQtimeout =false; // $('#gui-form-cart .gui-number input').live('keyup', function(){ // var cur = $(this); // var prevValue = cur.attr('data-value'); // clearTimeout(cartQtimeout); // cartQtimeout = setTimeout(function(){ // var href = cur.attr('href'); // var qid = cur.closest('tr').find('.gui-number input').attr('name'); // var newQuantity = Math.abs(cur.closest('tr').find('.gui-number input').val() * 1 - prevValue * 1); // var product = allProducts['product-' + qid]; // cur.attr('data-value', newQuantity); // if (prevValue * 1 < cur.val() * 1) { // dataLayer.push({ // 'event': 'add_to_cart', // 'ecommerce': { // 'add': { // 'products': [{ // 'name': product.title, // 'id': product.id, // 'price': product.price.price, // 'quantity': newQuantity, // 'category': categories ? categoriesDict[product.id] : '' // }] // } // } // }); // } else { // dataLayer.push({ // 'event': 'remove_from_cart', // 'ecommerce': { // 'remove': { // 'products': [{ // 'name': product.title, // 'id': product.id, // 'price': product.price.price, // 'quantity': newQuantity, // 'category': categories ? categoriesDict[product.id] : '' // }] // } // } // }); // } // cur.closest('form').submit(); // },700); // }); var cartQPlustimeout =false; function updateCartQuantity(way, cur){ clearTimeout(cartQPlustimeout); var prevValue = cur.closest('tr').find('.gui-number input').attr('data-value'); cartQPlustimeout = setTimeout(function(){ var href = cur.attr('href'); var qid = cur.closest('tr').find('.gui-number input').attr('name'); var newQuantity = Math.abs(cur.closest('tr').find('.gui-number input').val() * 1 - prevValue * 1); var product = allProducts['product-' + qid]; cur.attr('data-value', newQuantity); // if (way == 'up'){ // dataLayer.push({ // 'event': 'add_to_cart', // 'ecommerce': { // 'add': { // 'products': [{ // 'name': product.title, // 'id': product.id, // 'price': product.price.price, // 'quantity': newQuantity, // 'category': categories ? categoriesDict[product.id] : '' // }] // } // } // }); // } else { // console.log(newQuantity); // dataLayer.push({ // 'event': 'remove_from_cart', // 'ecommerce': { // 'remove': { // 'products': [{ // 'name': product.title, // 'id': product.id, // 'price': product.price.price, // 'quantity': newQuantity, // 'category': categories ? categoriesDict[product.id] : '' // }] // } // } // }); // } },700); } $('#gui-form-cart .gui-action-delete').live('click', function(e){ e.preventDefault(); var href = $(this).attr('href'); var deleteUrl = $(this).attr('href').split('/'); var qid = deleteUrl[deleteUrl.length - 2]; var product = allProducts['product-' + qid]; if (categories) { // dataLayer.push({ // 'event': 'remove_from_cart', // 'ecommerce': { // 'remove': { // 'products': [{ // 'name': product.title, // 'id': product.id, // 'price': product.price.price, // 'quantity': $(this).closest('tr').find('.gui-number input').val(), // 'category': categoriesDict[product.id] // }] // } // } // }); } else { // dataLayer.push({ // 'event': 'remove_from_cart', // 'ecommerce': { // 'remove': { // 'products': [{ // 'name': product.title, // 'id': product.id, // 'price': price, // 'quantity': $(this).closest('tr').find('.gui-number input').val(), // }] // } // } // }); } window.location.href = href; }); // $('.gui.gui-account .gui-block-linklist li:last-child a').on('click', function(e){ // e.preventDefault(); // var url = $(this).attr('href'); // dataLayer.push({ // 'event': 'logout', // 'user_id': userId, // 'user_email_hash': userEmail // }); // window.location.href = url; // });