J
J
JohnxFFF2019-10-24 09:35:54
MySQL
JohnxFFF, 2019-10-24 09:35:54

How to organize nested categories and pages?

There are categories that have an unlimited number of subcategories, and at any of the page levels:

Каталог
- Мужская одежда (категория)
- - Носки (категория)
- - - Носок розовый (страница)
- - Шарф (страница)
и тп

It is necessary to get the full path to the node as easily as possible, for example, we are on the Pink Sock
page, the page should be available at this url (site/man/socks/pink-sock)
Please tell me how to store this data in the database so that you can conveniently pull everyone parents (for breadcrumbs/ url ) ?
I can not figure out the types of tree storage nested sets vs adjacency list
Tell me how to organize?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2019-10-24
@JohnxFFF

It's good that you already know about nested sets . You just need to figure out how to do it. I hope you have already googled this topic and have an idea. It remains to understand how to do it in Yii. There is a ready- made extension
for it. Two words cannot describe it. Dmitry Eliseev in his Yii shop tutorial just shows how to do it. You can find the lesson and see.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question