Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Infinite scroll not working on initial load

Viewing 5 posts - 21 through 25 (of 25 total)
  • Ross Moderator
    #178516
    This reply has been marked as private.
    Ross Moderator
    #180069
    This reply has been marked as private.
    Ross Moderator
    #180440
    This reply has been marked as private.
    IT Administrator
    #181241
    This reply has been marked as private.
    Ross Moderator
    #182076

    Hi Jane

    Apologies for the delay – there’s been a good few things happenening and this slipped between the cracks.

    In regards to your original problem, you were setting the second hidden date field with JS, and it was not being picked up properly on load more / pagination.

    Well, we have a filter that allows you to set various attributes / values of each input field, via PHP (which I think may be more reliable):

    https://searchandfilter.com/documentation/action-filter-reference/#filter-input-object

    It actually gets a bit tricky targeting the second date field, as both the fields have the same name, so I did a little test and wrote this snippet which should work (add to functions.php):

    add_filter('sf_input_object_pre', 'filter_input_object', 10, 2);
    global $from_to_field_count;
    $from_to_field_count = 0;
    
    function filter_input_object($input_object, $sfid){
    	
    	//we need to target the second field with this name, 
    	$date_field_name = "_sfm_my_date_field";
    	
    	if( $date_field_name === $input_object['name']){
    		global $from_to_field_count;
    		$from_to_field_count++;
    		
    		if(2 === $from_to_field_count){
    			$input_object['attributes']['value'] = "29/07/2018";
    		}
    	}
    	
    	return $input_object;	
    }

    Make sure to replace _sfm_my_date_field with the name of your date field.

    Let me know how you get on!

    Thanks

Viewing 5 posts - 21 through 25 (of 25 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.