• Resolved cvokk

    (@cvokk)


    WP 4.1
    jQuery 1.11.1

    After setting for example last 7 days and submitting filters, the url looks like this:

    wp-admin/edit.php?orderby=date&order=asc&s&post_status=all&post_type=shop_order&action=-1&m=0&date_predefined=last-7-days&date_from&date_to=2015%2F02%2F05&method_id&payment_method_id&_customer_user&filter_action=Filtrovat&paged=1&mode=list&action2=-1

    no date_from is set that means that in the function filter_main_query defined in date-range-filter.php, the condition fails and no date range of the query is set.

    by debugging in admin.js, the code

    console.log({
    key:   $wrapper.find( 'select.field-predefined' ).find( ':selected' ).val(),
    start: $wrapper.find( '.date-inputs .field-from' ).val(),
    end:   $wrapper.find( '.date-inputs .field-to' ).val()
    });

    that is put in predefined.on({ (line 61)

    gives me this console output: Object { key="last-7-days", end="2015/02/05", start=""}

    no start date set, also whatever set, end date stays the same.

    Do you have any idea what may be wrong?
    values of to_val and from_val are correct, and outputting to console is called after setting values to input fields, just seems to me that they are not set properly..

    Thank you.

    https://wordpress.org/plugins/date-range-filter/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Jonathan Bardo

    (@jonathanbardo)

    I’m gussing there is a conflict between this plugin and another one. Have you tried the plugin on a fresh install of WordPress to see if it works for you? Also, what browser are you using (I honestly only tested with Chrome latest).

    Thread Starter cvokk

    (@cvokk)

    I’m using this plugin for Woocommerce orders filtering, which would be great function to add there..
    I’m using latest Firefox and browser most probably won’t be the problem, in Chrome the problem is the same.

    I have deactivated all plugins except Woocommerce and Date Range Filter and still no luck.

    Thread Starter cvokk

    (@cvokk)

    Just tried to set Custom date and that works.

    Thread Starter cvokk

    (@cvokk)

    This is strange:

    from.val(from_val).trigger( 'change', [ true ] );
    to.val(to_val).trigger( 'change', [ true ] );
    console.log(from.val());
    console.log(from_val);

    as you see, from_val is set to from
    console.log(from.val()); returns empty string
    console.log(from_val); returns proper value

    Thread Starter cvokk

    (@cvokk)

    Changing code like this:

    from.val(from_val);
    to.val(to_val);
    // from.val(from_val).trigger( 'change', [ true ] );
    // to.val(to_val).trigger( 'change', [ true ] );

    makes the plugin work as expected.. the change callback is to blame, not my other plugins 🙂

    Plugin Author Jonathan Bardo

    (@jonathanbardo)

    So actually I was saying that because we are using this exact version in production without any hiccups. Very strange…

    Thread Starter cvokk

    (@cvokk)

    Don’t know what’s wrong.. the callback seems to be ok..

    Anyway, thanks for very good plugin, I’ll leave it like this for now, it works the way my client needs. Should I mark this thread resolved?

    Regards
    Vit

    Plugin Author Jonathan Bardo

    (@jonathanbardo)

    You can mark this as resolved. Please be careful when new version come in as they may break your specific fix.

    Thread Starter cvokk

    (@cvokk)

    Ok, thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Posts are not filtered’ is closed to new replies.