Forums Forums Search & Filter Pro Post date search not working as expect

Tagged: 

Viewing 10 posts - 1 through 10 (of 12 total)
  • Anonymous
    #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+02102017

    This 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
    #134479

    The 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
    #134486

    We’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
    #134488

    You 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

    Trevor
    #134490

    But, if you are using Ajax, make sure that is inside the ajax container code.

    Anonymous
    #134492

    How 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%2003102017

    This 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"
          }
        }
      }
    }
    Trevor
    #134494

    You need to follow the customisation guide here:

    https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results

    and then edit the results.php file (or are you using infinite scroll?) to add the code to the template, at the top.

    Anonymous
    #134504

    Yes we are using infinite scroll.

    Trevor
    #134506

    Then However, instead of copying the results.php file, use the results-infinite-scroll.php file and then rename it to results.php

    You can edit that file as you need (or remove bits).

    Trevor
    #134508

    The code needs to be here:

    	<div class='search-filter-results-list'>
    	<?php
    
    PUT THE CODE HERE
    
    		while ($query->have_posts())
Viewing 10 posts - 1 through 10 (of 12 total)