All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Pagination links are not generated correctly

Gavin Lawrie 20 Feb 2016 01:12 problem, complete

Am using latest version of Low Search 4.4.1 on EE2.

Have a search results page that uses pagination.

The code being used is not complicated...

 
{exp:low_search:results query="{segment_3}" keywords:inflect="yes" orderby="low_search_collection:gen,features,resources,people,services" disable="member_data" limit="5"}

{if low_search_no_results} {!-- We didn't find anything... --}

No Results Found
You searched for {low_search_keywords} but we couldn't find anything in our site that has this content.

Please try again with a different search term.

{/if}
{if count =="1"}
You searched for {low_search_keywords}. There {if absolute_results == "1"}was just 1 result found.{if:else}were {absolute_results} results found.{/if}

{/if}

...results list stuff...

{sn_pagination}
{/exp:low_search:results}


Pagination code is standard stuff based on Ellis Lab examples, and works fine on pages that don't use Low Search to generate the list. Pagination code is:

{!-- Pagination: Start --} 
{paginate}
Page {current_page} of {total_pages} pages.

{pagination_links page_padding="3" always_show_first_last="no"}

{first_page}
  • «

  • {/first_page}

    {if previous_page}
    {previous_page}
  • {pagination_page_number}
    {/previous_page}
    {/if}

    {page}
    {pagination_page_number}
    {/page}

    {if next_page}
    {next_page}
    {pagination_page_number}
    {/next_page}
    {/if}

    {last_page}
    »
    {/last_page}

    {/pagination_links}
    {/paginate}

    {!-- Pagination: End --}


    On this page the pagination links work fine for the first page of output, but on subsequent pages the pagination URL's include the pagination segment from the current pagination page within the URL, and append a new pagination segment to the end of the URL. So you end up with pagination URLs that look like this:

    http://2gc.eu/gen/search-results/eyJrZXl3b3JkcyI6ImFsaWdubWVudCJ9/P15/P10


    (that's a live link, so you can see the problem in action [until I find a fix...]

    These links with two pagination segments don't work - as pagination uses the first to determine the next page, and so you are then stuck on the same page regardless of what pagination link you choose.

    Any idea what I'm doing wrong / and / or what I can to to fix?

    Thanks in advance for any help you can offer.

    Replies

    1. Low 20 Feb 2016 13:40

      It should work fine out of the box, so I'm not sure what's messing it up. You can try and set the paginate_base parameter to something like:

      paginate_base="gen/search-results/{segment_3}"

    2. Gavin Lawrie 20 Feb 2016 17:25

      Hello - thanks for the speedy reply. Setting 'paginate_base' fixes the problem: apologies I should have tried that first...
      Anyhow - thanks again for the greatly helpful reply.