Jump to content

get all articles from parent category


UnknownPlayer

Recommended Posts

I have categories and sub-categories, related with sub_cat 0(parent) or with cat id(sub-cat), now articles are in sub-cats, cant be in parent cat, now  i need to select all articles from parent category,that means to select from all sub-cats of that parent categorie.

And articles are related with sub-cats.

Can someone help me ?

Link to comment
https://forums.phpfreaks.com/topic/250190-get-all-articles-from-parent-category/
Share on other sites

Example:

i have these categories(table categories):

- Cars (id = 1, sub_cat_id = 0)

- IT (id = 2, sub_cat_id = 0)

- Other (id = 3, sub_cat_id = 0)

sub_cat_id is 0, becouse these are parent categories

 

And in "Cars" category i have these sub cats(table categories):

- Mercedes (id = 10, sub_cat_id = 1)

- BMW (id = 11, sub_cat_id = 1)

- VW (id = 12, sub_cat_id = 1)

- BMW (id = 11, sub_cat_id = 1)

sub_cat_id is 1, becouse these are child categories of category "Cars" (id = 1)

 

And articles are(table articles):

- c200 (id = 1, cat_id = 10)

- e200 (id = 2, cat_id = 10)

- s500 (id = 3, cat_id = 10)

cat_id is 10, becouse "Mercedes" cat id is 10(child category) in table categories.

 

Now i need to select all articles from parent category "Cars" (id = 1)

 

Can someone help me ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.