WmZilla - Webmaster and Marketplace

The Next Generation Webmaster and Trade Forum

What should the category hierarchy logic be like?

BingBang

New member

0

0%

Status

Offline

Posts

32

Likes

0

Rep

0

Bits

170

3

Months of Service

0%
I want to show the products of the subcategories of the selected category in one query (at least for now). I have written the left and right values of each category by referring to this resource: http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/ Left represents the categories added before it, while right indicates the number of subcategories. So far, I am able to list them smoothly with a single query using left and right values. However, when I need to add a category, I have to change the left and right values of all categories, which takes a long time, around 30 seconds, causing the PHP process to time out. I have been thinking about this for 2 days, even in my sleep, but I can't find a logic. It seems that adding categories quickly is not possible this way. I don't want to create a separate column for each category. What logic should I use for each category? This resource has confused me a lot, and there are many people in the comments section facing the same issue. Is there anyone who can provide some ideas on this?
 

249

6,622

6,642

Top