summaryrefslogtreecommitdiff
path: root/src/lib/product/components/ProductSearch.jsx
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-10-07 10:24:23 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-10-07 10:24:23 +0700
commit41a12de37fff3f716de77bb18c50073336f69ab4 (patch)
tree5de6b0e48df5267f0bd0fd99397157e7e57ee9fb /src/lib/product/components/ProductSearch.jsx
parent79e1000887b6326475251624575655bb65c296db (diff)
parent0b66e23353e002c9a9a74b1ef8f2ca152b6f6741 (diff)
<iman> perbaiki flash sale non display
Diffstat (limited to 'src/lib/product/components/ProductSearch.jsx')
-rw-r--r--src/lib/product/components/ProductSearch.jsx20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx
index 26114acf..f7b044aa 100644
--- a/src/lib/product/components/ProductSearch.jsx
+++ b/src/lib/product/components/ProductSearch.jsx
@@ -79,6 +79,24 @@ const ProductSearch = ({
}
}, [categoryId]);
+ useEffect(() => {
+ const checkIfPenawaran = async () => {
+ if (router.asPath.includes('penawaran')) {
+ query = {
+ ...query,
+ fq: [
+ `-flashsale_id_i:${router.query.penawaran}`,
+ `flashsale_price_f:[1 TO *]`,
+ ],
+ orderBy: 'flashsale-discount-desc',
+ };
+ setFinalQuery(query);
+ setOrderBy('flashsale-discount-desc');
+ }
+ };
+ checkIfPenawaran();
+ }, [router.query]);
+
const collectIds = (category) => {
const ids = [];
function recurse(cat) {
@@ -337,6 +355,7 @@ const ProductSearch = ({
const handleDeleteFilter = async (source, value) => {
let params = {
+ penawaran: router.query.penawaran,
q: router.query.q,
orderBy: orderBy,
brand: brandValues.join(','),
@@ -364,6 +383,7 @@ const ProductSearch = ({
break;
case 'delete':
params = {
+ penawaran: router.query.penawaran,
q: router.query.q,
orderBy: orderBy,
};