Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paginate not working with offset #4052

Closed
kh82 opened this issue Mar 26, 2019 · 0 comments
Closed

Paginate not working with offset #4052

kh82 opened this issue Mar 26, 2019 · 0 comments

Comments

@kh82
Copy link

kh82 commented Mar 26, 2019

Description

Updated from 3.0.x to latest, now paginate isn't working correctly when using an offset. The offset seems to truncate the entries from the beginning and end of the results.

Steps to reproduce

  1. New craft install, create a news section with 9 entries.

  2. Create a template with this Twig code:

    {%
    set news = craft.entries({
    	section: 'news'
    })
    .offset(2)
    .limit(1000)
    %}
    {% paginate news as articleInfo, articleEntries %}
        {% if articleEntries|length %}
            {% for article in articleEntries %}
                {{article.title}}
            {% endfor %}
        {% endif %}
        {% if articleInfo.prevUrl %}
            {{ articleInfo.prevUrl }
        {% endif %}
        {% if articleInfo.nextUrl %}
            {{ articleInfo.nextUrl }}
        {% endif %}
  3. You can see from the results that it lists items 3 to 7. So the offset has been applied to the beginning and to the end.

Additional info

  • Craft version: 3.1.19
  • PHP version: 7.2.4
  • Database driver & version: mysql 5.7.21
  • Plugins & versions: replicated on two different installs.

Site 1)
Comments Work 1.0.5
Craft Commerce 2.1.2
Freeform Lite 2.5.15
Gift Voucher 2.0.10
PayPal for Craft Commerce 2.0.0
Redactor 2.3.2
Star Ratings 2.1.1
Stripe for Craft Commerce 1.2.0
Super Table 2.1.16

Site 2)
Freeform Lite 2.5.15
Redactor 2.3.2
Redirect plugin for Craft 3 1.0.20
Super Table 2.1.16
schema 1.0.3

edit: didn't realise this would allow html, removed html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant