How to Create Your Own Render for HelperTreeCategories in Prestashop

Feb 3, 2016559
How to Create Your Own Render for HelperTreeCategories in Prestashop

One of our clients wanted to change the behavior of the default HelperTreeCategories for Bulk actions. He needed it to look similar to the following:

Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey

Product 1: A|B|C|D
Product 2: A|B|E
Product 3: F|G|H|I
 
So, when I edit product 1 and 2 together I should see:
A: Selected
B: Selected
C: “Grey”
D : “Grey”
E: “Grey”
F, G, H, I: Unselected(edited)
We implemented it using the following method:
How to Create Your Own Render for HelperTreeCategories in Prestashop
We extended the default HelperTreeCategories  by our own HelperTreeCategoriesBelvg, by adding the methods:

We also had to create an override for the template /modules/belvg_{modulename}/views/templates/admin/helpers/tree/tree_associated_categories.tpl in which we took into account the new variable called _part_selected_categories.

This is the code that displays (renders) categories tree:

Partner With Us Looking for a partner that will help you to grow your business? We are the right company to develop your webstore. Feel free to get in touch with us. We will be happy to discuss your business opportunities and provide you with a Free Quote. Talk to Andrey

1 comment

  1. hi,
    i’m trying to implement a tree category in a module i build but i got radio buttons instead of checkboxes. i have set setUseCheckBox to true

Post a new comment

top
BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *