diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2024-08-05 13:17:10 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2024-08-05 13:17:10 +0700 |
| commit | 3d1758a7b6969822e85cbd3cf16f7ad6e64de553 (patch) | |
| tree | b22115b0956a5c9e8c5ec502f6919034a92af191 /src | |
| parent | 73c8846a85e4ddd1a5806aaf82f831cf8e718b83 (diff) | |
| parent | 455ebc5c02657a6c1c328977e08176e222c56ddd (diff) | |
Merge branch 'CR/query_search' into development
# Conflicts:
# src/lib/product/components/ProductSearch.jsx
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/product/components/ProductSearch.jsx | 5 | ||||
| -rw-r--r-- | src/pages/api/shop/search.js | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index 09534a5d..a83e5e1e 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -41,8 +41,6 @@ const ProductSearch = ({ const { page = 1 } = query; 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 || 'popular'); const [finalQuery, setFinalQuery] = useState({}); const [queryFinal, setQueryFinal] = useState({}); const [dataCategoriesProduct, setDataCategoriesProduct] = useState([]) @@ -50,6 +48,8 @@ const ProductSearch = ({ const categoryId = getIdFromSlug(prefixUrl) const [data, setData] = useState([]) const [dataLob, setDataLob] = useState([]); + const [limit, setLimit] = useState(query?.limit || 30); + const [orderBy, setOrderBy] = useState(router.query?.orderBy); if (defaultBrand) query.brand = defaultBrand.toLowerCase(); const dataIdCategories = [] useEffect(() => { @@ -267,6 +267,7 @@ const ProductSearch = ({ const orderOptions = [ + { value: '', label: 'Pilih Filter' }, { value: 'price-asc', label: 'Harga Terendah' }, { value: 'price-desc', label: 'Harga Tertinggi' }, { value: 'popular', label: 'Populer' }, diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js index b6b8c795..29471f7b 100644 --- a/src/pages/api/shop/search.js +++ b/src/pages/api/shop/search.js @@ -39,7 +39,7 @@ export default async function handler(req, res) { paramOrderBy += 'flashsale_price_f ASC'; break; default: - paramOrderBy += 'product_rating_f DESC, price_discount_f DESC'; + paramOrderBy += ''; break; } @@ -56,7 +56,7 @@ export default async function handler(req, res) { `start=${parseInt(offset)}`, `rows=${limit}`, `sort=${paramOrderBy}`, - `fq=-publish_b:false`, + `fq=-publish_b:false, product_rating_f:[13 TO *], discount_tier1_v2_f:[1 TO *]`, ]; if (priceFrom > 0 || priceTo > 0) { |
