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
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 ?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.