').insertAfter('.quantity input'); jQuery('.quantity').each(function() { var spinner = jQuery(this), input = spinner.find('input[type="number"]'), btnUp = spinner.find('.quantity-up'), btnDown = spinner.find('.quantity-down'), min = input.attr('min'), max = input.attr('max'); btnUp.click(function() { var oldValue = parseFloat(input.val()); if (oldValue >= max) { var newVal = oldValue; } else { var newVal = oldValue + 1; } spinner.find("input").val(newVal); spinner.find("input").trigger("change"); }); btnDown.click(function() { var oldValue = parseFloat(input.val()); if (oldValue <= min) { var newVal = oldValue; } else { var newVal = oldValue - 1; } spinner.find("input").val(newVal); spinner.find("input").trigger("change"); }); }); /* End Custom Input Increment */ } function set_countdown(element, endDate) { setInterval(function time(){ var d = new Date(endDate) - new Date(); var days = 0; var hours = Math.floor((d / (1000 * 60 * 60))); var min = Math.floor((d / (1000 * 60)) % 60); if((min + '').length == 1){ min = '0' + min; } var sec = Math.floor((d / 1000) % 60); if((sec + '').length == 1){ sec = '0' + sec; } if (days > 1) jQuery(element).html(days + 'd ' + hours + ' : ' + min + ' : ' + sec); else if(d > 0) jQuery(element).html(hours + ' : ' + min + ' : ' + sec); else jQuery(element).html(''); }, 1000); } function parseAddToList(index, product, url){ var qty = jQuery("#qtyproduct").val(); var prodId = jQuery("#prodId").val(); var pdpColor = $("#pdp-color").val(); var pdpSpek = $("#pdp-spek").val(); if(pdpColor == ''){ $("#errConfig").show(); $("#errConfig").html(' Silahkan pilih warna'); return false; }else if(pdpSpek == ''){ $("#errConfig").show(); $("#errConfig").html(' Silahkan pilih size'); return false; }else{ $("#addShoppingList").modal("show"); addToList(index, prodId, url, qty); } } var productDetailInfo = {"price":"41000","name":"Lampu LED 9 Watt Philips","id":"A07900278345","category":"Rumah & Dapur\/Perlengkapan Rumah\/Lampu & Lilin","brand":"PHILIPS"}; gap.pushProductDetail(productDetailInfo); dataLayer.push({ 'PageType': 'product-detail', 'HashedEmail': 'EMAIL' }); function pushAddToCartPdp(qty) { if (productDetailInfo) { gap.pushAddToCart2(productDetailInfo, qty); } } var lazyCrossSell = []; var crossSellInfo = []; if (crossSellInfo.length > 0) { $(window).load(function(){ lazyCrossSell = setLazy('ga-view-cross-sell'); $('.ga-click-cross-sell').click(function() { gap.pushProductClick($(this).attr('index'), crossSellInfo); }); $('.ga-cart-cross-sell').click(function() { gap.pushAddToCart($(this).attr('index'), crossSellInfo);	}); }); $(window).on("load resize scroll",function(e){ setTimeout(function() {lazyCrossSell = lazyPush(lazyCrossSell, crossSellInfo, 'product');}, 500); }); } var lazyUpSell = []; var upSellInfo = []; if (upSellInfo.length > 0) { $(window).load(function(){ lazyUpSell = setLazy('ga-view-up-sell'); $('.ga-click-up-sell').click(function() { gap.pushProductClick($(this).attr('index'), upSellInfo); }); $('.ga-cart-up-sell').click(function() { gap.pushAddToCart($(this).attr('index'), upSellInfo);	}); }); $(window).on("load resize scroll",function(e){ setTimeout(function() {lazyUpSell = lazyPush(lazyUpSell, upSellInfo, 'product');}, 500); }); } var cartInfo = new Array(); var cartInfo = []; function pushRemoveFromCart(index) { if (cartInfo.length > 0) { gap.pushRemoveFromCart(index, cartInfo); } } function pushGAAddRemove(index, qty, type){ if (type == 'add'){ gap.pushAddToCart2(cartInfo[index], qty); } else { gap.pushRemoveFromCart2(cartInfo[index], qty); } }