summaryrefslogtreecommitdiff
path: root/src/lib/product/components/ProductSearch.jsx
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-10-14 09:13:50 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-10-14 09:13:50 +0700
commit094c341e35376ee2c20e12031830c3020ffb251d (patch)
tree7c43436903879347406def4a5fc7a7c3d09659ac /src/lib/product/components/ProductSearch.jsx
parent37da993df233bafe389295d49e02eb57fa34c2bd (diff)
delete brand and category 0, & add product found in category filter
Diffstat (limited to 'src/lib/product/components/ProductSearch.jsx')
-rw-r--r--src/lib/product/components/ProductSearch.jsx17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx
index 3c954548..fd75d587 100644
--- a/src/lib/product/components/ProductSearch.jsx
+++ b/src/lib/product/components/ProductSearch.jsx
@@ -75,7 +75,9 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
) {
const brand = productSearch.data?.facetCounts?.facetFields?.manufactureName[i]
const qty = productSearch.data?.facetCounts?.facetFields?.manufactureName[i + 1]
- brands.push({ brand, qty })
+ if (qty > 0) {
+ brands.push({ brand, qty })
+ }
}
/*const brandsList = productSearch.data?.facetCounts?.facetFields?.manufactureName?.filter(
(value, index) => {
@@ -87,13 +89,22 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
}
)*/
- const categories = productSearch.data?.facetCounts?.facetFields?.categoryName?.filter(
+ const categories = []
+ for (let i = 0; i < productSearch.data?.facetCounts?.facetFields?.categoryName.length; i += 2) {
+ const name = productSearch.data?.facetCounts?.facetFields?.categoryName[i]
+ const qty = productSearch.data?.facetCounts?.facetFields?.categoryName[i + 1]
+ if (qty > 0) {
+ categories.push({ name, qty })
+ }
+ }
+
+ /*const categories = productSearch.data?.facetCounts?.facetFields?.categoryName?.filter(
(value, index) => {
if (index % 2 === 0) {
return true
}
}
- )
+ )*/
const orderOptions = [
{ value: 'price-asc', label: 'Harga Terendah' },