summaryrefslogtreecommitdiff
path: root/src/lib/product/components/ProductSearch.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/product/components/ProductSearch.jsx')
-rw-r--r--src/lib/product/components/ProductSearch.jsx19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx
index df9aa91b..3c3dbfd2 100644
--- a/src/lib/product/components/ProductSearch.jsx
+++ b/src/lib/product/components/ProductSearch.jsx
@@ -63,13 +63,26 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
}
}, [productFound, query, spellings])
- const brands = productSearch.data?.facetCounts?.facetFields?.manufactureName?.filter(
+ const brands = []
+ for (
+ let i = 0;
+ i < productSearch.data?.facetCounts?.facetFields?.manufactureName.length;
+ i += 2
+ ) {
+ const brand = productSearch.data?.facetCounts?.facetFields?.manufactureName[i]
+ const qty = productSearch.data?.facetCounts?.facetFields?.manufactureName[i + 1]
+ brands.push({ brand, qty })
+ }
+ /*const brandsList = productSearch.data?.facetCounts?.facetFields?.manufactureName?.filter(
(value, index) => {
if (index % 2 === 0) {
- return true
+ const brand = value
+ const qty = index + 1
+ brands.push({ brand, qty })
}
}
- )
+ )*/
+
const categories = productSearch.data?.facetCounts?.facetFields?.categoryName?.filter(
(value, index) => {
if (index % 2 === 0) {