How to have ‘All’ in a repeating group of categories on search page?

Ok so I built a search page that sorts listings. Each listing was meant to have a category (e.g. electronics, kitchen appliances, living room, bathroom etc).

I found a way to build a repeating group which calls on the categories, and when a category in the RG is clicked, the relevant listings are sorted in the search below.

However, I wanted ‘All Categories’ to be an option too, so instead of Category being a text field, I made it a List of text fields, and every time a new listing was created it joins 2 categories (1 being whatever the listing creator has chosen, and the other being ‘All Categories’ that I add on in the database).

My workflow is basically: Category set list CategoryDropdown’s value plus All Categories.

Now, the search works great, but when the user wants to edit their listing, the category they selected isn’t loaded back into the drop down, and if they want to change category, I’m not sure if that works well.

Is there a better way to go about this? Rather than having a List of Categories, I’d like to go back to Category being a single text field, but also somehow give all listings the category of ‘All Categories’.

I suppose I can ensure that the category chosen by the user is the first item in the list, so when they edit their listing, I can call upon the first category, I think that should work, I’ll test it out.

I’m all ears if there are better solutions though!


Ps: typed this on my phone so no supporting images, but I can add some when I get home.

Just looking at this, I’d probably have Category be a type of thing, not a text field. This would let you have a Category with a list of Listings, as well as a Listing with a list of Categories on it. Then, when setting the data in the group, you could use filters or constraints to limit or change what actually gets displayed.

When you have a chance, can you share a public link to your editor so we can see how you have it set up?

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.