Make search field and custom fields filter results iindependently

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Make search field and custom fields filter results iindependently

This topic contains 7 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 6 years, 10 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #12915
    patriziord
    patriziord
    Participant

    Hi,

    I’m going to finish a travel agency website with a pretty good offers search system, in which you also previously helped me.

    I got a search text field and a date range filter with two ACF custom fields, the starting and the ending date for each single post offer.

    If I start typing on the search field, no results are shown, until you input the date range as well.
    Instead, if I start filling the dates first, results are shown immediatly, if there’s a match, and if I type in the search field after, those results are filtered both by search text and date range parameters.

    Is it feasibile the opposite way as well: to have the ASP results shown when I start typing on the search text field, so filtered only by text match and not by date range customs, until I put something into the dates fields as a further filter parameter?
    I think this could be the more intuitive way of using such a search system.

    Thanks!

    Patrizio

    • This topic was modified 6 years, 11 months ago by patriziord patriziord.
    • This topic was modified 6 years, 11 months ago by patriziord patriziord.
    Attachments:
    You must be logged in to view attached files.
    #12933
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    “If I start typing on the search field, no results are shown, until you input the date range as well.”

    That should not be happening at all, the default date range values should be in effect, so the posts within that range should be displayed.
    Can I take a look at this somewhere? I just tested this on my local environment, but appears to be working correctly, so there might be something conflicting (I guess).

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #12941
    patriziord
    patriziord
    Participant
    You cannot access this content.
    #12948
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thanks for the proper details!

    So, I have logged in and possibly found the problem. The ‘From’ date was set to the current date, as well as the ‘to’ date. This basically means that the plugin tries to find an item with the date exactly on the current day, therefore nothing was returned.

    I’ve made a change, that the ‘From’ date default value is set to 1 year before the current date: https://i.imgur.com/hpmbFOf.png
    You can of course change that to anything else, but make sure that it’s always set to sooner than the current date. It should return results now, even if the date is not selected first.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #12958
    patriziord
    patriziord
    Participant

    Thanks!

    I can see the changes in action.
    Now I made the following, please let me know if it looks correct or not:
    custom field “dal” – from date, has now a Relative date with -1 days and 0 months from now
    custom field “al” – to date, has now a Relative date with 0 days and 12 months from now

    What I expect:
    the results showed and filtered first using the text field only (working);
    the results further filtered using the date fields immediately after the text;

    What I see:
    while the text field is now working like a charm, the date filters look not filtering anything anymore:
    both if I have typed something in the text field, both if I leave the text field alone, when I use the date fields it shows ALL the posts matching the -1 day + 12 months criteria, not matching any filter I try to set on the calendars.

    Could you please check?
    Shouldn’t it let me see something like the following?
    I type “Atene”, and it shows me immediately the right post
    Then I set a range of dates, from, to: if the “Atene” post dates match that criteria, I see it still there, otherwise not.

    Cheers,

    Patrizio

    #12971
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I type “Atene”, and it shows me immediately the right post
    Then I set a range of dates, from, to: if the “Atene” post dates match that criteria, I see it still there, otherwise not.

    But that is exactly what is happening. If I search for Atene, I see the ‘Atene’ post returned. Then if I change the filters, the post stays there if the date matches, or disappears if it does not.
    The ‘Atene’ post ‘dal’ date is 29/07/2017, so if I set a date after that on the ‘dal’ filter (for example 31/07/2017), it disappears as excpected: https://i.imgur.com/Ck3RLYp.jpg
    If I set a date before that (for example 27/07/2017), then it is displayed, also as expected: https://i.imgur.com/6JMc0qg.jpg

    Is this not correct?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #13123
    patriziord
    patriziord
    Participant

    Hi Ernest,

    sorry for the late reply. Yes, I think this is the correct behaviour, made a bit of confusion.
    Please mark this topic as solved.
    Cheers,

    Patrizio

    #13128
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


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

The topic ‘Make search field and custom fields filter results iindependently’ is closed to new replies.