alkayaelektronik.com
Benzer Ürünler

Yükleniyor..
`; return str.replace('LOADINGDIVID', divid) } function _resetMainProdImages() { $.each($('.main-product-images'), function () { $(this).attr('src', $(this).attr('src-orig',)).show(); $(this).attr('srcset', $(this).attr('srcset-orig',)); $(this).attr('data-usablesrc', $(this).attr('data-usablesrc-orig',)); }) } function _selectorOfVariantEntities(productId) { let selectedVariants = $(`div[data-variant-product-id=${productId}] > .single-variant-option li.active, div[data-variant-product-id=${productId}] select option:selected, div[data-variant-product-id=${productId}] input[type=checkbox]:checked`) if (!selectedVariants.length) { selectedVariants = $(`div[data-variant-product-id=${productId}]`).find(`.single-variant-option li.active`) } return selectedVariants; } function _commonPrepareLink() { let str = '&k_id=&aid=&mid=&clid=&incpm=' + incpm + '&prodLoadParty=' + prodLoadParty; //filter link list $.each($('.filteroptionclick.clickedfilter'), function (indice, onefilter) { let keyid = onefilter.getAttribute('data-key-id') let valueid = onefilter.getAttribute('data-value-id') if (keyid && valueid) { str = str + '&filtre[' + keyid + '][' + valueid + ']=' + valueid } }); //filter select menus $.each($('.filteroptionselect option:selected'), function (indice, onefilter) { let keyid = onefilter.getAttribute('data-key-id') let valueid = onefilter.getAttribute('data-value-id') if (keyid && valueid) { str = str + '&filtre[' + keyid + '][' + valueid + ']=' + valueid } }); //filter mobile checkboxes $.each($('.filteroptioncheckbox:checked'), function (indice, onefilter) { let keyid = onefilter.getAttribute('data-key-id') let valueid = onefilter.getAttribute('data-value-id') if (keyid && valueid) { str = str + '&filtre[' + keyid + '][' + valueid + ']=' + valueid } }); let filterSearchText = $('.filtersearch:first').val() if (filterSearchText) { str = str + '&search=' + filterSearchText } return str } function _prepareFilterLink() { prodLoadParty++; listing_laststart = 0; scrollload_start = 1; return _commonPrepareLink() + '&start=0' } function _preparePriceFilterLink() { prodLoadParty++; let priceoption if (priceoption = $('.pricefilteroptionclick.clickedfilter').first()) { let minval = priceoption.data('min-value') let maxval = priceoption.data('max-value') return (minval && maxval) ? ('price=' + minval + ';' + maxval) : '' } else { return '' } } function _prepareOrderSelectLink() { return selected_orderselect ? '&orderselect=' + selected_orderselect : '' } function _prepareSearchLink() { return ps_search_text ? '&search=' + ps_search_text : '' } function _drawFilterRemoval() { $('.removefilteroption').off('click') let filters = ''; if ($('.filteroptionclick.clickedfilter').length || $('.pricefilteroptionclick.clickedfilter').length) { $.each($('.filteroptionclick.clickedfilter'), function (indice, onefilter) { let filtername = onefilter.getAttribute('data-value-name') let filtertitle = onefilter.getAttribute('data-value-title') let filterid = onefilter.getAttribute('data-value-id') filters = filters + `
  • Seçimi Kaldır ${filtertitle} : ${filtername}
  • ` }); $.each($('.pricefilteroptionclick.clickedfilter'), function (indice, onefilter) { let minvalue = onefilter.getAttribute('data-min-value') let maxvalue = onefilter.getAttribute('data-max-value') let currencysymbol = onefilter.getAttribute('data-currency-symbol') let filterid = onefilter.getAttribute('data-value-id') filters = filters + `
  • Seçimi Kaldır Fiyat Aralığı : ${minvalue} - ${maxvalue} ${currencysymbol}
  • ` }); } if (filters) { $(maindivselectorheader).html(filters) $(maindivselectorheader).show() $('.removefilteroption').click(function () { $('[data-value-id=' + $(this).data('remove-id') + ']').removeClass('clickedfilter') runFiltering(null) }) } else { $(maindivselectorheader).hide() } } function _signifyFilterLink(clickedFilter) { if (clickedFilter) { clickedFilter.hasClass('clickedfilter') ? clickedFilter.removeClass('clickedfilter') : clickedFilter.addClass('clickedfilter') } } function runFiltering(clickedFilterOption) { if (!listing_style) return true; _signifyFilterLink(clickedFilterOption) _drawFilterRemoval() $(maindivselector).prepend(_loadinggifhtml("filterlist_loadinggif")); filterlist_processing = true; $.ajax({ url: 'processnaked.php?p=jsonajax&ajax=' + listing_style + customListingUrlExtention + '&' + _prepareFilterLink() + '&' + _preparePriceFilterLink() + _prepareSearchLink() + _prepareOrderSelectLink(), type: "GET", dataType: "JSON", success: function (response) { if (response.html == '') filterlist_loadingstatus = false; if (response.status) { if (listing_style != 'b2blistproduct') { response.html = '' } $(maindivselector).html(response.html) _prepareAllDrawnProducts() if (response.counted_product > 0) { $('.filter-product-counter').html(response.counted_product) $('.containerEmptyListBody').hide() } else { $('.filter-product-counter').html('0') $('.containerEmptyListBody > .historygoback').hide() $('.containerEmptyListBody').show() } } else { $(maindivselector).prepend(response.html) } filterlist_processing = false; $("#filterlist_loadinggif").remove(); }, error: function (response) { filterlist_processing = false; $(maindivselector).prepend('Hata Mesajı') } }); return true; } function _preparePriceFilterBox(new_drawn_min_price, new_drawn_max_price) { if (drawn_min_price > new_drawn_min_price) drawn_min_price = new_drawn_min_price if (new_drawn_max_price > drawn_max_price) drawn_max_price = new_drawn_max_price let base_min = Math.floor(drawn_min_price / 100) * 100 let base_max = (Math.floor(drawn_max_price / 100) + 1) * 100 let base_diff = base_max - base_min let base_step = base_diff / 5 if (base_step > 2000) { base_step = base_step - (base_step % 1000) } else if (base_step > 1000) base_step = 1000 else if (base_step > 500) base_step = 500 else if (base_step > 250) base_step = 250 else base_step = 100 let arr = []; for (let i = 0; i < Math.floor(base_diff / base_step); i++) { let obj = { min_value: (base_min + (base_step * i) + (i == 0 ? 0 : 1)), max_value: (base_min + (base_step * (i + 1))) }; arr.push(obj); } $('#pricefilterhtml').html('') $.each(arr, function (indice, oneObj) { let str = `
  • ${oneObj.min_value} - ${oneObj.max_value}
  • `; $('#pricefilterhtml').append(str) }) $('.pricefilteroptionclick').click(function () { $('.pricefilteroptionclick').removeClass('clickedfilter') let mypriceoption = $(this) runFiltering(mypriceoption) }); } function _prepareListingLink(listing_laststart) { prodLoadParty++; return _commonPrepareLink() + '&start=' + listing_laststart + _prepareSearchLink() + _prepareOrderSelectLink(); } function __refresh_quick_cart() { $.ajax({ url: "processnaked.php?p=jsonaction&action=refreshquickcart&rand=" + Math.random(), type: "POST", data: "", processData: false, contentType: false, dataType: "JSON", success: function (response) { if (response.success) { $('.cart-product-list').empty() if (response.quickcartcounter > 0 || response.quickcartcounter === 0) { $('.cart-counter').html(response.quickcartcounter) } $('.cart-total-price').html(response.cart_total_price) if (response.quickcartcounter > 0) { $('.cart-has-products, .cart-product-list, .show-my-cart-link').show() $('.cart-is-empty').hide() $.each(response.product_array, function (basketindice, oneitem) { let tmphtml = $('#cart-product-list-template').html() $('.cart-product-list').append(tmphtml) $('.cart-product-list > .one-cart-item:last').attr('product-id', oneitem.product_id) $('.cart-product-list > .one-cart-item .cart-product-image:last').attr('src', oneitem.product_image) $('.cart-product-list > .one-cart-item .cart-product-image:last').attr('srcset', oneitem.product_image) $('.cart-product-list > .one-cart-item .cart-product-quantity:last').html((oneitem.complexdata_quantity ? oneitem.complexdata_quantity : oneitem.product_quantity) + ' ' + oneitem.product_unit_value_name) $('.cart-product-list > .one-cart-item .cart-product-name:last').html(oneitem.product_name) $('.cart-product-list > .one-cart-item .cart-product-price:last').html(oneitem.product_price > 0.0 ? oneitem.product_price_text : '---') $('.cart-product-list > .one-cart-item .cart-product-remove-link:last').attr('basketindice', basketindice) let cartHrefUrl = '/?p=show&pid=' + oneitem.product_id $('.cart-product-list > .one-cart-item .cart-product-link-1:last').attr('href', cartHrefUrl) $('.cart-product-list > .one-cart-item .cart-product-link-2:last').attr('href', cartHrefUrl) }) $('.cart-product-remove-link').click(function () { let basketindice = $(this).attr('basketindice') $.ajax({ url: "processnaked.php?p=jsonaction&action=deletefromcart&basketindice=" + basketindice, type: "POST", data: "", processData: false, contentType: false, dataType: "JSON", success: function (response) { console.log(response.message) if (response.success) { __refresh_quick_cart(); } }, fail: function (response) { console.log(response) } }) }); } else { $('.cart-has-products, .cart-product-list, .show-my-cart-link').hide() $('.cart-is-empty').show() } } else { console.log(response.message) } }, fail: function (response) { console.log(response) } }) } function _productlisting_addfavorite(id) { let product_id = id; Swal.fire({ title: 'Favori Ürünlerinize Ekleyin', text: 'Üye girişi yapmadan bu işlemi gerçekleştiremezsiniz', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Üye Girişi', cancelButtonText: "İptal" }).then(function (result) { if (result.value) { window.location.href = '/?p=login&linkUrl=' + encodeURIComponent(window.location.href); } }); } function _runBatchAddCartOneStep() { if (batchAddToCartButtonIdList.length) { try { batchAddToCartButtonCurrentId = batchAddToCartButtonIdList.pop() $('#' + batchAddToCartButtonCurrentId).trigger('click'); } catch (e) { console.log(e.message) } } } function _utilizeVariantHTML() { $('.single-variant-option li').off('click').on('click', function (e) { if (!$(this).hasClass('active')) { $(`div[data-variant-group="${$(this).data('variant-group')}"]`).find('.single-variant-option li').not($(this)).removeClass('active') $(this).addClass('active') } }) $('.detail-variant-photo-view').off('click').on('click', function (e) { $('.with-zoom').css('background-image', 'url(' + $(this).find('img').data('usablesrc') + ')'); $('.with-zoom img').attr('src', $(this).find('img').data('usablesrc')); }) } function _drawVariantSelection(addButtonItSelf) { let added_product_id = parseInt(addButtonItSelf.data('product-id')) let has_variant = parseInt(addButtonItSelf.data('has-variant')) let package_flag = parseInt(addButtonItSelf.data('package-flag')) $('.basket-modal .mainVariantHTMLDiv').html('') $.ajax({ method: "POST", dataType: "JSON", url: "processnaked.php?p=jsonajax&ajax=drawvariants", data: { product_id: added_product_id, has_attribute_flag: has_variant, product_package_flag: package_flag, }, success: function (response) { try { if (response.success) { $('.basket-modal .mainVariantHTMLDiv').html(response.html) _utilizeVariantHTML(); _utilizeAddToCartButtons(); } else { $(".modal").hide() _popMessage({ success: false, title: "İşlem gerçekleştirilemedi", message: response.message, type: "warning" }) } } catch (e) { $(".modal").hide() _popMessage({ success: false, title: "Hata Mesajı", message: e.message, type: "error" }) } }, complete: function () { $(".basket-modal .basket-popup-loading").hide() }, error: function (response) { console.log(response) Swal.fire("Hata Mesajı", "İşlem gerçekleştirilemedi : ajax fail", "error"); $(".basket-modal .basket-popup-loading").hide() $(".modal").hide() } }); } function _drawComplexDataSelection(addButtonItSelf) { let added_product_id = parseInt(addButtonItSelf.data('product-id')) let complexdata_id = parseInt(addButtonItSelf.data('complexdata-id')) $('.mainComplexDataHTMLDiv').html('') $.ajax({ method: "POST", dataType: "JSON", url: "processnaked.php?p=jsonajax&ajax=drawcomplexdata", data: { product_id: added_product_id, complexdata_id: complexdata_id }, success: function (response) { try { if (response.success) { $('.mainComplexDataHTMLDiv').html(response.html) _utilizeComplexDataInputs(); _utilizeAddToCartButtons(); } else { $(".modal").hide() _popMessage({ success: false, title: "İşlem gerçekleştirilemedi", message: response.message, type: "warning" }) } } catch (e) { $(".modal").hide() _popMessage({ success: false, title: "Hata Mesajı", message: e.message, type: "error" }) } }, complete: function () { $(".basket-modal .basket-popup-loading").hide() }, error: function (response) { console.log(response) Swal.fire("Hata Mesajı", "İşlem gerçekleştirilemedi : ajax fail", "error"); $(".basket-modal .basket-popup-loading").hide() $(".modal").hide() } }); } function _parseAndProcessAddBasket(addButtonItSelf) { let added_product_id = parseInt(addButtonItSelf.data('product-id')) if (added_product_id > 0) { let added_product_quantity, added_product_min_quantity; let inputOfButton = $('#addbasketbuttonquantity' + added_product_id).find('input[class*=addbasketquantity]'); if (inputOfButton.data('format') == 'float') { added_product_quantity = parseFloat(inputOfButton.val()) added_product_min_quantity = parseFloat(inputOfButton.data('min')) } else { added_product_quantity = parseInt(inputOfButton.val()) added_product_min_quantity = parseInt(inputOfButton.data('min')) } added_product_quantity = added_product_quantity >= added_product_min_quantity ? added_product_quantity : (added_product_min_quantity > 0 ? added_product_min_quantity : 1); let added_product_unit_value = $('#selected-unit-' + added_product_id).val(); let sentData = { product_id: added_product_id, product_quantity: added_product_quantity, mass_variants: '', warehouse: '', product_unit_value: added_product_unit_value, order_upload_process_completed: 0, complex_data: '' } let passed_variant_selection = true; $.each(_selectorOfVariantEntities(added_product_id), function () { let selectedAttrWord = $(this).data('variant-group') let selectedAttrValuesId = $(this).data('values-id') if (!selectedAttrValuesId) { _popMessage({ success: false, title: "Ürün sepete eklenemedi", message: "Seçiniz : " + $(`input[data-variant-group="${selectedAttrWord}"][name="product_attribute_title[]"]`).val(), type: "error" }) passed_variant_selection = false; return; } sentData.mass_variants = sentData.mass_variants + '&' + $(`input[name='product_attribute_template_id[]']`).serialize() + '&' + $(`span[data-values-id='${selectedAttrValuesId}']`).find('input').serialize() + `&attribute_${selectedAttrWord}[]=${selectedAttrValuesId}` }); if (passed_variant_selection) { if ($('input[name="complexdata_id"]').length > 0) { if ($('#complexdata_calculation_message').val()) { _popMessage({ success: false, title: "Ürün sepete eklenemedi", message: $('#complexdata_calculation_message').val(), type: "warning" }) $(".basket-modal .basket-popup-loading").hide() return; } else { /* complexdata ok to go */ sentData.complex_data = $('.complexdatainput').serialize() sentData.product_quantity = $('.complexdatainput[name="complexdata[URUNADEDI]"]').val() } } if ($('input[name="warehouseinput"]').length > 0) { let selectedWarehouse = $('input[name="warehouseinput"]:checked') if (!selectedWarehouse.val()) { _popMessage({ success: false, title: "İşlem gerçekleştirilemedi", message: "Seçiniz: DEPO", type: "warning" }) return; } if (selectedWarehouse.data('storage-quantity') < added_product_quantity) { _popMessage({ success: false, title: "İşlem gerçekleştirilemedi", message: "Lütfen daha az adet ürün giriniz", type: "warning" }) return; } sentData.warehouse = selectedWarehouse.val() } if ($('#addbasketbutton' + added_product_id).data('order-upload') > 0) { if ($('.qq-upload-list > li').length === 0) { _popMessage({ success: false, title: "Ürün sepete eklenemedi", message: 'Ürünü sepete ekleyebilmeniz için mutlaka imaj dosyası yüklemeniz gereklidir', type: "warning" }) $(".basket-modal .basket-popup-loading").hide() return; } else { sentData.order_upload_process_completed = 1; } } $(".basket-modal").show() $(".basket-modal .basket-popup-loading").show() $.ajax({ method: "POST", dataType: "JSON", url: "processnaked.php?p=jsonaction&action=addtocart", data: sentData, success: function (response) { try { if (response.success) { try { __refresh_quick_cart() } catch (e) { console.log('__refresh_quick_cart() not defined : quick_cart component not used in page layout') } inputOfButton.val(added_product_min_quantity) /* no need: _popMessage({ success: true, title: "Ürün Sepetinize Eklendi", message: response.message, type: "success" })*/ $(".basket-modal .basket-popup").hide() $(".basket-modal .basket-popup-success").show() } else { _popMessage({ success: false, title: "İşlem gerçekleştirilemedi", message: response.message, type: "warning" }) $(".modal").hide() } } catch (e) { $(".modal").hide() _popMessage({ success: false, title: "Hata Mesajı", message: e.message, type: "error" }) } }, complete: function () { $(".basket-modal .basket-popup-loading").hide() _runBatchAddCartOneStep() }, error: function (response) { console.log(response) Swal.fire("Hata Mesajı", "İşlem gerçekleştirilemedi : ajax fail", "error"); $(".basket-modal .basket-popup-loading").hide() $(".modal").hide() } }); } } } function _arrangeListingGridStyle() { try { let triggerIt = true; let savedGridStyle = localStorage.getItem("listingGridStyle") if (savedGridStyle) { if (listingGridStyle === savedGridStyle) triggerIt = false listingGridStyle = savedGridStyle; } if (listingGridStyle && triggerIt) { $('.' + listingGridStyle).trigger('click') } } catch (e) { console.log('grids arrange error:' + e.message) } } function _utilizeShowImageButtons() { $('.b2blist-show-image').unbind('click') $('.b2blist-show-image').click(function () { $('#product-image-modal').find('.product-image').attr('src', $(this).data('product-image1')) $('#product-image-modal').show() }); } function _utilizeProductLinkTargets() { $.each($('a'), function (ind, oneA) { if (oneA.hasAttribute("data-prodLoadParty") && $(oneA).attr("data-prodLoadParty") > 1) { $(oneA).attr('target', '_blank'); } }); } function _utilizeAddToCartButtons() { /* utilize addtobasket buttons , may need prodLoadParty */ $('.addbasketbuttonquantity').each(function () { let input = $(this).children('input'); const max = input.data('max'); const min = input.data('min'); const increment = input.data('increment') ?? 1; if (input.data('format') == 'float') { input.on('input', function (e) { $(this).val($(this).val().replace(/[^0-9.]/g, '')); }); } else { /* int */ input.on('input', function (e) { $(this).val($(this).val().replace(/[^0-9]/g, '')); }); } $(this).children('.minus').off('click').on('click', function () { let quantity; if (input.data('format') == 'float') { quantity = parseFloat(input.val()) } else { /* int */ quantity = parseInt(input.val()) } if (quantity > min) { input.val(quantity -= increment) } }) $(this).children('.plus').off('click').on('click', function () { let quantity; if (input.data('format') == 'float') { quantity = parseFloat(input.val()) } else { /* int */ quantity = parseInt(input.val()) } if (quantity < max) { input.val(quantity += increment) } }) }) $('.addbasketbutton').unbind('click') $('.addbasketbutton').click(function () { let addButtonItSelf = $(this) if (addButtonItSelf.data('order-upload')) { $('.basket-modal-product-name').html(addButtonItSelf.data('product-name')) $(".basket-modal").show() $(".basket-modal .basket-popup").hide() $(".basket-modal .basket-popup-order-upload").show() _utilizeAddToCartButtons(); } else if (addButtonItSelf.data('need-loading') || addButtonItSelf.data('need-variant-loading') || addButtonItSelf.data('need-complexdata-loading')) { if (addButtonItSelf.data('package-flag') > 0) { console.log('_parseAndProcessAddBasket-3 girecek') _parseAndProcessAddBasket(addButtonItSelf) } else { $('.basket-modal-product-name').html(addButtonItSelf.data('product-name')) $(".basket-modal").show() $(".basket-modal .basket-popup").hide() $(".basket-modal .basket-popup-loading").show() let stuffDrawn = false $('.basket-modal .mainVariantHTMLDiv').html(''); if (addButtonItSelf.data('has-variant')) { $(".basket-modal .basket-popup-select-variant").show() _drawVariantSelection(addButtonItSelf) stuffDrawn = true } $('.mainComplexDataHTMLDiv').html(''); if (addButtonItSelf.data('complexdata-id') > 0) { $(".basket-modal .basket-popup-select-complexdata").show() _drawComplexDataSelection(addButtonItSelf) stuffDrawn = true } if (!stuffDrawn) { console.log('_parseAndProcessAddBasket-2 girecek') _parseAndProcessAddBasket(addButtonItSelf) } } } else { console.log('_parseAndProcessAddBasket-1 girecek') _parseAndProcessAddBasket(addButtonItSelf) } }); let always_send_and_calculate = false; $('.variant-select-box').click(function () { let selected_product_id = parseInt($(this).data('variant-product-id')) if (selected_product_id > 0) { let send_and_calculate = false let post_variants = '' $.each(_selectorOfVariantEntities(selected_product_id), function () { always_send_and_calculate = always_send_and_calculate || $(`div[data-variant-product-id=${selected_product_id}] input[type=checkbox]:checked`).length > 0 let selectedAttrWord = $(this).data('variant-group') let selectedAttrValuesId = $(this).data('values-id') if ($(`input[name="attproduct_image1[${selectedAttrWord}][${selectedAttrValuesId}]"]`).val()) { for (let i = 1; i <= 5; i++) { let imgval = $(`input[name="attproduct_image${i}[${selectedAttrWord}][${selectedAttrValuesId}]"]`).val() if (i === 1) { $('.with-zoom').css('background-image', 'url(' + imgval + ')'); $('.with-zoom img').attr('src', imgval).attr('srcset', imgval + ' 2x').attr('data-usablesrc', imgval); } let tmp = $('.detail-photo-view .w-full').eq(i - 1) if (imgval) { tmp.attr('src', imgval).attr('srcset', imgval + ' 2x').attr('data-usablesrc', imgval).show(); } else { tmp.hide(); } } } else { _resetMainProdImages(); } if ($(`input[name=attribute_seperate_calculation${selectedAttrWord}]`).val()) { send_and_calculate = true; post_variants = post_variants + '&' + $(`input[name='product_attribute_template_id[]']`).serialize() + '&' + $(`span[data-values-id='${selectedAttrValuesId}']`).find('input').serialize() + `&attribute_${selectedAttrWord}[]=${selectedAttrValuesId}` } }); if (send_and_calculate || always_send_and_calculate) { let sentData = { product_id: selected_product_id, mass_variants: post_variants } console.log(sentData) $('.mainVariantHTMLDiv').addClass('secilemez') $.ajax({ method: "POST", dataType: "JSON", url: "processnaked.php?p=jsonajax&ajax=calculatevariantselection", data: sentData, success: function (response) { try { if (response.success) { displayed_price = response.calculated_product_price $('#divprice' + response.product_id + ' > .pric').html(response.calculated_product_price) $('#divpricenotax' + response.product_id + ' > .pric').html(response.calculated_product_price_without_tax) $('#divmarketprice' + response.product_id + ' > .pric').html(response.calculated_product_market_price) } else { console.log(response.message) } } catch (e) { console.log(e.message) } }, complete: function () { $('.mainVariantHTMLDiv').removeClass('secilemez') }, error: function (response) { console.log(response) } }); } } }); } function _addtobasketnotpermitted() { Swal.fire("Ürün sepete eklenemedi", "Bu işlemi yapmaya kullanıcı yetkiniz yoktur", "error"); } function _addtobasketrequireslogin(redirect) { Swal.fire({ title: 'Sepete Ekle', text: 'Üye girişi yapmadan bu işlemi gerçekleştiremezsiniz', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Üye Girişi', cancelButtonText: "İptal" }).then(function (result) { if (result.value) { window.location.href = redirect; } }); } function _openPopUpBannerModal() { $('.popupbanner-modal').show(); } function _personalDataContractOpenInModal() { $.ajax({ url: '/processnaked.php?p=jsonajax&ajax=getpersonalcontract', type: "GET", processData: false, contentType: false, dataType: "JSON", success: function (response) { console.log(response); if (response.success) { $('.mainContractHTMLDiv').html(response.html); } else { Swal.fire("İşlem gerçekleştirilemedi", response.html, "error"); } }, error: function (response) { Swal.fire("Hata Mesajı", "İşlem gerçekleştirilemedi (Err)", "error"); } }); $('.contract-modal, .contract-popup').show(); } function _utilizeInformButtons() { $('.favorite').unbind('click'); $('.favorite').click(function () { _productlisting_addfavorite($(this).attr('id')); }); $('.informcustomerbutton').unbind('click') $('.informcustomerbutton').click(function () { let informcustomertype = $(this).data('inform-type'); let informcustomerproductid = $(this).data('product-id'); let informcustomeremail = ''; Swal.fire({ title: "E-posta Adresiniz", html: `
    `, showCancelButton: true, confirmButtonText: 'Tamam', cancelButtonText: "İptal", showLoaderOnConfirm: true, focusConfirm: false, preConfirm: () => { const email = Swal.getPopup().querySelector('#email').value const personaldata_sozlesme = Swal.getPopup().querySelector('#personaldata-sozlesme').checked if (!email) { Swal.showValidationMessage(`Lütfen geçerli bir e-posta adresi girin`) } else if (!personaldata_sozlesme) { Swal.showValidationMessage(`Lütfen KVKK sözleşmesini okuyup kabul ettiğinize dair olan kutucuğu işaretleyiniz`) } else { return fetch(_sendinformData(email, informcustomertype, informcustomerproductid)) .then(response => { if (!response.ok) { throw new Error(response.statusText) } }) } } }).then((result) => { if (result.isConfirmed) { Swal.fire({ title: result.message }) } }) $('#personaldatacontractbutton').click(function () { _personalDataContractOpenInModal() }); }); } function _sendinformData(informcustomeremail, informcustomertype, informcustomerproductid) { $.ajax({ url: 'processnaked.php?p=jsonaction&action=informcustomer&pid=' + informcustomerproductid + '&informcustomertype=' + informcustomertype + '&informcustomeremail=' + informcustomeremail, type: "GET", dataType: "JSON", success: function (response) { if (response.success) { Swal.fire("Teşekkürler", response.message, "success"); } else { Swal.fire("İşlem gerçekleştirilemedi", response.message, "error"); } }, error: function (response) { Swal.fire("Hata Mesajı", "İşlem gerçekleştirilemedi (Err)", "error"); } }); } function _prepareAllDrawnProducts() { _arrangeListingGridStyle() _utilizeAddToCartButtons() _utilizeInformButtons() _utilizeShowImageButtons() _utilizeProductLinkTargets() $('.addedtomaindivselector').show() } function _utilizeComplexDataInputs() { $('.complexdatainput').change(function () { let emptycheck = false; let leftemptytitle = ''; $(".complexdatainput").each(function () { if (!$(this).data('not-mandatory')) { if (!emptycheck && !$(this).val()) { console.log('Boş?:' + $(this).val() + ',html:' + $(this).html()) emptycheck = true; leftemptytitle = $(this).parent().find('.complexdatatitle').html(); console.log('leftemptytitle:' + leftemptytitle) } } }) if (emptycheck) { let message = `Lütfen gerekli alanları tam doldurunuz : ${leftemptytitle}`; $('#complexdata-calculated-results-ready, #complexdata-calculated-results-notcompleted').hide() $('#complexdata-calculated-results-error').show() $('#complexdata-calculated-results-error').html(message) $('#complexdata_calculation_message').val(message) console.log('still empty fields') return; } if (startComplexData_trigger) { console.log('startComplexData_trigger wont start') return; } startComplexData_trigger = true; $('.addbasketbutton').addClass('secilemez') $('.mainComplexDataHTMLDiv').addClass('secilemez') setTimeout(function () { let formData = $('.complexdatainput').serialize() + '&lang_id=0'; $.ajax({ type: "POST", dataType: "JSON", url: "processnaked.php?p=jsonajax&ajax=calculatecomplexdataformula", data: formData, success: function (response) { if (response.success) { $('#complexdata-calculated-results-ready').show() $('#complexdata-calculated-results-notcompleted, #complexdata-calculated-results-error').hide() $('#complexdata-calculated-price').html(response.data.complex_data_new_price) $('#complexdata-calculated-quantity').html(response.data.complex_data_new_quantity + ' ' + response.data.product_unit_name) $('#complexdata_calculation_message').val('') } else { $('#complexdata-calculated-results-ready, #complexdata-calculated-results-notcompleted').hide() $('#complexdata-calculated-results-error').show() $('#complexdata-calculated-results-error').html(response.message) $('#complexdata_calculation_message').val(response.message) } }, error: function (jq, status, message) { $('#complexdata-calculated-results-ready, #complexdata-calculated-results-notcompleted').hide() $('#complexdata-calculated-results-error').show() $('#complexdata_calculation_message').val('Lütfen bilgileri kontrol edip bir daha deneyiniz : ' + $('#complexdata_name').html()) console.log(status + ' : ' + message) }, complete: function () { startComplexData_trigger = false; $('.mainComplexDataHTMLDiv').removeClass('secilemez') $('.addbasketbutton').removeClass('secilemez') } }) }, complexdatadelay_trigger); }); $('.complexdatadoubleparent').change(function () { $('.complexdatadoublesub[data-parentname="' + $(this).data('variable') + '"]').hide(); $('.complexdatadoublesub[data-parentname="' + $(this).data('variable') + '"][data-parentid="' + $(this).val() + '"]').show(); }); } function _utilizeProductUnitSelectors() { $('.product-unit-selector').click(function () { let clicked_unit = $(this).data('unit-key') if (clicked_unit) { let added_product_id = $(this).data('pid') $(`#selected-unit-${added_product_id}`).val(clicked_unit) try { let new_prices = ps_otherUnitPrices[clicked_unit] console.log(`.divprice[data-pid="${added_product_id}"][data-ptype="price"] > .pric`) console.log(clicked_unit) console.log(new_prices) $(`.divunit[data-pid="${added_product_id}"]`).html(ps_otherUnits[clicked_unit]) $(`.divprice[data-pid="${added_product_id}"][data-ptype="price"] > .pric`).html(new_prices.product_discount_price) $(`.divprice[data-pid="${added_product_id}"][data-ptype="pricenet"] > .pric`).html(new_prices.product_price_foreign) $(`.divprice[data-pid="${added_product_id}"][data-ptype="pricenotax"] > .pric`).html(new_prices.product_discount_price_without_tax) $(`.divprice[data-pid="${added_product_id}"][data-ptype="pricemoneyorder"] > .pric`).html(new_prices.product_discount_price_money_order) $(`.divprice[data-pid="${added_product_id}"][data-ptype="marketprice"] > .pric`).html(new_prices.product_market_price) $(`.divprice[data-pid="${added_product_id}"][data-ptype="normalprice"] > .pric`).html(new_prices.product_price_foreign) $(`.divprice[data-pid="${added_product_id}"][data-ptype="normalpricenotax"] > .pric`).html(new_prices.product_price_without_tax_foreign) $(`.divprice[data-pid="${added_product_id}"][data-ptype="pricenodiscountnotax"] > .pric`).html(new_prices.product_price_without_tax) } catch (e) { console.log(e.message) } } }) } -->