[BUG] get all variants for single product by useCategorySearch()
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
the only information i got is from the current variant
Expected Behavior
i want all variants within a single product on the listing page (i have to show all variants by hovering the current product)
Steps To Reproduce
- fetching data in
FrontendNavigationPage.vue
const categoryResponse = await search(foreignKey.value, {
withCmsAssociations: true,
query: {
...route.query,
},
});
- iterating trough elements in
CmsElementProductListing.vue - trying to access all variants for a single product
ProductCard.vue - within options there is just the current one (array with one item only), children is null, parent is null ...
- tried to get it by associations but still one entry in options and parent / children is null.
What am I doing wrong?
Environment
No response
Anything else?
No response
Due to performance reasons, showing the available options on product hover is a great case for async loading - and would be enough if the API responds really quick. Then I would try to use useProductSearch with combination of useProductConfigurator / useProduct to relatively easy extract the possible options.
The alternative option is to use the aggregations and take the possible options with all the listing elements (products) in just one request. @BrocksiNet had shown an example how to approach this: https://www.brocksi.net/blog/variants-selection-multi-page-or-single-page/#listing-with-all-options-for-products. that might br the case for useCategorySearch which also allows to use a search criteria (including aggregations).
We also have an internal Issue with that NEXT-36467.
The internal issue was closed. This is already working.