3

I have a form that consists of two dropdown boxes. These dropdowns contain values that relate to two sets of categories for one type of entry.

So when the search form is submitted there are two params that are passed, an interest and a destination.

The result I need, if I were to write it literally would be:

Select all the courses where INTEREST = [interest] AND DESTINATION = [destination]

Having a hard time figuring out how this is done in Craft.

Any help appreciated.

2

According to this page, this is how it's done:

{% set entries = craft.entries.search('interest:interestSearchValue destination:destinationSearchValue) %}

So, using the posted variables:

{% set entries = craft.entries.search('interest:' ~ craft.request.param('interest') ~ ' destination:' ~ craft.request.param('destination')) %}
| improve this answer | |
  • Thanks Paul. This certainly helped - although it appears you don't need the AND in there, a space will suffice. Search is not working as expected, thanks again for your help. – toffeejay Aug 3 '15 at 15:18
  • *Search is now working (correction from above). – toffeejay Aug 3 '15 at 15:29
  • Ah, no AND. That WAS an assumption, based on the OR I saw ... – Paul Aug 3 '15 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.