Custom field Date Filter not working

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Custom field Date Filter not working

This topic contains 9 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 2 years, 5 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #26301
    baumelerch71
    baumelerch71
    Participant

    Hi
    I have for each post an acf date-field and would like to have a filter for this.
    Creating the filter under “Frontend Search Settings -> Custom Fields” was no problem but it doesn’t work (other filters work fine), I get no searchresults.
    Is there a known issue with the date-filter or what could be the reason it doesn’t work for me?
    The only thing that stood out was that acf and asp use different date format (“d/m/Y” respectively “yy-mm-dd”) that don’t work for the other. Might this cause the error?

    Thanks and kind regards
    Stefan

    #26302
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    There is no known issue with the date filters at the moment for sure. Those are only the display formats, they does not affect the filters.

    The two most common issues are, that either the storage format or the operator is set incorrectly: https://i.imgur.com/szBx5FM.png
    At first, I would recommend trying different variations to see if that makes any difference. The default storage format of the filter is “ACF datetime field”, which is not the same as the simple “ACF date” field, I am almost sure, that that is the problem. Try chaning that option first.

    Best,
    Ernest Marcinko

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


    #26303
    baumelerch71
    baumelerch71
    Participant

    Thanks for the quick answer.
    I’m not sure if I understand correctly.
    Attached screenshots of my settings for the date fields (for acf: “Datum=Date”, “Datum/Uhrzeit = Date/Time”). This should be the same format, right?
    I also tried with “Datetime” fields (in either plugin) but that doesn’t work either.

    Attachments:
    You must be logged in to view attached files.
    #26315
    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 :)


    #26320
    baumelerch71
    baumelerch71
    Participant
    You cannot access this content.
    #26326
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thank you, I have found the problems, it is only the configuration.

    1. Issue: The abfahrtsart filter. Items matching that filter does not have either of the dates set, so setting any of the date filters will automatically give you no results whatsoever. You will have to either remove this, or set a value for each element.

    2. Issue: The abfahrtsdatum filter Date storage format. It should be the default ACF Datetime field, as it is a datetime field as configured in ACF.
    The other filter storage format is okay, as it is ACF Date not datetime.

    Changing those will resolve the issue 🙂

    Best,
    Ernest Marcinko

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


    #26327
    baumelerch71
    baumelerch71
    Participant

    Hi Ernest
    Thanks for checking but the issue remains.

    I removed the abfahrtsart filter and changed the abfahrtsdatum storage format to ACF date field.
    btw. here’s a test page with the filter on it: http://baumeler.ch.212-25-25-162.plesk01.iway.ch/test-abfahrten
    Do you have any other ideas? Otherwise we have to search for another solution for that filter.

    Kind regards
    Stefan

    #26328
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I removed the abfahrtsart filter and changed the abfahrtsdatum storage format to ACF date field.

    It should be the default “Mysql datetime/ACF Datetime” not “ACF Date”: https://i.imgur.com/scgocvk.png

    Best,
    Ernest Marcinko

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


    #26329
    baumelerch71
    baumelerch71
    Participant

    event though we have no time stored but only a date?
    I changed the format in both apps, aps and acf, to “ACF date” field

    #26333
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Yes, it is due to the storage format, date and datetime are very different. I don’t know if changing the format now will trigger ACF to convert all the previous values, so I would rather leave them as it was originally.

    Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.