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

category_uid does not filter the product list #964

Open
nitinharikant opened this issue Oct 3, 2022 · 2 comments
Open

category_uid does not filter the product list #964

nitinharikant opened this issue Oct 3, 2022 · 2 comments

Comments

@nitinharikant
Copy link

Expected Behaviour

products are filtered based on category uid in the query param

Actual Behaviour

All the products are shown in PLP page even though we have query parameter category_uid= category_uid=NA==

Reproduce Scenario (including but not limited to)

Create a page using CIF examples PLP component
In the same page add query param category_uid = categoryid=NA== or Nw== depends on category
the products on PLP are not filtered
it works fine for category id
https://www.aemcomponents.dev/content/core-components-examples/library/commerce/search.html?category_id=3&search_query=test

Steps to Reproduce

Create a page using CIF examples PLP component
In the same page add query param category_uid = categoryid=NA== or Nw== depends on category
the products on PLP are not filtered

Platform and Version

AEM6.5.12 and CIF 2.11.0

Sample Code that illustrates the problem

image

Logs taken while reproducing problem

NA

@buuhuu
Copy link
Contributor

buuhuu commented Oct 10, 2022

This is behaviour works as designed. For product listing we consider the following two cases:

  1. product search

For product search the category context is not given by the url usually (meaning no category identifier is encoded in the url). In this case we do not remove the category aggregations from the search result set which allows the user to filter using the category facet. This facet is using the category_id only afaik

  1. product list pages

For product lists on a product list page the category context is given by the url (meaning the url contains the url_path or url_key of the category). In this case the category id aggregation is limited to the direct children of the current category for facet navigation. This is the case because we don't want to filter, but navigate to the actual child categories plp to leverage caching (which would not be the case when using a ?category_id= request parameter). The cateogry id aggregation does not provide enough information to generate these links the plps, hence this information is queried with the category query.

@cqueener
Copy link

Hello,
we are experiencing the same problem. The Search Result returns the aggregations - amongst them the categories - and when I try to filter by category on the result page the following URL params are created and sent:
?category_uid=103490&search_query=akkus
which results in a GraphQL Exception:
"message": "Value of uid "128442" is incorrect.",
"extensions": {
"category": "graphql-input"
},
Manually changing the URL Param to category_id rather then UID returns results.
With the category_uid Param the SearchResultServiceImpl always returns null

category = ((AbstractCategoryRetriever)categoryRetriever).fetchCategory();
                if (category == null) {
                    LOGGER.debug("Category not found.");
                    return new ImmutablePair((Object)null, searchResultsSet);
                }

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

3 participants