Jump to content

Select child product category when parent category is selected


ovy79ro
 Share

Recommended Posts

Hi,
 
I use helper class to display product category tree in back office but i want to automatically select child category when parent category is selectet. 
The code that i use is:
 
array(
                   'type'  => 'categories',
                   'label' => $this->l('Product Category'),
                   'name'  => 'category',
                   'required' => true,
                   'tree'  => array(
                        'id' => 'category',
                        'selected_categories' => array((int)Configuration::get('category')),
                        'use_checkbox' => true,
                    )
                )

Share this post


Link to post
Share on other sites

I try this jquery code:

$(document).ready(function() {
$("#category").click(function(){
$(".tree-folder-name").find(":input[type=checkbox]").each(function(){
$(this).prop("checked", true);
$(this).parent().addClass("tree-selected");
}); 
}); 
});
But it is not working.

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
 Share

×
×
  • Create New...

Important Information

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