Skip to content

Pagination returning wrong results #9255

@nicktan147

Description

@nicktan147

Preconditions

  1. XAMPP, Windows 10
  2. Magento 2.1

Steps to reproduce

  1. Installed Magento 2.1 with Sample Data, no other extension installed. Except this custom module.
  2. The code, assuming the setCurPage increases each time
$categoryProducts = $categoryFactory->create()
							      ->load($categoryId)
			    				      ->getProductCollection()
							      ->setPageSize(5)
							      ->setCurPage(1); 
  1. This category should have 10 products,
    Page 1 -> 5 products shown
    Page 2 -> 5 products shown
    Page 3 -> Same products from Page 2.

Expected result

  1. Page 3 shouldn't have shown any products at all since there is only 10 products.

Actual result

  1. This category should have 10 products,
    Page 1 -> 5 products shown
    Page 2 -> 5 products shown
    Page 3 -> Same products from Page 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions