diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-26 10:37:39 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-26 10:37:39 +0700 |
| commit | eb849656d807aa22d14f97f79b6114c599628b42 (patch) | |
| tree | 249270eee3bf5b02830a786e984f65f92cee7c4c /src | |
| parent | e7566a1b7ecd3d4752e342a18eb3c9b5e65ce1d2 (diff) | |
<iman> back to original code before stock
Diffstat (limited to 'src')
| -rw-r--r-- | src/pages/api/shop/search.js | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js index f476faf8..6f98efcb 100644 --- a/src/pages/api/shop/search.js +++ b/src/pages/api/shop/search.js @@ -18,8 +18,6 @@ export default async function handler(req, res) { let { stock = '' } = req.query; - let isStock = false - let paramOrderBy = ''; switch (orderBy) { case 'price-asc': @@ -29,13 +27,12 @@ export default async function handler(req, res) { paramOrderBy += 'price_tier1_v2_f DESC'; break; case 'popular': - paramOrderBy += 'stock_total_f DESC, product_rating_f DESC, search_rank_i DESC,'; + paramOrderBy += 'product_rating_f DESC, search_rank_i DESC,'; break; case 'popular-weekly': paramOrderBy += 'search_rank_weekly_i DESC'; break; case 'stock': - isStock = true paramOrderBy += 'product_rating_f DESC, stock_total_f DESC'; break; case 'flashsale-price-asc': @@ -97,7 +94,7 @@ export default async function handler(req, res) { .join(' OR ')}` ); // if (category) parameter.push(`fq=category_name:${capitalizeFirstLetter(category.replace(/,/g, ' OR '))}`) - if (stock || isStock) parameter.push(`fq=stock_total_f:[0.1 TO *]`); + if (stock) parameter.push(`fq=stock_total_f:{1 TO *}`); // Single fq in url params if (typeof fq === 'string') parameter.push(`fq=${fq}`); |
