How to show specific nb of subcategory levels ?

we've installed your free fantastic module in my prestashop
It works very well!
But we need it works in a a certain way.
We would like to know if we can det the depth in each menu level.
SO in level 0 (root) we would linke to set deep 2 (from the root)
In level 1 we would like to set deep to 1 (from the root)
In level 2 we would like to set deep to 3 (from the root)
Is it possibile?
Thanks in advance...great work!

PrestaShop expert answer

module does not allow to set such params,
the only one way is a modification of module .php files to support various depth or css styles to hide higher levels of categories.
the main problem in your case is fact that you want to show various number of subcategory levels depending on the current category level. Below you can see how to modify the module file to work as you wish.


Modify free block categories module

Main module file: verticalblockcategories.php has code:

        if (!$this->isCached('blockcategories.tpl', $cacheId))
            $range = '';
            $maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH');

right after the code above paste this one:

            if(Tools::getValue('controller') == 'category' && Tools::getValue('id_category', 'false') != 'false')
                $thiscategory = new Category(Tools::getValue('id_category'));
                if ($thiscategory->level_depth == 2) {
                    $maxdepth = 4;
                } elseif ($thiscategory->level_depth == 3) {
                    $maxdepth = 3;
                } elseif ($thiscategory->level_depth == 4) {
                    $maxdepth = 2;

to define additional conditions just define new elseif, for exmaple:

} elseif ($thiscategory->level_depth == 5) {
    $maxdepth = 2;


just customize the conditions to meed your requirements. Please note that in PrestaShop levels are defined from Root (invisible) cateogry.

ID of category: 1 - Root - level depth: 0

ID of category: 2 - Home - level depth: 1


author milos myszczuk
Answer by Milosz Myszczuk PrestaShop expert, official PrestaShop community moderator. PHP developer, specialist in relative and spatial databases management, GIS Analyst, CEO & founder of VEKIA interactive agency. Read more about VEKIA company
If you like my articles and want much more valuable tips, feel free to send me donation