For a category show only the specific sub-category in Catalog item field

Mathias92
Tera Contributor

I got two fields in catalog item. Article Category and Article Subcategory.

I got Fruit, Alcohol, Electronics categories in the Article Category variables and more like this. In the Article Subcategory there is tens of datas: Orange, TV, Stereo, Beer, Wine, Lemon, Apple etc.. All of the datas of the Article Category and Article Subcategory are in the question choice table.

How can i set that if in the Article Category field I choose Fruit, in the Article Subcategory only those will appear which belong to this category? So apple,orange,lemon etc.. I tried catalog client scripts but it is cumbersome to do this with it. Also in the question choice table there is no field parent-children relation where i could set the 'Fruits' is the parent of the above mentioned records. Thanks

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

I assume you are referring to variables that belong to a Catalog Item, not fields on a table.  The best way to approach this is to make your two variables of the type Lookup Select Box.  I'll refer to their names in this example as article_category and article_subcategory. The first variable should look like this:

BradBowman_2-1690213417937.png

 

article_subcategory will look similar to this:

BradBowman_1-1690213336718.png

Now you just need to go to the sys_choice table and create a record for every category and subcategory value, using sc_req_item for the Tablearticle_category or article_subcategory for the ElementLabel and Value whatever you want, and a Dependent value for the subcategory records.  This works without any client scripts due to the ref_qual_elements attribute on the subcategory variable which causes the reference qualifier to be updated when the named variable changes.

 

 

 

View solution in original post

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

I assume you are referring to variables that belong to a Catalog Item, not fields on a table.  The best way to approach this is to make your two variables of the type Lookup Select Box.  I'll refer to their names in this example as article_category and article_subcategory. The first variable should look like this:

BradBowman_2-1690213417937.png

 

article_subcategory will look similar to this:

BradBowman_1-1690213336718.png

Now you just need to go to the sys_choice table and create a record for every category and subcategory value, using sc_req_item for the Tablearticle_category or article_subcategory for the ElementLabel and Value whatever you want, and a Dependent value for the subcategory records.  This works without any client scripts due to the ref_qual_elements attribute on the subcategory variable which causes the reference qualifier to be updated when the named variable changes.

 

 

 

Mathias92
Tera Contributor

Thank you!

You are welcome!