Search code examples
phptreeviewe-commerceprestashopcategories

Prestashop: Display Categories tree in module back office


I am making a payment gateway and It could happen that depending on the shop manager, taxes maybe already included in the price, or not. So, when included, the tax field would be 0 and I need to get the price value without the tax. I came up with the idea of making a categories tree in the module back office where the shop manager may specify each category tax, so if it's included in the price, I can calculate it looking what category the product belongs to.

My problem, I do not know how to display the categories tree in the back office. How can I do it?


Solution

  • You can use the renderCategoryTree method of the Helper class (classes/helper/Helper.php):

    $helper = new Helper();
    $categoryTree = $helper->renderCategoryTree();
    

    Take a look at modules/blocklayered/blocklayered.php for an example.