Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Age Range

Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • John Emerson
    #7843

    Hey, I’m loving Search Filter Pro, but just ran into a question: I can put price within a range query, but is there a way to run a range query on two fields? I have minimum age and maximum age as Advanced Custom Fields per post. Is there a way to use a single range selector to find values between those? (Say, someone wants a post for 5-7 years, but nothing before or after.) Thank you!

    Ross Moderator
    #7852

    Hey John

    By the sounds of it you should just be able to do the same as the price slider – just use the meta key that reflects the age range value and this should work?

    Thanks

    John Emerson
    #7859

    Thanks for the response. The price slider checks if a single value exists within the range. For the age range, I have *two* values I want to check the range against, a minimum and a maximum. A kids book might be appropriate for ages 5-7, so should show up on a range search for books between ages 6-18. I’d like to do this within a single range query search if possible.

    Ross Moderator
    #7871

    I’m not sure this will be possible.

    Can you tell me how you are creating the fields exactly, ie the settings from ACF?

    Also, would you be able to provide the structure of the data that is stored? (I’m guessing this may be serialized?)

    Actually if the data is serialised, and you are storing numbers (ages) it almost definitely won’t work..

    Thanks

    John Emerson
    #7928

    Min_Age and Max_Age are two separate Advance Custom Fields, both with field type number. The rest of the settings for these fields are blank / default.

    Currently I have an item listed that is recommended for 3-7 year old, so it should still show up when the range finder is set to search for items for 6-8 year olds.

    Ross Moderator
    #7964

    So you would like the ability to have two sliders, one for min age, and one for max?

    If you wanted a slider that would work as a slider across both those meta fields at the same time then this is not possible – the slider only takes 1 input to compare against…

    Let me know if I’m following you correctly.

    Thanks

    John Emerson
    #7968

    No, I don’t want two sliders checking each number individually.

    Since the range slider UI can take a minimum and maximum values as input, I thought I might be able to compare against BOTH minimum age and maximum age with a single slider.

    John Emerson
    #8048

    This is the sort of MySQL query that might do what I had in mind:
    SELECT * WHERE min_age < input_range_end OR max_age > input_range_start;

    Ross Moderator
    #8164

    Thats what I thought – you cannot have one slider checking against two different fields – so this is not possible I’m afraid – it can only compare directly against a single value/meta field..

    I can easily see the use case for it though so will try to include this in a future update.

    Thanks

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.