Search/Collections Based on Both Channel and Category Select Options
Hey,
Is there a way to make Low Search collections based on channel AND category?
If the answer is "no" is there another way to accomplish the following:
We have a search form with a keywords text input field and two filter select/option dropdowns: one for collection and one for calendar year. We want the collections filter dropdown to render two options which show entries from two different categories assigned to the same channel (which we already have a collection for).
Thanks!
Replies
Low 16 Dec 2013 07:41
It's not possible at the moment, but you could use JavaScript on the front end to get this working.
Basically, you'll need to use a hidden input field for category, and change its value based on the collection selected.
Stoyan Vasilev 16 Dec 2013 17:00
I see. If my categories are currently assigned to the same collection should I make a second (duplicate) collection with a different name?
Low 16 Dec 2013 17:16
Not necessarily. You need something to trigger between two category values. That doesn't have to be 2 different collections. It can be the same collection, but 2 different html-classes on the <option>, for example. Or use HTML5's data attribute:
Untested, but it should explain the principle.
Stoyan Vasilev 16 Dec 2013 17:23
I see what you are saying.
I was asking because right now the collections are not hardcoded in the dropdown (and the collections loop would not iterate twice over the same collection). Does it matter if we hardcode the collections options OR if we create a second collection (in order to keep the collections loop)?
Low 16 Dec 2013 17:24
Nope, either way would be fine. Whatever works best for you.
Stoyan Vasilev 16 Dec 2013 17:50
Great. Thanks.