Pagination Not Working

  • NTINC
    Participant
    3 years, 9 months ago #20834

    We are using pro version, we noticed that pagination starts at 0, when you click page 2 it loads page 1 which is duplicate of initial results set. So in pagination page 1 and 2 are duplicates. Any ideas?

    wpsolr
    Keymaster
    3 years, 9 months ago #20859

    Can you check your debug.log, and js console errors?

    NTINC
    Participant
    3 years, 9 months ago #20887

    Yes, checked the debug log and js console no errors that would relate to this. There is js error that deals with select2 which is used on a filter.

    wpsolr
    Keymaster
    3 years, 9 months ago #20892

    Did you customize WPSOLR’s code?

    NTINC
    Participant
    3 years, 9 months ago #20941

    No we are using out of the box template.

    wpsolr
    Keymaster
    3 years, 9 months ago #20943

    With your theme’s search template, or the WPSOLR’s Ajax search template?

    webmasterbslnl
    Participant
    3 years, 8 months ago #21494

    I noticed the same problem using WPSOLR’s Ajax search template. Pagination button ‘1’ links to &page=0. PM me if you need a demo.

    wpsolr
    Keymaster
    3 years, 8 months ago #21504

    This pagination problem will be fixed with the next release.
    Here is a workaround in the meantime:
    – Edit file /wp-content/plugins/wpsolr-pro/wpsolr-templates/twig/search/pagination.twig
    – On line 17, replace id="{{ page }}" with id="{{ page+1 }}"

    wpsolr
    Keymaster
    duck
    Participant
    2 years ago #29492

    Pagination is currently showing the next page highlighted in the pagination instead of the current page. When on page 1 it highlights and turns the text red for page 2. Page 2 shows 3 in red and so on. I tried changing the twig template and either introduced a negative number or a 0 but the identification was still never on the correct page.

    Also, the page does not go back to the top of the page when switching to the next pagination page. Is this normal behavior or is it supposed to go back to the top of the page?

    duck
    Participant
    2 years ago #29493

    I was able to fix the incorrect pagination identifier by changing this line:
    <a class=”paginate {{ (page == pages.current_page) ? ‘active’ : ” }}”
    to:
    <a class=”paginate {{ (page == pages.current_page -1) ? ‘active’ : ” }}”

    Is there a way to turn off ajax pagination so that the page will reload at the top on the next page? So that the user does not need to scroll back up each time.

    wpsolr
    Keymaster
    2 years ago #29499

    Ajax pagination is triggered on css selector ‘a.page-numbers,a.paginate’.
    You can set it up differently on the “Theme” add-on, with a non-existing selector for instance. Or change the twig template’s <a class="paginate" ... > to something else.

    • This reply was modified 2 years ago by wpsolr.
Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.