Jump to content

[PS 1.7] Category tree with checkboxes and radio menu - Select default category


Recommended Posts

Hey all!

I am looking for a Prestashop default way to display a category tree with checkboxes and a radio menu (as available on the BO product page)

Category tree 01 - with radio buttons

    $tree = new HelperTreeCategories('mytree', 'Associated categories');
    $tree->setTemplate('tree_associated_categories.tpl')->setRootCategory(Category::getRootCategory()->id)->setUseCheckBox(false);
    $this->context->smarty->assign(array( 'mytree' => $tree->render() ));

Category tree 02 - with checkboxes

    $tree = new HelperTreeCategories('mytree', 'Associated categories');
    $tree->setTemplate('tree_associated_categories.tpl')->setRootCategory(Category::getRootCategory()->id)->setUseCheckBox(true);
    $this->context->smarty->assign(array( 'mytree' => $tree->render() ));

 

How to display a category tree like image Tree 03? It does not require to have the new Prestashop theme design.

 

tree.thumb.png.d3577e02eaf1d1ec92fe4c4f372c32a8.png

tree03.png.8e088274ac15bdf2d1750c26e3735152.png

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
On 3/16/2021 at 3:10 PM, Crezzur.com said:

Hey all!

I am looking for a Prestashop default way to display a category tree with checkboxes and a radio menu (as available on the BO product page)

Category tree 01 - with radio buttons

    $tree = new HelperTreeCategories('mytree', 'Associated categories');
    $tree->setTemplate('tree_associated_categories.tpl')->setRootCategory(Category::getRootCategory()->id)->setUseCheckBox(false);
    $this->context->smarty->assign(array( 'mytree' => $tree->render() ));

Category tree 02 - with checkboxes

    $tree = new HelperTreeCategories('mytree', 'Associated categories');
    $tree->setTemplate('tree_associated_categories.tpl')->setRootCategory(Category::getRootCategory()->id)->setUseCheckBox(true);
    $this->context->smarty->assign(array( 'mytree' => $tree->render() ));

 

How to display a category tree like image Tree 03? It does not require to have the new Prestashop theme design.

 

tree.thumb.png.d3577e02eaf1d1ec92fe4c4f372c32a8.png

tree03.png.8e088274ac15bdf2d1750c26e3735152.png

Thanks for this simple but useful post

Link to comment
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...