Low_Search: Search term within a specific month & year filter
I'd like to search for all entries of a specific collection for a specific month of a year as set by the entry_date.
Eg. User inputs search query, dropdown selects a collection, dropdown selects a month and dropdown selects a year.
How can I easily filter for these results?
I need to add the month and year dropdowns to this form: http://pastebin.com/RMTF597E and somehow get these selections to filter the result.
Thanks in advance.
Replies
Low 16 Jan 2015 17:44
You could use the native year / month params for that: https://ellislab.com/expressionengine...
NIall O'Brien 19 Jan 2015 09:11
Thanks, but how do I pass the values from the form to the results template using low_search?
Low 19 Jan 2015 09:19
Same you would any parameter in Low Search. Eg:
You could use Low List to help out generate those options.NIall O'Brien 19 Jan 2015 09:24
Thanks, it's not clear from the documentation how to do this. How do I then access these values in the results page?
Low 19 Jan 2015 09:35
Well, the docs explain the principle of using parameters in LS rather than giving an example of every possible parameter. Apart from the parameters made available by the filters, all native parameters that belong to the channel:entries tag are available, too. That includes the year/month parameters.
So, according to the principle, this:
is equal to this:
...inside the Form tag, making the values dynamic and part of the (encoded) query.
The value of the params can be outputted with:
...inside the Form, Filters and Results tags.
Make sense?
NIall O'Brien 19 Jan 2015 10:43
That makes perfect sense, thank you very much.