Forums › Forums › Search & Filter Pro › Post date search not working as expect
Tagged: date filter
- This topic has 11 replies, 2 voices, and was last updated 7 years, 1 month ago by Trevor.
-
Anonymous(Private) October 3, 2017 at 8:37 am #134468
I am finding that if you just set a From date it doesn’t return only posts newer than the From date. I have to set a To date for this to work as expected.
This returns results between the two values
?_sft_region=eurasia&post_date=02092017+02102017This returns doesn’t do filter by date at all
?_sft_region=eurasia&post_date=01092017+Is this expected behavior?
Can you also let me know how I can check the query being generated via the AJAX call?
?sfid=69865&sf_action=get_data&sf_data=all&_sft_region=eurasia&post_date=01092017+Thank you
Trevor(Private) October 3, 2017 at 9:49 am #134479The date as you have it cannot have an empty second field, so if you want to have some like 01092017 and later, you need to use javascript to set a date well into the future to the second field. If you don’t want to user to be able to set that second field at all (I have made one site like that), then hide that second field.
With a range date setup, the form will not auto submit until both dates are set.
If you have the
Make searches bookmarkable
set, it should show the search in the URL bar.Anonymous(Private) October 3, 2017 at 9:58 am #134486We’ve had to customise things a little so we are perhaps submitting the form ourselves before both date fields are set. I’ll check on this.
Can you tell me how I see the actual query generated via the AJAX request? I need this to help resolve some data issues I may or may not have as a result of a data migration process. Thank you.
Trevor(Private) October 3, 2017 at 10:08 am #134488You could add it to the template and show the array, as shown in this post:
https://support.searchandfilter.com/forums/topic/how-do-i-get-the-form-fieldvalues/#post-131197
Anonymous(Private) October 3, 2017 at 10:18 am #134492How do I put that inside the ajax container if using the shortcode?
do_shortcode('[searchandfilter id="69865" show="results"]');
I have put it before the shortcode in my template and get some output but it’s missing sft_region data.
This is the URL
?_sft_region=eurasia&post_date=01092016%2003102017This is the output on page reload
Dump => array(1) { ["_sf_post_date"] => array(1) { ["active_terms"] => array(2) { [0] => array(1) { ["value"] => string(8) "01092016" } [1] => array(1) { ["value"] => string(8) "03102017" } } } }
-
AuthorPosts