Prevent Filtering when on archive pages
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from luistosini on August 13, 2024, 04:49We are using Husky in a widget area that shows across the site, when the search bar is rendered on an category archive page it will only search products from that category instead of accross the site and it doesnt show the rest of the available categories
For example we have categories for genre: Pop, Rock, Blues, Jazz; when looking at the homepage it shows all the categories under the Genre filter, when looking at the Rock Archive page it wont show the other categories and will only search for products under the Rock Category.
Is there a way to force it to search everywhere regardless if its on a category archive page or not?
We are using Husky in a widget area that shows across the site, when the search bar is rendered on an category archive page it will only search products from that category instead of accross the site and it doesnt show the rest of the available categories
For example we have categories for genre: Pop, Rock, Blues, Jazz; when looking at the homepage it shows all the categories under the Genre filter, when looking at the Rock Archive page it wont show the other categories and will only search for products under the Rock Category.
Is there a way to force it to search everywhere regardless if its on a category archive page or not?
Quote from Alex Dovlatov on August 13, 2024, 11:10Hello
On the category page, the filter shows only child categories. Logic: on the category page, you can show only products that belong to the category OR child category. It makes sense to show only child categories( of the current category ), because clicking on any other category will always give zero products because currently we are on category page
How this can be resolved if showing another category is necessary: install any plugin that shows top categories or categories by their term ids
Another way: create and use custom shortcode to always show to your user on the category page links to another categories, here is an code example:
add_shortcode('top_categories_except_current', function () { if (is_product_category()) { $current_category_id = get_queried_object_id(); $categories = get_terms(array( 'taxonomy' => 'product_cat', 'hide_empty' => true, 'exclude' => array($current_category_id), 'orderby' => 'count', 'order' => 'DESC', )); if (!empty($categories)) { $output = '<ul class="top-categories-list">'; foreach ($categories as $category) { $output .= '<li><a href="' . get_term_link($category) . '">' . esc_html($category->name) . '</a></li>'; } $output .= '</ul>'; return $output; } } return ''; } ); Use the [top_categories_except_current] shortcode anywhere on your site, such as in a widget or in page content.
Hello
On the category page, the filter shows only child categories. Logic: on the category page, you can show only products that belong to the category OR child category. It makes sense to show only child categories( of the current category ), because clicking on any other category will always give zero products because currently we are on category page
How this can be resolved if showing another category is necessary: install any plugin that shows top categories or categories by their term ids
Another way: create and use custom shortcode to always show to your user on the category page links to another categories, here is an code example:
add_shortcode('top_categories_except_current', function () {
if (is_product_category()) {
$current_category_id = get_queried_object_id();
$categories = get_terms(array(
'taxonomy' => 'product_cat',
'hide_empty' => true,
'exclude' => array($current_category_id),
'orderby' => 'count',
'order' => 'DESC',
));
if (!empty($categories)) {
$output = '<ul class="top-categories-list">';
foreach ($categories as $category) {
$output .= '<li><a href="' . get_term_link($category) . '">' . esc_html($category->name) . '</a></li>';
}
$output .= '</ul>';
return $output;
}
}
return '';
}
);
Use the [top_categories_except_current] shortcode anywhere on your site, such as in a widget or in page content.