How to Create Your Own Render for HelperTreeCategories in Prestashop

February 3, 2016 Alex Simonchik Prestashop
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:

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:


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 *