Multi level categories menu hint

Fastserv

Member
Hi,

before I waste hours and get it not done, i ask the forum.
What I want to achieve is a multi level category dropdown menu.

I have two tables machines_cats and machines_items (see below).
Where machine_cats.cat_id = machines_items.kategorie
This is the way I think it could work:

First elemet is a database join element that connect the cats table to the items table. I limit the output with
Code:
WHERE level = 0
and set a dropdown filter.
(Or should I use the table join in list view? )

Second element is a ccd element witch watches the first element and filter the output with
Code:
level = 1
The next cdd watches the first cdd and so on...

Could that work?

Stefan
 

Attachments

  • machines_categories_list.png
    machines_categories_list.png
    20.2 KB · Views: 250
  • machines_items_list.png
    machines_items_list.png
    30.4 KB · Views: 246
Well, that would work for the first two, but i don't think you can have a CDD which watches another CDD using the same table, as there's no foreign key to use.

-- hugh
 
I think I'd have to understand your setup better.

Is the form you are building this on a separate table, or is it the cats table?

In a normal CDD sceanrio, you would have a third table (say "Contacts"), which has a join to "States", and a CDD for "Cities", which watches "States", and uses the 'state_id' foreign key on the Cities table to filter the CDD list down to Cities in the selected State.

So I'm not quite understanding your setup.

-- hugh
 
Ok I will try :)

In machines_cat I have
id ->
date_time ->
cat_id -> Witch indicates the category id (Primary key)
parent_id -> Witch indicates the parent category id
cat_name -> The category name
cat_level -> The category tree level

In machines_items I have besides many others
kategorie -> Witch equals cat_id in machines_cat

So the root categories looks like this
cat_id parent_id cat_name cat_level
23 0 name 0

A category in the first level looks like
cat_id parent_id cat_name cat_level
120 23 name 1

and so on

My idea was now to filter the dropdown by the parent_id and cat_level.
So the first database join element should have a filter WHERE parent_id = 0
to make sure only root categories will be shown
The first cdd looks at the cat_id and has a filter WHERE parent_id = cat_id (from dbjoin element) AND level = 1

I am not sure if this makes more sense to you.
Thank you for your help.

Stefan
 

Members online

No members online now.
Back
Top