From 6bd88bdb765c1ecc0518abeca77eca25bde2857b Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 17 Oct 2023 14:57:48 +0700
Subject: add lebel product terjual di product card dan product detail, bugfix
 queri solr untuk filter brand

---
 src/lib/product/components/ProductSearch.jsx | 6 +++---
 1 file changed, 3 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 fd75d587..dc9796f2 100644
--- a/src/lib/product/components/ProductSearch.jsx
+++ b/src/lib/product/components/ProductSearch.jsx
@@ -70,11 +70,11 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
   const brands = []
   for (
     let i = 0;
-    i < productSearch.data?.facetCounts?.facetFields?.manufactureName.length;
+    i < productSearch.data?.facetCounts?.facetFields?.manufactureNameS.length;
     i += 2
   ) {
-    const brand = productSearch.data?.facetCounts?.facetFields?.manufactureName[i]
-    const qty = productSearch.data?.facetCounts?.facetFields?.manufactureName[i + 1]
+    const brand = productSearch.data?.facetCounts?.facetFields?.manufactureNameS[i]
+    const qty = productSearch.data?.facetCounts?.facetFields?.manufactureNameS[i + 1]
     if (qty > 0) {
       brands.push({ brand, qty })
     }
-- 
cgit v1.2.3


From b29f07808f52d0b9b6ad9c76b182a6ccebb82c5e Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 17 Oct 2023 15:38:56 +0700
Subject: default filter by popular

---
 src/lib/product/components/ProductSearch.jsx | 6 +++---
 1 file changed, 3 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 dc9796f2..9d59b305 100644
--- a/src/lib/product/components/ProductSearch.jsx
+++ b/src/lib/product/components/ProductSearch.jsx
@@ -23,8 +23,9 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
   const { page = 1 } = query
   const [q, setQ] = useState(query?.q || '*')
   const [limit, setLimit] = useState(query?.limit || 30)
+  const [orderBy, setOrderBy] = useState(router.query?.orderBy || 'popular')
   if (defaultBrand) query.brand = defaultBrand.toLowerCase()
-  const { productSearch } = useProductSearch({ query: { ...query, q, limit } })
+  const { productSearch } = useProductSearch({ query: { ...query, q, limit, orderBy } })
   const [products, setProducts] = useState(null)
   const [spellings, setSpellings] = useState(null)
   const [bannerPromotionHeader, setBannerPromotionHeader] = useState(null)
@@ -303,10 +304,9 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => {
                   <select
                     name='urutan'
                     className='form-input mt-2'
-                    value={router.query?.orderBy || ''}
+                    value={orderBy}
                     onChange={(e) => handleOrderBy(e)}
                   >
-                    <option value=''>Urutkan</option>
                     {orderOptions.map((option, index) => (
                       <option key={index} value={option.value}>
                         {' '}
-- 
cgit v1.2.3

