I need to build a search page with PHP (preferably using Yii2 framework) similar to this one.
Let me explain this further. There are 6 levels of "CPV codes". Users will see the first level as links all the time, and there are 45 of them. When user click on some first level CPV code, for example CPV 24000000 - Chemical products, they will see 7 new links, CPV codes of second level.
At that moment I want to give users 2 buttons next to each link from second level cpv code, one for up, second for down, meaning that if they click up, they will see CPV code that is one level higher, in this case they will be back to 24000000, or if they click on some CPV of second level (down) they will see CPV codes of third level, but related to the one they chose from second.
So if first level is 24000000, once they click on it they will see 7 CPV codes of second level like this:
24100000 : Gases
24200000 : Dyes and pigments
24300000 : Basic inorganic and organic chemicals
24400000 : Fertilisers and nitrogen compounds
24500000 : Plastics in primary forms
24600000 : Explosives
24900000 : Fine and various chemical products
At this moment, next to each of these links there will be 2 options, up and down. If they click UP next to 24100000 Gases, they will see 24000000 Chemical products, if they click DOWN, they will see 24110000 : Industrial gases
If I am storing CPV codes in mysql database table called CPV, and I have 2 columns id = CPV code, and name = CPV name, how can I build this? I have no clue. I know that there is strict hierarchy, but do not know exactly how to use it.
Note: when I pull CPV codes from database, I would like to get it as an array of objects (like Yii2 findAll()
AR method).
Can anyone help me with this?