Hide Filter If Variants Only 1 Property

how to hide the filter when it is only one variant?

google ads.png

Please add:

1.

#file:

js/addons/my_changes/func.js

#content
(function($, _) {
$(document).ready(function() { fn_my_changes_check_filters(); });
$.ceEvent(‘on’, ‘ce.ajaxdone’, function(elms, scripts, params, response_data, response_text) { fn_my_changes_check_filters(); });
}(Tygh.$, Tygh));

function fn_my_changes_check_filters(){
if($(‘.ty-product-filters__block’).length==0) return false;
$(‘.ty-product-filters__block’).each(function(){
if($(this).find(‘ul.ty-product-filters li.ty-product-filters__item-more’)){
if($(this).find(‘ul.ty-product-filters li.ty-product-filters__item-more li’).length==1){
$(this).hide();
}else{
var i=0;
$(this).find(‘ul.ty-product-filters li.ty-product-filters__item-more li’).each(function(){
if(!$(this).find(‘label’).hasClass(‘disabled’)){
i++;
}
});
if(i==1) $(this).hide();
}
}else{
$(this).show();
}
});
}



2.
#file
design/themes/[THEME_NAME]/templates/addons/my_changes/hooks/index/scripts.post.tpl

#content
{script src=“js/addons/my_changes/func.js”}

3.
#clear cache
…/admin.php?cc&ctpl

4. Have Fun


Keep on smiling,


Valentin
part of hungryweb.net