Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/laciasmara.com/public_html/shop/themes/3/js/ |
Upload File : |
function dynamicStockCondition(dynamicStockCondition) { if (dynamicStockCondition == 'Indent') { //submit #submitToCart1 Indent jQuery('#submitToCart1').off('click'); jQuery('#submitToCart1').on('click', function () { var qty1 = jQuery('#qty1').val(); // alert("tes 1 : "+qty1); jQuery('#modalIndentTOC').modal('show'); jQuery('#indentTOCAgree').off('click'); jQuery('#indentTOCAgree').on('click', function () { jQuery('#modalIndentTOC').modal('hide'); addToCart(chosenVarianDetailArray, qty1, baseUrl, productId, csrfHash); }); }); //submit #submitToCart2 Indent jQuery('#submitToCart2').off('click'); jQuery('#submitToCart2').on('click', function () { var qty2 = jQuery('#qty2').val(); // alert("tes 2 : "+qty2); jQuery('#modalIndentTOC').modal('show'); jQuery('#indentTOCAgree').off('click'); jQuery('#indentTOCAgree').on('click', function () { jQuery('#modalIndentTOC').modal('hide'); addToCart(chosenVarianDetailArray, qty2, baseUrl, productId, csrfHash); }); }); } else if (dynamicStockCondition == 'In Stock') { //submit #submitToCart1 In Stock jQuery('#submitToCart1').off('click'); jQuery('#submitToCart1').on('click', function () { var qty1 = jQuery('#qty1').val(); // alert("tes 3 : "+qty1); addToCart(chosenVarianDetailArray, qty1, baseUrl, productId, csrfHash); }); //submit #submitToCart2 In Stock jQuery('#submitToCart2').off('click'); jQuery('#submitToCart2').on('click', function () { var qty2 = jQuery('#qty2').val(); // alert("tes 4 : "+qty2); addToCart(chosenVarianDetailArray, qty2, baseUrl, productId, csrfHash); }); } } function initialProductDetail(chosenVarianDetailArray, productId, baseUrl, csrfHash, indentTime, indentDp, callback = function (datax) { }) { jQuery.ajax({ 'url': baseUrl + 'ajax/initialproductdetail', 'type': 'POST', 'data': { 'product_id': productId, 'attribute_detail_ids': chosenVarianDetailArray, 'csrftestname': csrfHash }, 'success': function (data) { if (data) { /*---success----*/ var result = JSON.parse(data); jQuery('#productImageContainer').html(result.image_content); jQuery('#stockStatus').html(result.stock_text); if (result.match_found == 'false') { jQuery('#notAvailable').html('Product combination not available'); jQuery('.productPrice').html('<span>Price</span><h2> </h2>'); jQuery('.submitToCart').prop('disabled', true); } else { //match found.. jQuery('#notAvailable').html(''); jQuery('.productPrice').html(result.price_content); if (result.stock_text == 'Indent') { jQuery('.submitToCart').prop('disabled', false); jQuery('#indentTime').html(indentTime); jQuery('#stockStatus').html(result.stock_text + '<br>Downpayment ' + indentDp + '%'); jQuery('#submitToCart1').attr('data-target', '#none'); jQuery('#submitToCart2').attr('data-target', '#none'); } else if (result.stock_text == 'In Stock') { jQuery('#stockStatus').html('In Stock'); jQuery('.submitToCart').prop('disabled', false); jQuery('#indentTime').html('1-3 Days'); jQuery('#submitToCart1').attr('data-target', '#ModalAddtocartSukses'); jQuery('#submitToCart2').attr('data-target', '#ModalAddtocartSukses'); } else if (result.stock_text == 'No Stock') { jQuery('#stockStatus').html('Not Stock'); jQuery('.submitToCart').prop('disabled', true); jQuery('#indentTime').html('No Stock'); jQuery('#submitToCart1').attr('data-target', '#ModalAddtocartSukses'); jQuery('#submitToCart2').attr('data-target', '#ModalAddtocartSukses'); } else if (result.stock_text == 'Not Available') { jQuery('#stockStatus').html('Not Available'); jQuery('.submitToCart').prop('disabled', true); jQuery('#indentTime').html('Not Available'); } } callback(result.stock_text); //load flexslider... loadFlexslider(); var localstroage_pd_id = localStorage.getItem('localstroage_pd_id'); if (localstroage_pd_id != null && localstroage_pd_id != undefined) { localstroage_pd_id = localstroage_pd_id.split(','); for (i = 0; i < localstroage_pd_id.length; i++) { // alert(localstroage_pd_id[i]); jQuery("ul.blok_select li a#a_varian_" + localstroage_pd_id[i]).click(); } } else { var block_select = jQuery("ul.blok_select"); for (i = 0; i < block_select.length; i++) { // alert(localstroage_pd_id[i]); jQuery("ul.blok_select:eq(" + i + ") li:eq(0) a:eq(0)").click(); } } }; } }); } function changeProductDetail(selectedDetailId, varianOrdering, varianId, attributeId, baseUrl, productId, indentTime, indentDp, callback = function (datax) { }) { chosenVarianDetailArray[varianOrdering - 1] = selectedDetailId; jQuery.ajax({ 'url': baseUrl + 'ajax/changeproductdetail', 'type': 'POST', 'data': { 'product_id': productId, 'attribute_detail_id': selectedDetailId, 'attribute_detail_ids': chosenVarianDetailArray, 'csrftestname': csrfHash }, 'success': function (data) { if (data) { /*---success----*/ var result = JSON.parse(data); jQuery('#productImageContainer').html(result.image_content); jQuery('#detailName' + varianId).html(result.detail_attribute_name); if (result.match_found == 'false') { jQuery('#notAvailable').html('Product combination not available'); jQuery('.productPrice').html('<span>Price</span><h2> </h2>'); jQuery('.submitToCart').prop('disabled', true); jQuery('#indentTime').html('Not Available'); jQuery('#stockStatus').html('Not Available'); } else { //match found.. jQuery('#notAvailable').html(''); jQuery('.productPrice').html(result.price_content); if (result.stock_text == 'Indent') { jQuery('.submitToCart').prop('disabled', false); jQuery('#indentTime').html(indentTime); jQuery('#stockStatus').html(result.stock_text + '<br>Downpayment ' + indentDp + '%'); jQuery('#submitToCart1').removeAttr('data-target'); jQuery('#submitToCart2').removeAttr('data-target'); } else if (result.stock_text == 'In Stock') { jQuery('#stockStatus').html('In Stock'); jQuery('.submitToCart').prop('disabled', false); jQuery('#indentTime').html('1-3 Days'); jQuery('#submitToCart1').attr('data-target', '#ModalAddtocartSukses'); jQuery('#submitToCart2').attr('data-target', '#ModalAddtocartSukses'); } else if (result.stock_text == 'No Stock') { jQuery('#stockStatus').html('No Stock'); jQuery('.submitToCart').prop('disabled', true); jQuery('#indentTime').html('No Stock'); jQuery('#submitToCart1').attr('data-target', '#ModalAddtocartSukses'); jQuery('#submitToCart2').attr('data-target', '#ModalAddtocartSukses'); } else if (result.stock_text == 'Not Available') { jQuery('#stockStatus').html('Not Available'); jQuery('.submitToCart').prop('disabled', true); jQuery('#indentTime').html('Not Available'); } } //load flexslider... callback(result.stock_text); loadFlexslider(); }; } }); } function changeVarian(varianId, attributeId, imageClass, imageSpan, varianOrdering) { jQuery('#varian' + varianId + ' ul.blok_select li#' + attributeId + ' a.' + imageClass).on('click', function (e) { e.preventDefault(); jQuery('#varian' + varianId + ' ul.blok_select li a.' + imageClass + imageSpan).css('opacity', '0.4'); jQuery('#varian' + varianId + ' ul.blok_select li#' + attributeId + ' a.' + imageClass + imageSpan).css('opacity', '1'); var selectedDetailId = jQuery(this).attr('data'); changeProductDetail(selectedDetailId, varianOrdering, varianId, attributeId, baseUrl, productId, indentTime, indentDp, function (dsc) { dynamicStockCondition(dsc); }); }); } function addToCart(chosenVarianDetailArray, qty, baseUrl, productId, csrfHash) { jQuery.ajax({ 'url': baseUrl + 'ajax/ajax_add_to_cart', 'type': 'POST', 'cache': false, 'data': { 'product_id': productId, 'qty': qty, 'attribute_detail_ids': chosenVarianDetailArray, 'csrftestname': csrfHash }, 'success': function (data) { if (data) { /*---success----*/ if (data == 'no stock') { jQuery('#cartMessage').html('Not Enough Stock'); } else { jQuery('#cartMessage').html('Product added successfully'); var cart = JSON.parse(data); jQuery('#cart_body').html(cart.cart_content); jQuery('.cartCount').html(cart.cart_count); if (cart.cart_count == 0) { jQuery('#processCheckout').hide(); } else { jQuery('#processCheckout').show(); } } }; } }); } function loadFlexslider() { jQuery('#carousel').flexslider({ animation: "slide", controlNav: false, animationLoop: false, slideshow: false, itemWidth: 80, itemMargin: 2, asNavFor: '#slider' }); jQuery('#slider').flexslider({ animation: "slide", controlNav: false, animationLoop: false, slideshow: false, sync: "#carousel" }); }