All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

How to limit results based on input value?

Michel 23 Dec 2016 11:37 question, complete

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

  1. 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.

  2. Michel 24 Dec 2016 20:00

    ok, JS it will be I think. Thx Low.

  3. 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

  4. Michel 10 Jan 2017 20:22

    Never mind, got it.

    {exp:low_search:keywords query="{segment_3}"}

    Michel