The forums are closed and will be removed when we launch our new site.
Looking for support? You can access the support system via your account.
Forums › Forums › Search & Filter Pro › Number Range not working as I would expect
- This topic has 15 replies, 2 voices, and was last updated 6 years, 8 months ago by dann hanks.
-
dann hanks(Private) January 22, 2018 at 10:34 am #153812
Hi, I am using search and filter to filter properties.
Each of my properties has a custom ACF field to add a number of maximum guests that are allowed to stay in the property.
I have used a ‘Range dropdown’ field to try and filter this data.
So on my search form I have a dropdown that says sleeps between: 1 > 24
I have a property that allows 8
If, on the search form, I select 1 > 8 it finds the property.
If I select 1 > 4 it doesn’t find the property.
As the 8 person property can obviously take 4 people, I would expect the range to pick up that this number (4) is in-between 1 and 8.
Maybe I am going about it in the wrong way.
Any advice would be great.
Cheers
Dann
Trevor Moderator(Private) January 22, 2018 at 11:08 am #153813That is how I would expect the range to work.
The only way that is can work is if the ACF field is set to accept multiple values, and it contains 8 and all the values below it (1,2,3,4,5,6,7 and 8), or that you have a separate field that contains all these values. In ACF you can make a field calculated, so when a post has the field with 8 in saved, the calculated field could than fill with the numbers 1 thru 8.
dann hanks(Private) January 22, 2018 at 11:16 am #153815Hi Trevor, thanks for the reply.
It might be a setting I have not added right?
As its a user inputted number field, I can’t expect the users to add 1,2,3 etc – I think this would have to be automatic.
I am going to private post 2 screenshots below, 1.png is my settings in search and filter, 2.png is my setting for the ACF field.
Any ideas?
Trevor Moderator(Private) January 22, 2018 at 11:18 am #153820Your settings are correct. But our range matching does not do ‘equal or less than’, which is what you want, so my suggestion is the only way around this for now (and does not need the user to do anything). I believe the feature you want is on our ‘to do’ list.
dann hanks(Private) January 22, 2018 at 11:21 am #153824Thanks Trevor – sorry I don’t understand what I need to do in ACF to achieve this?
I have re-read your suggestion but not sure how to implement?
Trevor Moderator(Private) January 22, 2018 at 11:25 am #153826You would have two fields. One that the user currently enters the maximum occupancy in to, the other is a calculated field, and which the search is based on.
You may need to resort to help on the ACF forums, but this is where I would start:
dann hanks(Private) January 22, 2018 at 11:51 am #153831Thanks for the suggestion, I might have to look for another way around – I have looked through the top links for the search you provided but I really don’t understand how this works / I cant relate it to my issue.
Your solution is just a bit above my head I think..
: /
I will let you know here if I find another solution.
thanks
dann hanks(Private) January 22, 2018 at 1:14 pm #153859Hi,
I have almost got a solution which would be easy to implement and would mean that I wouldn’t have to change the way the user adds the data.
I have chosen the ‘Choice’ field rather than the number Range field in S&F.
The value I am after is for number of guests.
So, I have set my first choice in the dropdown to:
Value:
1&_sfm_numberofguests=2&_sfm_numberofguests=3&_sfm_numberofguests=4&_sfm_numberofguests=5&_sfm_numberofguests=6&_sfm_numberofguests7&_sfm_numberofguests=8&_sfm_numberofguests=9&_sfm_numberofguests=10&_sfm_numberofguests=11&_sfm_numberofguests=12
Label:
1
… If this passed through to the form intact it would work.
It would look like:
This would mean that the ‘1’ guest could potentially stay in a property of any size from 1 > 12.
Instead, when it gets passed through the form it looks like this:
… replacing ‘ & ‘ with ‘ %26 ‘ and replacing ‘ = ‘ with ‘ %3D ‘
… is there a way to pass this value through without it replacing the &’s and the =’s?
Cheers
Trevor Moderator(Private) January 22, 2018 at 1:28 pm #153867What happens if you untick the
Use same for End Key
but leave it the same key?You should then get some match choices?
-
AuthorPosts
The topic ‘Number Range not working as I would expect’ is closed to new replies.