How to limit results based on input value?
Hi,
Is it possible to limit the results based on what has been searched for?
I mean, when someone uses the keywords input field, I don't want to show entries that have a specific custom field set.
Example: I have a list of restaurants, but some of them are anonymous. So, if someone searches for postal code 1000, I want to hide the aonymous restaurants. If the keywords input field has not been used, but only max-price for example, then the anonymous entries may appear.
Is this possible somehow?
Best,
Michel
Replies
Low 23 Dec 2016 12:13
You could use JavaScript to set (hidden) parameters on search submit, based on what was entered in the form.
Alternatively, you could write an extension using the low_search_pre_search hook, where you can modify any amount of parameters.
Michel 24 Dec 2016 20:00
ok, JS it will be I think. Thx Low.
Michel 10 Jan 2017 16:27
Hi Low, I can get this hidden filed filled in, but it doesn't seem to pick it up in the searchresults page, via $_POST. How can I pass throught this field to the search page?
Best,
Michel
Michel 10 Jan 2017 20:22
Never mind, got it.
{exp:low_search:keywords query="{segment_3}"}
Michel