Facial Tissue - Hotpack (2025)

'); $.ajax({ type: 'POST', url: ajaxurl, data: { action: 'filter_products_by_attribute_mobile', filters: filters, selected_category: selectedCategory }, success: function(response) { $('.product-list_grids').html(response.html);var attributeCount = $('#productGrid .card').length;$('.count-display').text(attributeCount + ' Results '); $('.offcanvas').offcanvas('hide'); }, error: function(xhr, status, error) { $('.product-list_grids').html('

An error occurred while fetching products. Please try again later.

'); } }); updateFilterCount(); });/** attribute filter **/ var previousState = ''; var selectedSubcategoryId = null; var isTagFiltered = false; var tagName = 'Customizable'; var currentCategoryId = 259;var selectedSortOption = null;var selectedSortOptionmobile = null; var currentTagName = null; var currentFilters = {}; // Check if the 'customizable' parameter is present in the URL const urlParams = new URLSearchParams(window.location.search); const isCustomizable = urlParams.has('customizable'); if (isCustomizable) { $('#tagToggle').prop('checked', true); isTagFiltered = true; filterProducts(); }if (isCustomizable) { $('#tagToggle-mobile').prop('checked', true); isTagFiltered = true; filterProducts(); } // Toggle customization filter $('#tagToggle').on('change', function() { isTagFiltered = this.checked; previousState = $('.product-list_grids').html(); filterProducts(); });$('#tagToggle-mobile').on('change', function() { isTagFiltered = this.checked; previousState = $('.product-list_grids').html(); filterProducts(); }); // Subcategory filter $(document).on('click', '.catSub-name', function(e) { e.preventDefault(); $('.catSub-name').removeClass('selectedCat'); $(this).addClass('selectedCat'); selectedSubcategoryId = $(this).data('subcategory-id'); filterProducts(); });function scrollToProductList() { var offset = $('.elementor-widget-woocommerce-breadcrumb').offset().top; $('html, body').animate({ scrollTop: offset }, 500);}$('.catSub-name').on('click', function(e) { e.preventDefault(); var subcategoryId = $(this).data('subcategory-id'); var subcategoryName = $(this).data('subcategory-name'); fetchCategoryData(subcategoryId, subcategoryName);scrollToProductList(); }); // Function to fetch category data function fetchCategoryData(subcategoryId, subcategoryName) { var ajaxurl = 'https://www.hotpackglobal.com/wp-admin/admin-ajax.php'; $.ajax({ type: 'POST', url: ajaxurl, data: { action: 'fetch_category_data', subcategory_id: subcategoryId }, success: function(response) { if (response.success) {var attributeCount = $('#productGrid .card').length;// $('#productCount').text(response.data.product_count + ' Results for ' + subcategoryName);// $('.count-display').text(attributeCount + ' Results '); } else { console.error('Failed to fetch category data'); } }, error: function(xhr, status, error) { console.error('AJAX Error:', error); } }); } // Attribute filter $(document).on('click', '.product-list_nav-list .dropdown-menu a.dropdown-item', function(e) { e.preventDefault(); var attribute_slug = $(this).closest('.nav-item.dropdown').find('.nav-link').data('bs-target'); var term_slug = $(this).data('bs-target'); var attribute_name = $(this).text(); // Check if the term is already selected if (!$(`li[data-attribute-slug="${attribute_slug}"][data-term-slug="${term_slug}"]`).length) { const newLiElement = `
  • ${attribute_name} Facial Tissue - Hotpack (1)
  • `; $('.product-list_tags ul').append(newLiElement); } filterProducts();}); // Remove attribute filter$('.product-list_tags').on('click', '.close-btn', function() {var $parent = $(this).parent();var attribute_slug = $parent.data('attribute-slug');var term_slug = $parent.data('term-slug');$parent.remove();filterProducts();// Check if the attribute is still selectedif (!$(`li[data-attribute-slug="${attribute_slug}"]`).length) {var $navItem = $(`.nav-link[data-bs-target="${attribute_slug}"]`).closest('.nav-item');$navItem.removeClass('attribute-selected');$navItem.find('.nav-link-title').removeClass('nav-link-selected');}$(`.dropdown-item[data-bs-target="${term_slug}"]`).removeClass('dropdown-item-selected');});$(document).on('click', '.attr-select', function(e) {var $dropdownItem = $(this);var $navItem = $dropdownItem.closest('.nav-item');var $navLinkTitle = $navItem.find('.nav-link-title');$navItem.addClass('attribute-selected');$navLinkTitle.addClass('nav-link-selected');$dropdownItem.addClass('dropdown-item-selected');});// Event handler for sort options (desktop and mobile)$(document).on('change', 'input[type="radio"][name="sortOption"]', function() {selectedSortOption = $(this).data('sort-option');// $('.offcanvas').offcanvas('hide');filterProducts();}); function collectFilters() { var filters = {}; $('.product-list_tags ul li').each(function() { var attribute_slug = $(this).data('attribute-slug'); var term_slug = $(this).data('term-slug'); if (!filters[attribute_slug]) { filters[attribute_slug] = []; } filters[attribute_slug].push(term_slug); }); return filters; }function filterProducts() { var filters = collectFilters(); var categoryId = selectedSubcategoryId || currentCategoryId; fetchProducts(categoryId, isTagFiltered ? tagName : null, filters, selectedSortOption, selectedSortOptionmobile); }// Fetch products with filtersfunction fetchProducts(categoryId, tagName, filters, sortOption, pageNumber) { var ajaxurl = 'https://www.hotpackglobal.com/wp-admin/admin-ajax.php'; var $productGrid = $('.product-list_grids'); $productGrid.html('');var currentLanguages = localized_data.currentLang; // Fetch category name $.ajax({ type: 'POST', url: ajaxurl, data: { action: 'get_category_name', category_id: categoryId }, success: function(categoryResponse) { var categoryName = 'Unknown Category'; var response = JSON.parse(categoryResponse); if (response.name) { categoryName = response.name; } // Fetch category data $.ajax({ type: 'POST', url: ajaxurl, data: { action: 'fetch_category_data', subcategory_id: categoryId }, success: function(categoryDataResponse) { var totalProductCount = 0; if (categoryDataResponse.success) { totalProductCount = categoryDataResponse.data.product_count; } // Fetch filtered product count $.ajax({ type: 'POST', url: ajaxurl, data: { action: 'get_filtered_product_count', filters: filters, category_id: categoryId, tagName: tagName }, success: function(filteredCountResponse) { var filteredProductCount = 0; if (filteredCountResponse.success) { filteredProductCount = filteredCountResponse.data.attribute_count; } // Fetch products $.ajax({ type: 'POST', url: ajaxurl, data: { action: 'filter_products', filters: filters, category_id: categoryId, tagName: tagName, sort_option: sortOption, paged: pageNumber,currentLanguages: currentLanguages, }, success: function(productResponse) {var currentLanguage = localized_data.currentLang;var resultsText;var totalResultsText;if (currentLanguage === 'ar') {resultsText = filteredProductCount + ' نتائج لـ ' + categoryName;totalResultsText = filteredProductCount + ' نتائج ';} else {resultsText = filteredProductCount + ' Results for ' + categoryName;totalResultsText = filteredProductCount + ' Results ';} $productGrid.html(productResponse); $productGrid.html(productResponse);$('#productCount').text(resultsText);$('.count-display').text(totalResultsText);fetchAttributes(categoryId); }, error: function(xhr, status, error) { $productGrid.html('

    An error occurred while fetching products. Please try again later.

    '); } }); }, error: function(xhr, status, error) { $productGrid.html('

    An error occurred while fetching filtered product count. Please try again later.

    '); } }); }, error: function(xhr, status, error) { $productGrid.html('

    An error occurred while fetching category data. Please try again later.

    '); } }); }, error: function(xhr, status, error) { $productGrid.html('

    An error occurred while fetching category name. Please try again later.

    '); } });}function fetchAttributes(categoryId) { var ajaxurl = 'https://www.hotpackglobal.com/wp-admin/admin-ajax.php';$('#attributeList').html(''); $.ajax({ type: 'POST', url: ajaxurl, data: { action: 'fetch_category_attributes', category_id: categoryId }, success: function(attributeResponse) { $('#attributeList').html(attributeResponse); }, error: function(xhr, status, error) { $('#attributeList').html('

    An error occurred while fetching attributes. Please try again later.

    '); } });}// Event listener for pagination links$(document).on('click', '.pagination.custom-pages a', function(e) { e.preventDefault(); var pageNumber = $(this).attr('href').split('page/')[1]; var filters = collectFilters(); var categoryId = selectedSubcategoryId || currentCategoryId; fetchProducts(categoryId, isTagFiltered ? tagName : null, filters, selectedSortOption, pageNumber);});});/** clear button **/document.getElementById('clearAllBtn').addEventListener('click', function() { location.reload();});jQuery(document).ready(function($) { $('input[name="sortOption"]').change(function() { $('label').css('color', ''); if ($(this).is(':checked')) { $(this).closest('label').css('color', '#000000'); } });});
    Facial Tissue - Hotpack (2025)

    References

    Top Articles
    Latest Posts
    Recommended Articles
    Article information

    Author: Reed Wilderman

    Last Updated:

    Views: 6176

    Rating: 4.1 / 5 (72 voted)

    Reviews: 95% of readers found this page helpful

    Author information

    Name: Reed Wilderman

    Birthday: 1992-06-14

    Address: 998 Estell Village, Lake Oscarberg, SD 48713-6877

    Phone: +21813267449721

    Job: Technology Engineer

    Hobby: Swimming, Do it yourself, Beekeeping, Lapidary, Cosplaying, Hiking, Graffiti

    Introduction: My name is Reed Wilderman, I am a faithful, bright, lucky, adventurous, lively, rich, vast person who loves writing and wants to share my knowledge and understanding with you.