How to solve this problem with a hierarchy of categories?

Good day,

Please do not solution, but more of a push in the right direction, or rather such a nice pink.
The task is the following:
We have a category with subcategories (unlimited). At first only visible to the main category by clicking on category opens its subcategories (with the help of ?group = ...) (others closed), etc.
Just next to the categories and subcategories, display the values of number of products that belong to these categories.

I think so. Is it right or stupid?
1) take out the entire list of categories, and depending on $_GET['group'] make an array of parents. Then reverse the array has to start with the root category.
2) Due to the first action to build a category tree
3) Looking at each visible to the customer category number of products
July 9th 19 at 12:52
2 answers
July 9th 19 at 12:54
July 9th 19 at 12:56
Adjacency list + caching
Simple options are needed. Base. Nothing can be used in addition to php, sql, and html :) - Fay32 commented on July 9th 19 at 12:59
: so I'm not suggesting to use something supernatural. You can implement caching on the file - golda.Kiehn commented on July 9th 19 at 13:02
Is just for test job my friend decided to help. But something has loaded ) - Fay32 commented on July 9th 19 at 13:05

Find more questions by tags MySQLPHP