Jump to content

Hide categories not selected


Recommended Posts


I have a shop with many categories and I whould like hide "categories" not selecteds into product page ( backoffice )

I try modify document ready with 2 steps.


1.- Collapse all

2.- Click on parent from checkbox selecteds


But not works.


Any idea??


        if ($('#categories-tree-reduce').length) {

			$(".category-tree input").each(function(index){
      				if (index > 0 ){ 
      					var element = $(this); 
						if( element.prop('checked') ) {
							var id = $(this).parent('.checkbox');
							//click ?






Share this post

Link to post
Share on other sites

function livisible($element)
{ return $element.find("li input:checked").length>0}

function ulvisible($element) {
  $element.find('li ul').each(function(index){
    var visible =  (($(this).find('li ul').length) ?  ulvisible($(this)):false) | livisible($(this));

to collapse unchecked categories write



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More