This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Search by date range with custom fields datepicker

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Search by date range with custom fields datepicker

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12413
    patriziordpatriziord
    Participant

    Hi,

    following your documentation here – https://goo.gl/T442YK – I’m building a search by date range for a travel agency.

    What I’ve done:

    1
    created two custom fields using ACF pro 5, datepickers, with the following settings
    “data inizio” – for the start date
    “data fine” – for the ending date
    each field has been set with the Return Value * format yymmdd

    2
    created three posts, setting each with different values onto my custom date fields

    3
    set your plugin in General Options in order to
    Search in posts
    Search in custom post types (drag the acf-field-group and acf-field to the right)
    search in selected custom fields (drag my two custom fields to the right)

    set up Frontend Search Settings options to use my custom fields, data inizio to show results after the date, data fine to show results before the date.

    The issue:
    I can’t get any result

    What I found so far:

    the plugin panel description for this scenario – see image http://imgur.com/a/pIyfS – looks valid up to ACF version 4 – see ACF 5 documentation here – https://goo.gl/aO8dn2

    Previous versions of ACF contained a setting called ‘Save Format’ allowing the developer to change the format saved in the DB. This setting has been removed in favor of a set format of ‘YYYYMMDD’.
    Please note that the value is always saved as YYYYMMDD in the DB.

    Also:
    taking a look into my DB the meta_value stored by ACF looks always like this – http://imgur.com/a/dlqGQ – in a longtext cell. Not a YYYYMMDD format.

    How could I make this work?

    If the issue is just a matter of updating the way your plugin retrieves dates,
    is it feasible to make a hard coded change in your code, while waiting for a upgrade – your help strongly needed 🙂 .

    If the issue is also / only about the way ACF stores the datepicker values, should I ask them as well?
    Or, in your opinion, is it possible the different date format – YYYYMMDD in documentation, the other one in my DB – is caused by some server settings of mine? Maybe PHP / MySql version.

    Thanks in advance.

    Patrizio

    #12414
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi Patrizio,

    Your configuration looks correct, looks like ACF simply switched to a MySQL datetime field. Luckily this is very simply fixable, by changing the field type to MySQL datetime: http://i.imgur.com/U1NoJVm.png

    I’ve made the change on your search instance, and tried to pick a few dates, and it appears to be working correctly now.

    #12415
    patriziordpatriziord
    Participant

    I was ready for some dark ride because of those premises.
    I’ve been lucky with that configuration, you’re awesome as usual, it was time to leave my review on Codecanyon.
    Thank you so much Ernest!

    Cheers,
    Patrizio

    #12426
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Search by date range with custom fields datepicker’ is closed to new replies.