From 9836f109c38d7f02c587329795e80e15ff33aafa Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 10 Oct 2023 17:09:23 +0700 Subject: add qty di nenu brang , filter ready stock, filter haga fix di page search --- src/lib/product/components/ProductSearch.jsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/lib/product/components/ProductSearch.jsx') 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) { -- cgit v1.2.3