- Pagina inicial
- /
- Hot tub filters
`; jQuery("#usstore-products").append(html_); jQuery("#s-sidebar-filter").html(""); return; } var requestData = { q: query, node_id: node_id, page: page, brand: brand, ufulfilled: ufulfilled, price_range: price_range, sort_by: sort_by, s_id: '117', lang: lang, dc: dc, search_type: search_type, skus:all_products_sku, store:ubuy_store, csrf_token:csrftoken_search }; requestData = Object.assign(requestData, custom_filters); // requst_base64 = window.btoa(JSON.stringify(requestData)); ajaxRequest = jQuery.ajax({ type: "GET", dataType: "html", data: requestData, // data: {"req":requst_base64}, headers: { 'Cache-Control': 'max-age=10' }, url: esonesearch_url + "?ubuy=" + ubuy + "&docType="+ubuyType, success: function (response,textStatus,jqXHR) { if(jqXHR.status == 204 || jqXHR.status == 203){ window.location = window.location.href; } load_time = 1; if (blank == "1") { return false; } if (isValidHttpUrl(response)) { location.href = response; return false; } removeAECTProduct(); jQuery("#usstore-products").append(response); jQuery(".no-product").removeClass('d-none'); jQuery('#usstore-products').css("display", "none"); jQuery('#usstore-products').fadeIn(); if (typeof productListPagination !== 'undefined') { jQuery("#product-list-pagination").html(productListPagination); } else { jQuery("#product-list-pagination").html(''); } var all_brands = jQuery("#all_brands").val(); var all_categories = jQuery("#all_categories").val(); var total_es_products = jQuery("#es_products_count").val(); if (total_es_products >=1) { getFiltersForUsStore(all_brands, all_categories, query); } else{ jQuery(".loader-spin").hide(); } if (total_es_products == 0) { new_loader = 1; jQuery(".new_loader").show(); } console.log("total_es_products==="+total_es_products); console.log("es_filter_status==="+es_filter_status); var all_skus = jQuery("#all_skus").val(); //checkallimages(all_skus); if(total_es_products <= 8){ filter_type = "sc"; getFirstScrapping(); } if (hasUbuyCategoryTopProduct() == false) { showLoaderImageAbs(); } else { scrapping_no++; showDotLoader(); } changeCurrentUrl(); no_items = true; product_unique_arr = []; stickySearchFilter("#usstore-product-block-section"); isComplete = (isLoadEmpty(response) == false) ? true : false; isComplete = jQuery(".item-view").length == 0 ? false : true; /*===========*/ moniterPageScroll("us", isComplete); //not in use /*===========*/ if (brand !== "") { topBrands(); } hideLoaderImageAbs(); document.getElementsByTagName('main')[0].scrollTo(0,0); if (customer_id != "") { updatewishlist(); } }, error: function (jqXHR, textStatus, errorThrown) { //redirectToScrap(); getFirstScrapping(); }, //timeout: 20000 }); } function getFirstScrapping(){ var current_store = ""; if(ubuy_store == "us"){ current_store = "usstore"; } else if(ubuy_store == "
uk"){ current_store = "ukstore"; } else if(ubuy_store == "eu"){ current_store = "destore"; } else if(ubuy_store == "in"){ current_store = "instore"; } else if(ubuy_store == "ch"){ current_store = "jd"; } else if(ubuy_store == "hk"){ current_store = "china"; } else if(ubuy_store == "kr"){ current_store = "gmarket"; } else if(ubuy_store == "jp"){ current_store = "jpstore"; } else if(ubuy_store == "tr"){ current_store = "trendyol"; } if(current_store){ getProductAppendData(current_store); } } function showNoRecord(){ // if(jQuery(".product-inner-list").length == 0){ // jQuery(".search-result-text").addClass("d-none"); // jQuery("#s-sidebar-filter").addClass("d-none"); // jQuery("#usstore-products").hide(); // jQuery("#no-product-screen").removeClass("d-none"); // jQuery("#no-product-screen").css('display','block'); // } if(jQuery(".product-inner-list").length == 0){ jQuery(".new_loader").hide(); jQuery("#dot-loader").hide(); jQuery(".no-product").show(); jQuery(".search-result-text").addClass("d-none"); jQuery("#s-sidebar-filter").addClass("d-none"); jQuery("#usstore-products").hide(); jQuery("#no-product-screen").removeClass("d-none"); jQuery("#no-product-screen").css('display','block'); }else{ } } function callNextScrappingStore(){ next_call_status = 0; if (isUsstore == false) { getProductAppendData("usstore"); } else if (isMart == false) { getProductAppendData("mart"); } else if (isUsed == false) { getProductAppendData("used"); } else if (isTarget == false) { getProductAppendData("target"); } else if (isGShopping == false) { getProductAppendData("gshopping"); } else if (isHomeDepot == false) { getProductAppendData("homedepot"); } else if (isUkstore == false) { getProductAppendData("ukstore"); } else if (isDedr == false) { getProductAppendData("dedr"); } else if (isUsedde == false) { getProductAppendData("usedde"); } else if (isDestore == false) { getProductAppendData("destore"); } else if (isInstore == false) { getProductAppendData("instore"); } else if (isInny == false) { getProductAppendData("inny"); } else if (isInfl == false) { getProductAppendData("infl"); } else if (isInsp == false) { getProductAppendData("insp"); } else if (isInaj == false) { getProductAppendData("inaj"); } else if (isUseduk == false) { getProductAppendData("useduk"); } else if (isAsos == false) { getProductAppendData("asos"); } else if (isArgos == false) { getProductAppendData("argos"); } else if (isZland == false) { getProductAppendData("zlnduk"); } else if (isJd == false) { getProductAppendData("jd"); } else if (isJdajax == false) { getProductAppendData("jdajax"); } else if (isYou163 == false) { getProductAppendData("you163"); } else if (isTaobao == false) { getProductAppendData("taobao"); } else if (isJpstore == false) { getProductAppendData("jpstore"); } else if (isUsedjp == false) { getProductAppendData("usedjp"); } else if (isJpzen == false) { getProductAppendData("jpzen"); } else if (isJpstore == false) { getProductAppendData("jpfr"); } else if (isChina == false) { getProductAppendData("china"); } else if (isGmarket == false) { getProductAppendData("gmarket"); } else if (isTrendyol == false) { getProductAppendData("trendyol"); } if(next_call_status == 0){ showNoRecord(); } } function getShowMoreActive(){ show_more = []; jQuery('.view_more.minus').each(function(){ show_more.push(jQuery(this).attr('data-type')); }) return show_more; } function setShowMoreActive(){ jQuery.each(show_more,function(k,a){ showMoreFilter(jQuery('.view_more[data-type='+a+']')); }); } function showCatChild(elm,datalevel,parentnode){ // var parnet_node = jQuery(elm).attr('data-id'); var parentElm = jQuery(elm).closest('[data-level_val='+datalevel+']'); var nextSiblings = parentElm.siblings('[data-parentnode='+parentnode+']'); var icon = jQuery(elm).find('i'); if(parentElm.hasClass('shown')){ nextSiblings.addClass('d-none'); icon.addClass("fa-chevron-right").removeClass('fa-chevron-down'); parentElm.removeClass('shown'); jQuery.each(nextSiblings,function(){ if(jQuery(this).hasClass('shown')){ // also close the
child categories var nextSibling = jQuery(this); var nextelm = nextSibling.find('.togglecat_subcat'); var nextParentNodeId= nextSibling.find('.filter-category-checkbox').attr('data-id'); var nextdatalevel = nextSibling.attr('data-level_val'); showCatChild(nextelm,nextdatalevel,nextParentNodeId); } }); }else{ nextSiblings.removeClass('d-none'); icon.addClass("fa-chevron-down").removeClass('fa-chevron-right'); parentElm.addClass('shown'); } return false; } function getFiltersForUsStore(all_brands, all_categories, query,is_scrap=false) { getShowMoreActive(); if (ubuy_store == "hk" || ubuy_store == "ch") { jQuery(".desktop-filter-sort-by").hide(); jQuery(".sort_by_mobile_div").hide(); } if (ubuy_store == "hk" || ubuy_store == "kr") { jQuery("#s-sidebar-filter").html(""); showClearAllFilter(); setShowMoreActive(); showActiveParentCategory(); showInterlinkingFooter(); return ""; } var search_type = '' var request_type = 'GET' if(is_scrap==false){ request_type = 'GET' all_brands=[] all_categories=[] } if (is_brand_search) { search_type = 'brand'; } if (is_cat_search) { search_type = 'category'; } if (ubuy_store == "tr") { request_type = 'POST'; } var csrftoken_search = '036e7fb28ea7cf8ee3ef98cb151f586dsearch'; var requestData = { q: query, node_id: node_id, brand: brand, ufulfilled: ufulfilled, price_range: price_range, all_brands: all_brands, all_categories: all_categories, s_id: '117', search_type:search_type, filter_type: filter_type, is_scrap: is_scrap, lang: lang, store:ubuy_store, csrf_token:csrftoken_search } requestData = Object.assign(requestData, custom_filters); requst_base64 = window.btoa(JSON.stringify(requestData)); if (ubuy_store == "tr") { requestData = {"req":requst_base64}; } ajaxFilterRequest = jQuery.ajax({ type: request_type, data: requestData, // data: {"req":requst_base64}, url: esonesearch_filter_url + "?ubuy=" + ubuy, dataType: "html", beforeSend:function(){ abortPreviousAjaxFilterRequest(); }, success: function (response) { jQuery("#s-sidebar-filter").html(response); es_filter_status = jQuery("#es_filter_status").val(); showClearAllFilter(); setShowMoreActive(); showActiveParentCategory(); showInterlinkingFooter(); } }); } function showInterlinkingFooter() { var brands = jQuery("#bjson").val(); var categories = jQuery("#cjson").val(); jQuery.ajax({ type: "POST", data: { all_brands: brands, all_categories: categories, lang: lang, searchqtr: "Hot%20tub%20filters", is_brand_url: is_brand_url, is_category_url: is_category_url }, url: interlink_url, dataType: "html", success: function (resp) { jQuery("#bottom-filter-brands").html(resp); } }); } /*===== Store Function Start======*/ function showActiveParentCategory(){ if(jQuery(".list-group-item").length < 5){ jQuery(".list-group-item").each(function (index, value) { jQuery(this).find("i").removeClass("fa-chevron-right"); jQuery(this).find("i").addClass("fa-chevron-down"); }); jQuery(".list-group-item").removeClass("d-none"); jQuery(".list-group-item").addClass("shown"); } } function resetSingleStorePageScroll(current) { if (current == "usstore") { isUsstore = true; } else if (current == "mart") { isMart = true; } else if (current == "used") { isUsed = true; } else if (current == "target") { isTarget = true; } else if (current == "samsclub") { isSamsclub = true; } else if (current == "gshopping") { isGShopping = true; } else if (current == "homedepot") { isHomeDepot = true; } else if (current == "ukstore") { isUkstore = true; } else if (current == "destore") { isDestore = true; } else if (current == "instore") { isInstore = true; } else if (current == "inny") { isInny = true; } else if (current == "infl") { isInfl = true; } else if (current == "insp") { isInsp = true; } else if (current == "inaj") { isInaj = true; } else if (current == "dedr") { isDedr = true; } else if (current == "usedde") { isUsedde = true; } else if (current == "argos") { isArgos = true; } else if (current == "useduk") { isUseduk = true; } else if (current == "asos") { isAsos = true; } else if (current == "zlnduk") { isZland = true; } else if(current == "jd"){ isJd = true; } else if(current == "jdajax"){ isJdajax = true; } else if(current == "you163"){ isYou163 = true; } else if(current == "taobao"){ isTaobao = true; } else if(current == "jpstore"){ isJpstore = true; } else if(current == "usedjp"){ isUsedjp = true; } else if(current == "jpzen"){ isJpzen = true; } else if(current == "jpfr"){ isJpfr = true; } else if(current == "china"){ isChina = true; } else if(current == "gmarket"){ isGmarket = true; } else if(current == "trendyol"){ isTrendyol = true; } } function getProductAppendData(next_store) { console.log("append request==="+next_store); resetSingleStorePageScroll(next_store); next_call_status = 1; all_products_sku = jQuery("#all_skus").val(); var query = q; s_node_id=node_id; if (node_id && ubuy_store == "us" || ubuy_store == "in" || ubuy_store == "tr" || ubuy_store == "eu" || ubuy_store == "ch" ) { // query = ""; }else{ s_node_id = ""; } if (jQuery('input[name=ufulfilled]:checked').length > 0) { ufulfilled = 1; } var price_range_selected = jQuery('input[name=price_usstore]:checked').val(); if (typeof price_range_selected !== typeof undefined) { price_range = price_range_selected; } checkajaxrequest(); if (new_loader == 0) { scrapping_no++; showDotLoader(); } var csrftoken_search = '036e7fb28ea7cf8ee3ef98cb151f586dsearch'; var search_type = ''; if (is_brand_search && ubuy_store == "us") { search_type = 'brand'; } if (is_cat_search) { search_type = 'category'; } var total_es_products = jQuery("#es_products_count").val(); var total_products_fetched = jQuery(".product-inner-list").length; next_append_request = 1; var brand_request = brand; var brand_selected = []; var brand_exist = 0; jQuery("input[name='brand']:checked").each(function() { brand_exist = 1; var value = jQuery(this).attr("data-name"); console.log("selected brand name: "+ value); value = value.replace(" ", "+"); brand_selected.push(value); }); if(brand_exist == 1){ brand_request = brand_selected.join('|'); } //} var search_type_append_request = search_type; //search_type_append_request = ""; if(next_store == "china" && brand_request != "" ){ query = brand_request; brand_request = ""; } var requestData = { q: query, node_id: s_node_id, page: page, brand: brand_request, ufulfilled: ufulfilled, price_range: price_range, sort_by: sort_by, s_id: '117', lang: lang, dc: dc, search_type: search_type_append_request, skus:all_products_sku, next_store:next_store, is_scrap:1, es_count:total_es_products, store:ubuy_store, total_fetched:total_products_fetched, es_filter_status:es_filter_status, csrf_token:csrftoken_search }; requestData = Object.assign(requestData, custom_filters); requst_base64 = window.btoa(JSON.stringify(requestData)); ajaxRequest = jQuery.ajax({ type: "GET", headers: { 'Cache-Control': 'max-age=10' }, data: requestData, // data: {"req":requst_base64}, url: esonesearch_url + "?ubuy=" + ubuy, dataType: "html", success: function(response,textStatus,jqXHR) { if(jqXHR.status == 204 || jqXHR.status == 203){ window.location = window.location.href; } //jQuery("#all_skus").remove(); if ((next_store == "instore" || next_store == "trendyol" || next_store == "destore" || next_store == "gmarket") && page == 1 ) { removeAECTProduct(); } if(ubuy_store == "hk" || ubuy_store == "eu" || ubuy_store == "in" || ubuy_store == "tr" || ubuy_store == "kr" ){ var data_con = getStringBetween(response, "scrap_products_count", " />") data_con = data_con.match(/\d+/g); data_con = data_con.map(Number); if (scrapping_status == false) { removeAECTProduct(); } if (data_con > 0 ) { scrapping_status = true; } hideLoaderImageAbs(); showClearAllFilter(); } if ((next_store == "usstore" || next_store == "jpstore" || next_store == "ukstore") && (total_es_products == 'undefined' || total_es_products == 0) ) { removeAECTProduct(); } jQuery("#usstore-products").append(response); total_sc_pro_len = $('.catalog-v2-tpl-append').length; if( scraping_banner_status && scraping_banner != "" && total_sc_pro_len > 12 ){ $(".catalog-v2-tpl-append").eq(11).after(scraping_banner); scraping_banner_status = false; } if( scraping_banner_2_status && scraping_banner_2 != "" && total_sc_pro_len > 36 ){ $(".catalog-v2-tpl-append").eq(35).after(scraping_banner_2); scraping_banner_2_status = false; } next_append_request = 0; var s_result_count = jQuery("#scrap_products_count_"+next_store).val(); if(s_result_count > 0 && total_es_products > 0){ jQuery("#new_release_products_display_title").removeClass("d-none"); } if (s_result_count > 0 || total_es_products > 0 ) { new_loader == 0 jQuery(".new_loader").hide(); } console.log(mainStores.indexOf(next_store)); console.log(total_es_products + "total_es_products"); console.log(s_result_count + "s_result_count 2024"); console.log(next_store + "next_store 2024"); if(mainStores.indexOf(next_store) >= 0 && (typeof total_es_products=='undefined' || isNaN(total_es_products) || parseInt(total_es_products)<=0 /*|| es_filter_status <= 0*/)){ var all_brands = jQuery("#all_brands_sc").val(); var all_categories = jQuery("#all_categories_sc").val(); var has_brandfilter = jQuery('.es-brand-filter').length; var has_catfilter = jQuery('.es-category-filter').length; if (has_catfilter==0 && has_brandfilter==0 ) { console.log("scrapping filter called") console.log(has_catfilter+" "+has_brandfilter) getFiltersForUsStore(all_brands, all_categories, query,true); } } isComplete = (isLoadEmpty(response) == false) ? true : false; if( s_result_count == 0 && ( next_store == 'usstore' || next_store == 'ukstore' || next_store == 'jpstore') ){ jQuery(".loader-spin").hide(); jQuery(".loadmore-bt").hide(); } var count_id = jQuery("#scrap_products_count_"+next_store).val(); if(count_id == 0){ callNextScrappingStore(); } moniterPageScroll(next_store, isComplete); if(jQuery(".loadmore-bt").length){ jQuery(".loadmore-bt").prop('disabled', false); jQuery(".loadmore-bt").html('Load More'); } if(jQuery(".see-translation").length>1){ jQuery(".see-translation").last().
parent().remove(); } }, error: function(jqXHR, textStatus, errorThrown) { isComplete = false; next_append_request = 0 moniterPageScroll(next_store, isComplete); } }); /* here we get next store data from scrap request*/ } function getInsertData(scrap_products_arr) { requestData = { data: scrap_products_arr, } ajaxRequest = jQuery.ajax({ type: "POST", headers: { 'Cache-Control': 'max-age=10' }, data: requestData, url: temp_bulk_url + "?ubuy=" + ubuy, success: function(response,textStatus,jqXHR) { console.log(response) }, error: function(jqXHR, textStatus, errorThrown) { isComplete = false; next_append_request = 0 moniterPageScroll(next_store, isComplete); } }); } function getStringBetween(originalString, startString, endString) { var startIndex = originalString.indexOf(startString); if (startIndex === -1) { return ""; } var endIndex = originalString.indexOf(endString, startIndex + startString.length); if (endIndex === -1) { return ""; } return originalString.substring(startIndex + startString.length, endIndex); } function getLastStore(){ var last_store = ""; switch(ubuy_store) { case "us": last_store = "target" break; case "uk": last_store = "zlnduk" break; case "ch": last_store = "taobao" break; case "hk": last_store = "china" break; case "kr": last_store = "gmarket" break; case "jp": last_store = "jpfr" break; case "tr": last_store = "trendyol" break; case "eu": last_store = "dedr" break; case "in": last_store = "inaj" break; default: // code block } return last_store; } function moniterPageScroll(current, isComplete) { /**/ if(next_append_request == 1){ return false; } scrapping_no_hide++; //"gshopping", /* "lyst", */ "gap", let whatNext = ["usstore","mart","used","target","gshopping","homedepot","ukstore","destore","inny","infl","insp","inaj","instore","dedr","usedde","argos","zlnduk","asos","jd","jdajax","taobao","you163","jpstore","usedjp","jpzen","jpfr","china","gmarket","trendyol"]; if (scrapping_no == scrapping_no_hide) { hideDotLoader(); }else{ var dot_src = $('.dot-loader-image').attr('src'); console.log(dot_src) $('.dot-loader-image').attr('src', dot_src+'?time_=1719035949'); } let last = getLastStore(); hideLoaderImageAbs(); if (product_unique_arr.length > 0 && current != "china") { let noProductElement = document.querySelector("div.no-product"); if (noProductElement) { noProductElement.remove(); } } console.log("current " + current + " last " + last ); /*remove filter*/ if (current == last && jQuery(".product-outer-list").length == 0) { jQuery(".no-product").removeClass('d-none'); let noFilterElement = document.querySelector("div#aside"); if (noFilterElement) { noFilterElement.remove(); } let noSortElement = document.querySelector(".search_sorting"); if (noSortElement) { noSortElement.remove(); } let storeElement = document.querySelector("div#store"); // storeElement.classList.remove("col-md-9"); // storeElement.classList.add("col-md-12"); let noProductElement = document.querySelector("div.no-product"); jQuery("#search-result-title").remove(); } else { jQuery(window).on('scroll', function () { if (isScrollReachToElement(jQuery('#load-other-store'))) { console.log("isDedr==="+isDedr) if (isUsstore == false) { getProductAppendData("usstore"); } else if (isMart == false) { getProductAppendData("mart"); } else if (isUsed == false) { getProductAppendData("used"); } else if (isTarget == false) { getProductAppendData("target"); } else if (isGShopping == false) { getProductAppendData("gshopping"); } else if (isHomeDepot == false) { getProductAppendData("homedepot"); } else if (isUkstore == false) { getProductAppendData("ukstore"); } else if (isDestore == false) { getProductAppendData("destore"); } else if (isInstore == false) { getProductAppendData("instore"); } else if (isInny == false) { getProductAppendData("inny"); } else if (isInfl == false) { getProductAppendData("infl"); } else if (isInsp == false) { getProductAppendData("insp"); } else if (isInaj == false) { getProductAppendData("inaj"); } else if (isUsedde == false) { getProductAppendData("usedde"); } else if (isDedr == false) { getProductAppendData("dedr"); } else if (isUseduk == false) { getProductAppendData("useduk"); } else if (isAsos == false) { getProductAppendData("asos"); } else if (isZland == false) { getProductAppendData("zlnduk"); } else if (isArgos == false) { getProductAppendData("argos"); } else if (isJd == false) { getProductAppendData("jd"); } else if (isJdajax == false) { getProductAppendData("jdajax"); } else if (isYou163 == false) { getProductAppendData("you163"); } else if (isTaobao == false) { getProductAppendData("taobao"); } else if (isJpstore == false) { getProductAppendData("jpstore"); } else if (isUsedjp == false) { getProductAppendData("usedjp"); } else if (isJpzen == false) { getProductAppendData("jpzen"); } else if (isJpfr == false) { getProductAppendData("jpfr"); } else if (isChina == false) { getProductAppendData("china"); } else if (isGmarket == false) { getProductAppendData("gmarket"); } else if (isTrendyol == false) { getProductAppendData("trendyol"); } } }); } mobileFilterSticky(); } function resetPageScroll() { product_unique_arr = []; isUsstore = isMart = isUsed = isGShopping = isTarget = isHomeDepot = true; isUkstore = isUseduk = isAsos = isArgos = true; isJd = isJdajax = isYou163 = true; isJpstore = isUsedjp = isJpzen = isJpfr = true; isGmarket = true; isChina = true; isTrendyol = true; switch(ubuy_store) { case "us": isUsstore = isMart = isUsed = isGShopping = isTarget = isHomeDepot = false; //isTarget = true; isGShopping = true; isHomeDepot = true; break; case "uk": isUkstore = isUseduk = isAsos = isArgos = isZland = false; break; case "eu": isDestore = isDedr = false; break; case "in": isInstore = isInny = isInfl = isInsp = isInaj = false; break; case "ch": isJd = isJdajax = isYou163 = false; break; case "hk": isChina = false; break; case "kr": isGmarket = false; break; case "jp": isJpstore = isUsedjp = isJpzen = isJpfr = false; break; case "tr": isTrendyol = false; break; default: } } function hasUbuyCategoryTopProduct() { if (jQuery('.ubuycat-list').length > 0) { return (jQuery('.ubuycat-list').css('display') == 'none') ? false : true; } return false; } function isScrollReachToElement(elm, eval) { eval = eval || "object visible"; var viewportHeight = jQuery(window).height(), scrolltop = jQuery(window).scrollTop(), y = jQuery(elm).offset().top - 100, elementHeight = jQuery(elm).height(); if (eval == "object visible") return ((y < (viewportHeight + scrolltop)) && (y > (scrolltop - elementHeight))); if (eval == "above") return ((y < (viewportHeight + scrolltop))); } /*===== Store Function End=======*/ // function hasUbuyCategoryTopProduct() { // if (jQuery('.ubuycat-list').length > 0) { // return (jQuery('.ubuycat-list').css('display') == 'none') ? false : true; // } // return false; // } function hideUbuyCategoryTopProduct() { jQuery('.ubuycat-list').hide(); } function showUbuyCategoryTopProduct() { jQuery('.ubuycat-list').show(); } function removeAECTProduct() { jQuery("#usstore-products").
children().not('.ubuycat-list').remove(); } function setSortByFilterText() { jQuery(".sort-by-item").removeClass("active"); jQuery(".sort-by-item").each(function (index, value) { var sort_by_item = jQuery(this).attr('data-value'); if (sort_by_item == sort_by) { var sort_by_item = jQuery(this).text(); sort_by_text = sort_by_item; jQuery(this).addClass("active"); jQuery("#sort-by-button").html(sort_by_item); return false; } if (sort_by == "") { jQuery(".sort-by-item:first").addClass("active"); } }); } function loadMoreData(){ abortPreviousAjaxRequest(); page = jQuery(".loadmore-bt").data("currentpage"); jQuery(".loadmore-bt").prop('disabled', true); jQuery(".loadmore-bt").html('Load More
'); page++; if(page>=totalPageCustom){ jQuery(".loadmore-bt").hide(); } resetPageScroll(); getFirstScrapping(); //getProductAppendData("usstore"); } setSortByFilterText(); jQuery(document).ready(function () { jQuery(document).on("click", "#usstore-filter-button", function () { abortPreviousAjaxRequest(); page = 1; hideUbuyCategoryTopProduct(); getProductsForStore(); }); jQuery(document).on("click", "a[data-toggle='page-usstore']", function () { abortPreviousAjaxRequest(); page = jQuery(this).data("pageno"); if (page == 1) { showUbuyCategoryTopProduct() } else { hideUbuyCategoryTopProduct(); } getProductsForStore(); jQuery('html,body').animate({ scrollTop: 0 }, 0); }); jQuery(document).on("click", "button[data-toggle='page-usstore']", function () { abortPreviousAjaxRequest(); page = jQuery(this).data("pageno"); if (page == 1) { showUbuyCategoryTopProduct() } else { hideUbuyCategoryTopProduct(); } getProductsForStore(); jQuery('html,body').animate({ scrollTop: 0 }, 0); }); jQuery(document).on("click", "a[data-toggle='locale']", function () { abortPreviousAjaxRequest(); lang = jQuery(this).data("code"); hideUbuyCategoryTopProduct(); getProductsForStore(); jQuery('html,body').animate({ scrollTop: 0 }, 0); }); jQuery(document).on("click", ".sort-by-item", function () { sort_by_text = jQuery(this).text(); jQuery("#sort-by-button").html(sort_by_text); abortPreviousAjaxRequest(); page = 1; var sort_text = jQuery(this).attr("data-value"); if (sort_by != sort_text) { sort_by = sort_text; } else { return false; } hideUbuyCategoryTopProduct(); getProductsForStore(); showClearAllFilter(); setSortByFilterText(); }); jQuery(document).on("change", "#usstore_sm_sort_by", function () { abortPreviousAjaxRequest(); page = 1; sort_by = jQuery(this).val(); hideUbuyCategoryTopProduct(); getProductsForStore(); setSortByFilterText(); showClearAllFilter(); }); // new UI for category filter jQuery(document).on("click", ".category-filter button", function() { page = 1; abortPreviousAjaxRequest(); if (!is_cat_search) { category_status = 1; } node_id = jQuery(this).attr("data-id"); node_name = jQuery(this).attr("title"); getProductsForStore(); }); /*Category Filter*/ /*jQuery(document).on("click", ".filter-category-checkbox", function () { page = 1; abortPreviousAjaxRequest(); if (!is_cat_search) { category_status = 1; } node_id = jQuery(this).attr("data-id"); getProductsForStore(); });*/ /*Brand Filter*/ jQuery(document).on("click", 'input[name=brand]', function () { page = 1; brand = ""; abortPreviousAjaxRequest(); var brand_selected = getCheckedBoxes("brand"); if (brand_selected) { brand = brand_selected.join('|'); } brand_status = 1; getProductsForStore(); }); /*Fast delivery*/ jQuery(document).on("click", 'input[name=ufulfilled]', function () { page = 1; abortPreviousAjaxRequest(); ufulfilled = ""; if (jQuery('input[name=ufulfilled]:checked').length > 0) { ufulfilled = 1; } getProductsForStore(); }); /*Fast delivery*/ jQuery(document).on("change", 'input[name=price_usstore]', function () { page = 1; abortPreviousAjaxRequest(); var price_range_selected = jQuery('input[name=price_usstore]:checked').val(); if (typeof price_range_selected !== typeof undefined) { price_range = price_range_selected; } getProductsForStore(); }); // jQuery(document).on("change", 'input[name=price_usstore]', function () { // page = 1; // abortPreviousAjaxRequest(); // var price_range_selected = jQuery('input[name=price_usstore]:checked').val(); // if (typeof price_range_selected !== typeof undefined) { // price_range = price_range_selected; // } // getProductsForStore(); // }); /*custom filters*/ jQuery(document).on("change", '.custom_filters', function () { page = 1; abortPreviousAjaxRequest(); selectCustomFilters(); getProductsForStore(); }); jQuery('body').on('keyup input', '.brand-search-input.filter-search-input,.custom-filter-search-input', function (e) { var $this = jQuery(this); var filter_search_keword = $this.val(); filter_search_keword = jQuery.trim(filter_search_keword); var filter_parent_div = $this.closest(".checkbox-filter"); var filter_div = filter_parent_div.find(".input-checkbox"); if (filter_search_keword == "") { jQuery(filter_div).each(function (index) { jQuery(this).removeClass("hide_li"); }); } }); jQuery(document).on("click", ".remove-user-selection[data-type='brand']",function () { var currentItem = jQuery(this); var current_selection_value = decode_data(jQuery(this).attr("data-value")); var current_selection_type = jQuery(this).attr("data-type"); var brand_exist = 0; jQuery("input[name=" + current_selection_type + "]:checked").each(function () { if(jQuery(this).val() == current_selection_value){ brand_exist = 1; if (jQuery(this).prop("checked") == true) { jQuery(this).click(); } currentItem.parent().remove(); } }); if(brand_exist == 0 && jQuery("input[name=" + current_selection_type + "]:checked").length == 0){ currentItem.parent().remove(); brand = ""; getProductsForStore(); } }); getProductsForStore(); }); function makeClearAllFilters(brandNamesArr, filter_type) { var stringBrands = ''; if (brandNamesArr != null) { jQuery("#user-selection").removeClass("d-none"); jQuery.each(brandNamesArr, function (index, value) { stringBrands += '
' + value + ''; }); jQuery("#user-selected-filters").append(stringBrands); } } //price range slider function priceRangeSliderUpdate(data){ page = 1; abortPreviousAjaxRequest(); var dfrom = Math.ceil(parseInt(data.input.data('dmax'))*data.from_percent/100); var dto = Math.ceil(parseInt(data.input.data('dmax'))*data.to_percent/100); price_range = dfrom+"-"+dto; getProductsForStore(); } function selectCustomFilters() { custom_filters = cf = {}; jQuery('.custom_filters.filter_1').each(function () { var filter_name = jQuery(this).attr('name'); var filter_id = jQuery(this).attr('data-filter-id'); var filter_title = jQuery(this).attr('data-filter-title'); var filter_selected = getCheckedBoxes(filter_name); if (filter_selected) { custom_filters[filter_name] = filter_selected.join('|'); custom_filters[filter_id] = filter_title; } }); } function encode_data(rawStr){ return encodeURIComponent(rawStr); } function decode_data(rawStr){ return decodeURIComponent(rawStr); } function showClearAllFilter() { /* make Blank to clear all filter div*/ jQuery("#user-selection").addClass("d-none"); jQuery("#user-selected-filters").html(""); var textarray = {}; //ufulfilled if (ufulfilled != "") { textarray["ufulfilled"] = "Express Delivery"; makeClearAllFilters(textarray, "ufulfilled"); } textarray = {}; //price range if (price_range != "") { // var price_text = jQuery(".price-filter:checked").parent().text().trim(); var price_text = jQuery("#price_range_filter").data('value'); textarray["price_range"] = "Price range: " + price_text; makeClearAllFilters(textarray, "price_range"); } textarray = {}; //if brand is exist in search page if (sort_by != "" && sort_by != "relevanceblender") { textarray["sort_by"] = "Sort by: " + sort_by_text; makeClearAllFilters(textarray, "sort_by"); } textarray = {}; if (brand != "") { var show_brand = 0; jQuery("input[name='brand']:checked").each(function () { var value = encode_data(jQuery(this).val()); var text = jQuery(this).parent().text().trim(); textarray[value] = "Brand: " +text; show_brand = 1; is_brand_in_url = 0; }); if (show_brand == 1) { makeClearAllFilters(textarray, "brand"); } // if(show_brand == 0 && brand != ""){ // textarray[brand] = "Brand: " +brand; // makeClearAllFilters(textarray, "brand") // } } if (custom_filters) { var show_custom_filters = 0; $.each(custom_filters, function (f_key, f_values) { textarray = {}; var filter_title = jQuery("input[name='" + f_key + "']").attr('data-filter-title'); if(filter_title != "" && filter_title != "undefined" && filter_title != null){ $.each(f_values.split("|"), function (k, v) { var text = v; if(f_key == 'cf[2]'){ text = (parseInt(v))+" & Up"; } textarray[v] = filter_title + ": " + text; }) show_custom_filters = 1; makeClearAllFilters(textarray, "'" + f_key + "'"); } }); if(show_custom_filters == 0){ $.each(custom_filters, function (f_key, f_values) { textarray = {}; if(f_key.indexOf("cf") != -1){ console.log(f_key) var match = f_key.match(/\[(.*?)\]/); console.log(match) if (match) { console.log(match[1]); textarray[match[1]] = custom_filters[match[1]] + ": " + f_values; } makeClearAllFilters(textarray, "'" + f_key + "'"); } }); } } if (node_id != '') { textarray = {}; if ( (node_id_main != node_id || category_status != 0 ) && (jQuery("button[data-id='" + node_id + "']").text() || node_name != "" )) { if (jQuery("button[data-id='" + node_id + "']").text() != "") { textarray[node_id] = "Category: " + jQuery("button[data-id='" + node_id + "']").text(); makeClearAllFilters(textarray, "category-selected"); }else if(node_name != ""){ textarray[node_id] = "Category: " + node_name; makeClearAllFilters(textarray, "category-selected"); } } jQuery(".remove-user-selection[data-type='category-selected']").on('click', function () { userRemoveCategoryFilter(); }); } //call other filter same as brand if exist } function userClearAllFilter() { sort_by = ""; price_range = ""; ufulfilled = ""; custom_filters = []; if (category_status != 0) node_id = ''; node_name = ''; if (brand_status != 0) brand = ""; changeCurrentUrl(); if(is_brand_search==1){ //window.location = [location.protocol, '//', location.host].join("") window.location = window.location.href; }else{ window.location = window.location.href; } //window.location = window.location.href; } function userRemovePriceFilter() { price_range = ""; showClearAllFilter(); getProductsForStore(); } function userRemoveCategoryFilter() { if (category_status != 0) node_id = ""; node_name = ''; if (category_status == 0) node_id = node_id_main; showClearAllFilter(); getProductsForStore(); } var top_brands = []; function topBrands() { var links = $(".img-detail"); var j = 0; links.each(function(index, element) { let title = $(element).find(".product-title").text(); let stock_text = $(element).find(".product-stock-text").val(); let text = title.toLowerCase(); let link = $(element).attr("href"); if (j > 4) { return false; } console.log("stock_text and"); console.log(stock_text); if( stock_text != undefined){ if(stock_text.toLowerCase().indexOf("in_stock") != -1){ top_brands[j] = {}; top_brands[j].title = title; top_brands[j].link = link; j++; } } }); if (top_brands.length >= 1) { jQuery("#top_brand_faq").removeClass("d-none"); var final_html = '
'; jQuery.each(top_brands, function(index, value) { var html = "- " + value.title + "
"; final_html += html; }); final_html += "
" jQuery(".top-brand-product").html(final_html); } } function updatewishlist(){ var wishlist_variation_sku = '{}'; var wishlist_parent_sku = '{}'; var w_l_sku = ""; $(".newwishlist").map(function() { w_l_sku = $(this).data("sku"); if (wishlist_variation_sku.includes(w_l_sku+"") || wishlist_parent_sku.includes(w_l_sku+"") ) { $(this).addClass('active'); }else{ $(this).removeClass('active'); } }).get(); } function checkajaxrequest(){ if ($.active) { $("#dot-loader").show(); setTimeout(function() { checkajaxrequest(); }, 1000); }else{ //showNoRecord(); $("#dot-loader").hide(); } } function checkonerrorimg(img_this,sku_errorimg,imageUrl){ console.log("sku_errorimg " + sku_errorimg); console.log("imageUrl " + imageUrl); load_src = 'https://d3ulwu8fab47va.cloudfront.net/skin/frontend/default/ubuycom/images/loading.gif'; img_this.src = load_src; img_this_set = false; updateData = imageUrlUpdate(imageUrl) console.log("updateData img " + updateData.img); if (updateData.status == "1") { img_this.src = updateData.img; img_this_set = true; } if ($.inArray(sku_errorimg, checkimage_sku) !== -1) { return; } checkimage_sku.push(sku_errorimg); } function imageUrlUpdate(imageUrl){ if (imageUrl.indexOf("/images/W/") !== -1) { startIndex = imageUrl.indexOf('/images/'); endIndex = imageUrl.lastIndexOf('/images/'); newSubstring = ""; newImageUrl = imageUrl.substring(0, startIndex) + newSubstring + imageUrl.substring(endIndex); res = {status:"1",img:newImageUrl} } else { res = {status:"0",img:imageUrl} } return res; } async function checkImageURL(url, callback) { var img = new Image(); img.onload = async function() { await callback(true); }; img.onerror = async function() { await callback(false); }; img.src = url; } async function checkallimages(all_skus){ if (all_skus != undefined && all_skus != "" ) { all_skus_arr = all_skus.split(",") await Promise.all(all_skus_arr.map(async function(sku) { var img_src = $('.errorimg_' + sku).attr('data-src'); await checkImageURL(img_src, async function(res) { if (res) { //console.log("true: " + img_src); } else { await checkimage_sku_image.push(sku); //console.log("false: " + img_src); } }); })); setTimeout(function(){ if ( checkimage_sku_image.length >= 1 ) { var csrftoken_search = '036e7fb28ea7cf8ee3ef98cb151f586dsearch'; var requestData_img = { image_data: checkimage_sku_image, store: ubuy_store, csrf_token:csrftoken_search } ajaxRequest = jQuery.ajax({ type: "GET", headers: { 'Cache-Control': 'max-age=10' }, data: requestData_img, url: checkimage_url + "?ubuy=" + ubuy, dataType: "html", success: async function(response,textStatus,jqXHR) { response = JSON.parse(response) if (response.status == '1' ) { image_res_skus = Object.keys(response.image_url) image_res_skus.forEach(function(sku_index) { console.log("sku_index" + sku_index); console.log("sku_index image_url " + response.image_url[sku_index]); if (response.image_url[sku_index].indexOf("/images/W/") === -1) { $('.errorimg_' + sku_index).attr("src", response.image_url[sku_index]); } }); } }, error: function(jqXHR, textStatus, errorThrown) { isComplete = false; next_append_request = 0 moniterPageScroll(next_store, isComplete); } }); } },3000) } }
Obrigada
We appreciate your feedback
Like to give feedback ?
-
US
-
UK
-
CH
-
JP
-
IN
-
HK
-
KR
-
TR
-
EU
ENCOMENDAR DE