Forum

Thread tagged as: Question

Showing only subcategory in template for admin

I have a "set" named "Shirts" which then has subcategories like "Color" "Style"...

In my template I would like to choose from "Shirts/Color" but I cant get the categories to only show "Color" categories, instead it shows everything starting at "Shirts".

Can you tell me how to work with subcategories in a template.

Robert Ketter

Robert Ketter 103 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What do you have in your template currently?

<perch:categories id="item" label="Item" set="shirts" display-as="checkboxes" required="true" />
<perch:repeater id="photos" label="Photos (required)">
<perch:content id="photo" type="image" label="Photo" width="800" crop="true" required="true" />
</perch:repeater>

I tried:

<perch:categories id="item" label="Item" set="shirts/color" display-as="checkboxes" required="true" />

but then the "Item" field is empty. So i am not sure how to set path for set=""

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does set="shirts" give you everything in the shirts category? I'm not sure it's possible to narrow down to just subcategories.

yes.... like this:

Shirts Shirts>Color Shirts>Color>Red

so of course the list is really long since "red" is a subcategory of "color" which is a subcategory of "shirt"

So is there a better way for me to do this... should I create separate sets? If so how do I set this up in the template?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think the checkbox display will serve you well there - how about switching to the default?

Yes, I just did that and it's much better in a select. Could you please log this as a possible upgrade to categories. That is the ability to display/choose values from specified subcategories and below.

Thanks so much.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'll give it some thought.