Skip to content

Found duplicate products in the REST API with pagination. #38461

Open
@Darshit190

Description

@Darshit190

Preconditions and environment

  • Magento version: 2.4.6-p4

Steps to reproduce

  1. Create a product attribute: attribute label "Is Featured", attribute code "is_featured" and type is Yes/No and sortable.
  2. Go to Attribute Sets and assign the "Is Featured" product attribute to the "Bag" attribute set.
  3. Open the product. SKU: 24-MB03
  4. Enable the "Is Featured" product attribute and save it.
  5. In the product search criteria, use the API method "GET" and add this URL, and run it for page 1. 
    https://example.com/rest/V1/products?searchCriteria[currentPage]=1&searchCriteria[pageSize]=9&searchCriteria[filter_groups][0][filters][0][field]=category_id&searchCriteria[filter_groups][0][filters][0][value]=3&searchCriteria[filter_groups][0][filters][0][condition_type]=eq&searchCriteria[filter_groups][1][filters][0][field]=visibility&searchCriteria[filter_groups][1][filters][0][value]=4&searchCriteria[filter_groups][1][filters][0][condition_type]=eq&searchCriteria[sortOrders][0][field]=is_featured&searchCriteria[sortOrders][0][direction]=desc&fields=items[id]
  6. In the product search criteria, use the API method "GET" and add this URL, and run it for page 4. (In other pages as well)
    https://example.com/rest/V1/products?searchCriteria[currentPage]=4&searchCriteria[pageSize]=9&searchCriteria[filter_groups][0][filters][0][field]=category_id&searchCriteria[filter_groups][0][filters][0][value]=3&searchCriteria[filter_groups][0][filters][0][condition_type]=eq&searchCriteria[filter_groups][1][filters][0][field]=visibility&searchCriteria[filter_groups][1][filters][0][value]=4&searchCriteria[filter_groups][1][filters][0][condition_type]=eq&searchCriteria[sortOrders][0][field]=is_featured&searchCriteria[sortOrders][0][direction]=desc&fields=items[id]

Expected result

In the API response output, if I set the sort order of the boolean product attribute, it should show unique products on every page.

Actual result

On page number one: ID 3 which we have enabled the "is_featured" product attribute So It's coming first.
{ "items": [ { "id": 3 }, { "id": 1 }, { "id": 2 }, { "id": 4 }, { "id": 5 }, { "id": 6 }, { "id": 7 }, { "id": 8 }, { "id": 9 } ] }

On page number four: I have found the duplicates products
{ "items": [ { "id": 9 }, { "id": 8 }, { "id": 7 }, { "id": 6 }, { "id": 5 }, { "id": 4 }, { "id": 2 } ] }

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: CatalogComponent: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Progress: ready for devReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions