diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-08-24 03:26:47 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-08-24 03:26:47 +0000 |
| commit | e7566a1b7ecd3d4752e342a18eb3c9b5e65ce1d2 (patch) | |
| tree | 95f97180ad71cf28762230a03c57ad5ee54e4f6b /src | |
| parent | 8260fe6032e50ca0410dc999c4bc0a62b0d0579e (diff) | |
| parent | 49118c78bf93fbb4d35b163e4c4b6db0f0f8be27 (diff) | |
Merged in Feature/ready-stock (pull request #266)
<iman> update search sort by stock on populer
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/product/components/ProductSearch.jsx | 2 | ||||
| -rw-r--r-- | src/pages/api/shop/search.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index 24cdc690..9f19aced 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -42,7 +42,7 @@ const ProductSearch = ({ const [q, setQ] = useState(query?.q || '*'); const [search, setSearch] = useState(query?.q || '*'); const [limit, setLimit] = useState(router.query?.limit || 30); - const [orderBy, setOrderBy] = useState(router.query?.orderBy || 'stock'); + const [orderBy, setOrderBy] = useState(router.query?.orderBy || 'popular'); const [finalQuery, setFinalQuery] = useState({}); const [queryFinal, setQueryFinal] = useState({}); const [dataCategoriesProduct, setDataCategoriesProduct] = useState([]) diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js index eadccede..f476faf8 100644 --- a/src/pages/api/shop/search.js +++ b/src/pages/api/shop/search.js @@ -29,7 +29,7 @@ export default async function handler(req, res) { paramOrderBy += 'price_tier1_v2_f DESC'; break; case 'popular': - paramOrderBy += 'product_rating_f DESC, search_rank_i DESC,'; + paramOrderBy += 'stock_total_f DESC, product_rating_f DESC, search_rank_i DESC,'; break; case 'popular-weekly': paramOrderBy += 'search_rank_weekly_i DESC'; |
