How can i display the list of products of a specifiy category?
All products are based on resources.
The structure looks like that:
- category 1
---- product 1
---- product 2
---- product 3
- category 2
---- product 4
---- product 5
I thought something like that would work:
123, 321, 213, 231
But there isn’t a &parent parameter, so how can i get all the ressource id’ from category 1?
Thanks for your help.
You’ll first need to iterate over the resources with getResources/pdoResources. Add the name of your products TV to &includeTVs.
Then in the template for that snippet, you can call commerce.get_products, passing the TV value into the &products property for get_products.
Thanks for your help. I thought that would be handled by Commerce directly.
Commerce is not quite that opinionated - it definitely could have a snippet that loops over resources and grabs all the TVs, but that locks you into a specific (resource) structure.
Now you can use the get_products snippets for anything no matter where you grab the product IDs from: on the product resource itself (
[[*products]]), in a get/pdoResources listing (
[[+tv.products]]), from a wishlist (cookielist or something else), or dynamically generate a list of product recommendations based on the current cart contents. Just feed the IDs into the snippet and format it any way you’d like.
One snippet to help with all of those (and many other) use cases is easier for us to maintain, and easier for users to learn
Hi @signalfeuer !
did you find a way to do it ?
i’m struggling with the same problem.
if you could share your code, that would be very helpfull !
ok, my problem is that i want to display products from different categories like you, but display on the homepage, so &parents=
[[*id]] don’t work
Can’t you enter the ids of your “product folders” instead?
yeah but it doesn’t work the way i want, have to dig a bit deeper
just solved it !
i’ve got categories without articles and articles are in sub-categories. i want to display 3 products only, not every product from every categories.
on homepage :
in ProductItemHomeDetailCarousel :
and in ProductItemHomeImage :