Get Free Audit

How to Create Your Own Render for HelperTreeCategories in Prestashop

Feb 3, 2016

1782 Alex Simonchik

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:

Andrey_Dubina
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:
development_prestashop

PrestaShop Development

Take your online store to the next level with BelVG PrestaShop Development

Visit the page
Andrey Dubina
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Andrey

2 Comments

  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

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