How PrestaShop calculate depth of categories?

For example - I've got main category Dresses, inside i've got subcategories Blue, Red, Yellow, etc. The second main category that i have is Tshirts, subcategories that i have there are: Green, Blue, White. Okay, so you know configuration of the categories tree in my online shop. Now I want to display twp separated blocks with categories, one with main category "Dresses", second with main category "Tshirts". I defined new block with "depth" param set to 1 (because i want to display subcategories of dresses and tshirts). But i dont see the blocks. Can you help? Of course i use multiple categories block module to build many categories blocks. Thank you for your brilliant work on forums, Maria

 

PrestaShop expert answer

Hello Maria,

below you can find categories that appears as a tree. [1] and [2] etc. are depth param. This is how PrestaShop calculates depth for categories. Presta builds it from root category and this category has got depth param 1, next - subcategories of "root" category have depth param 2, and so on. So, if you want to display Dresses category with subcategories inside block created in multi cat blocks module, you have to define proper "depth" param. In this case, you have to use depth "4". The same for Tshirts block. Please change settings of the blocks and everything should be okay

 

example of categories tree that you build in your shop

[1] root 
[2] -- home 
[3] ----- Dresses
[4] --------- Blue
[4] --------- Red
[4] --------- Yellow
[3] ----- Tshirts
[4] --------- Green
[4] --------- Blue
[4] --------- White

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