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/pages/api/shop/search.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/pages/api') diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js index b5161365..0c79831b 100644 --- a/src/pages/api/shop/search.js +++ b/src/pages/api/shop/search.js @@ -13,7 +13,8 @@ export default async function handler(req, res) { orderBy = '', operation = 'AND', fq = '', - limit = 30 + limit = 30, + stock = '' } = req.query let paramOrderBy = '' @@ -62,8 +63,9 @@ export default async function handler(req, res) { ) } - if (brand) parameter.push(`fq=manufacture_name:${brand}`) + if (brand) parameter.push(`fq=manufacture_name:${brand.replace(/,/g, ' OR ')}`) if (category) parameter.push(`fq=category_name:${category}`) + if (stock) parameter.push(`fq=stock_total_f:{1 TO *}`) // Single fq in url params if (typeof fq === 'string') parameter.push(`fq=${fq}`) -- cgit v1.2.3