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

Add category filter on product listing page #3980

Closed
4 tasks
bellodaniel opened this issue Jan 10, 2020 · 3 comments
Closed
4 tasks

Add category filter on product listing page #3980

bellodaniel opened this issue Jan 10, 2020 · 3 comments
Labels
question If you are not sure how sth works or want discuss someting

Comments

@bellodaniel
Copy link

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [ X] I am running the latest version
  • [X ] I checked the documentation and found no answer
  • [ X] I checked to make sure that this issue has not already been filed

Check our forum:

https://forum.vuestorefront.io/

Is there something you don't understand? What is it? Describe it.

Hello, I have connected the VueStorefront to the Magento 2 backend.
I need to add the category filters on the product page. I have imported the category_ids
attribute https://share.getcloudapp.com/QwuGnbgr and it shows on the sidebar, but it displays the category ID and not the name of the category.
https://share.getcloudapp.com/5zuJrdxw
Is there any way I can load the category name from its ID?
Thank you

Can't find what you're looking for?

Is there any way I can load the category name from its ID?

Keep the problem description concise and include:

  • A brief description of the problem,
  • Where the problem is occurring,
  • The length of time the problem has been occurring,
  • The size of the problem.

Additional information

@bellodaniel bellodaniel added the question If you are not sure how sth works or want discuss someting label Jan 10, 2020
@pkarw
Copy link
Collaborator

pkarw commented Jan 10, 2020

Hi there, there is an additional product.category property that can solve the issue. Example data feed:

curl 'https://storefrontapi.storefrontcloud.io/graphql/' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: https://storefrontapi.storefrontcloud.io' --data-binary '{"query":"{ products (filter:{\n      type_id:{eq:\"configurable\"}\n}) {\n  items { \n    name\n    category { name, slug, category_id }\n    price\n    description\n    configurable_children { name, price }\n  }\n}\n}\n\n"}' --compressed

The structure:

 category { name, slug, category_id }

You need to include this field in the config.entities.productList.includeField

@pkarw pkarw closed this as completed Jan 10, 2020
@saraElsanan
Copy link

I used category_ids but it only gives the Ids of the categories
So what exactly the right way to get the category,
Under config.entities.productList.includeField I wrote category and product.category
Then inside defaultFilters I wrote them , but nothing is shown

@lalitabo
Copy link

@saraElsanan
did you got the solution ?
I also got ids of category instead category name any idea how to get category name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question If you are not sure how sth works or want discuss someting
Projects
None yet
Development

No branches or pull requests

4 participants