Low Search and checboxes
Hi,
I have a site with houses for sales/rent. In the channel I have 3 checkboxes:
For sale
For rent
Independent
Some houses can be for sale AND for rent, so both checkboxes can be checked.
If I search on the site, using Low Search, for 'For sale' then it finds only the houses that are 'for sale', not all houses that are for sale AND for rent.
It seems that they exclude ech other.
All help appreciated,
Michel
Replies
Low 17 Nov 2016 10:17
What is your current full Form tag and opening Results tag? You can use http://pastie.org/ or http://pastebin.com/ for large chunks of code.
Michel 17 Nov 2016 10:21
Hi Lodewijk,
Form tag: http://pastie.org/10964165
Results: {exp:low_search:results query="{segment_3}" search_mode="any" secure="no" channel="panden" status="Open|In de kijker|Verkocht|Verhuurd"}
Many thx for helping out!
Michel
Low 17 Nov 2016 10:42
Firstly, you should move the collection="" parameter from the Form tag to the Results tag. It has no effect on the Form tag.
Secondly, I can see the search:te_koop and search:for_rent as being two separate fields. If one of those checkboxes is not checked, the parameter should not be sent along with the form. You're not defining something like IS_EMPTY.
Guess I'll need to take a look myself. Please send SuperAdmin login credentials to hi at gotolow dot com if you can.
Low 17 Nov 2016 21:29
Okay, I looked into it. The issue was not with the checkboxes themselves, but rather with your Ranges filter, and specifically, with the field that the Ranges filter is targeting.
The Price field was a Text field but could contain Any data. In order for the Ranges filter to work properly, you need to:
Setting the Price field to Integer solved the issue, as now the correct entries are returned by the Ranges filter.
Michel 17 Nov 2016 22:22
Brilliant, thank you very much!
Michel