I’m building a search feature on a property marketplace. One of the filters is number of bedrooms, there are 2 dropdowns, one for Minimum and one for Maximum, e.g.:
Minimum number: Studio
Max number: 2 bedrooms.
When a user creates a listing, they select number of bedrooms from a dropdown list.
The issue I’m having is that when I try to add the filter, instead of saying #bedrooms = dropdownbedroom’s value (like I might do for # of guests, if I just had 1 guest dropdown), I can’t because there are 2 dropdowns and it seems to not like this.
Does this mean that if a user selects 2 for the the MinBedroom dropdown, it’ll show properties from 1 bedroom, and if the user selects 3 bedrooms as their MaxBedroom dropdown, it’ll show properties up to 4 bedrooms?
Can’t seem to add in the - 1 or + 1 to the end - no option for this unfortunately. Any ideas? I feel like there’s an easy fix in sight but I can’t seem to find it!
@NigelG has a good solution as well. Maybe @mishav’s new toolbox plugin could be used for those numbers instead of a Number Placeholder? Haven’t looked into yet thought so not sure exactly how it works
I still can’t seem to get the - 1 or + 1 values - what should I save # of bedrooms as in the database? I was a text field previously, but I’ve tested number and number range.
I can do: # of bedrooms > MinDropdown’s value, but then can’t add on the - 1 or + 1
Thanks
Edit: Interestingly, when I change ‘MinBedrooms’ to the price slider’s value, I can select - 1 / + 1. Is it because my MinBedrooms and MaxBedrooms are just in standard static dropdowns?
The problem was that you had the word Studio in the Dropdown options. Every option needs to be a number for a calculation like > or < to work.
I switched Studio for a number (0) so you can see.
If you want to leave Studio as an option, then I suggest setting a State on the Dropdown (type Number), and set a Conditional to change the state to the Correct Number every time the Dropdown is changed. Then you can reference the Dropdown’s Number (a state) in the filter. Bit more complicated if you haven’t worked with States much before.
Curious if this was the BnB template? And if so, was this feature not already built in?