Forums Forums Search & Filter Pro double load effect when there is only one page of results

Viewing 9 posts - 1 through 9 (of 9 total)
  • Trevor
    #234553
    This reply has been marked as private.
    Anonymous
    #234628
    This reply has been marked as private.
    Anonymous
    #235001
    This reply has been marked as private.
    Ross Moderator
    #235131
    This reply has been marked as private.
    Ross Moderator
    #235238

    Hi Jonathan

    So I found a solution to this.

    S&F was ignoring data-search-filter-action='infinite-scroll-end' on page load, and only looking for it AFTER fetching more results via Ajax.

    I have updated our plugin to fix this.

    All you need to do is add the attribute to your results somewhere, when you know the current set of results are in fact the total set of results, for my testing, I modified our infinite scroll template by doing this:

    Found <?php echo $query->found_posts; ?> Results<br />
    <?php
    	//prevent double load effect if the first set of results are the total results
    	$page = intval($query->query_vars['paged']);
    	$infinite_scroll_end_markup =  '';
    	if($page==1){
    		if(intval($query->found_posts) <= intval($query->query_vars['posts_per_page'])){
    			//then all the results loaded in the first page
    			$infinite_scroll_end_markup = " data-search-filter-action='infinite-scroll-end'";
    		}
    	}
    ?>
    <div class='search-filter-results-list' <?php echo $infinite_scroll_end_markup; ?>>
    

    I hope that helps 🙂

    Anonymous
    #235364
    This reply has been marked as private.
    Ross Moderator
    #235408

    Hi Jonathan

    Just to confirm that all worked ok and I can close this thread?

    Thanks

    Anonymous
    #276453

    What was the solution to get it working? Currently I use Timber and have some problems to get the filtered results.

    Trevor
    #276455

    I have made the one post was was important visible for you.

Viewing 9 posts - 1 through 9 (of 9 total)