diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-10-18 16:18:45 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-10-18 16:18:45 +0700 |
| commit | 2a84fb3ce03cfa46cb3c7664e988957e1bd2731b (patch) | |
| tree | ae3768ba44054d51b1abcc0dcc90d18d4895e412 /src/pages/api/shop/variant.js | |
| parent | 754c2a0e97f0e18ed9b36445e883c38ea9a904f7 (diff) | |
| parent | b4b17e22832a4665042a45030b77c3744fe61534 (diff) | |
Merge branch 'master' into CR/UI
# Conflicts:
# src/lib/cart/components/Cartheader.jsx
Diffstat (limited to 'src/pages/api/shop/variant.js')
| -rw-r--r-- | src/pages/api/shop/variant.js | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/pages/api/shop/variant.js b/src/pages/api/shop/variant.js index 30213cc3..249d087e 100644 --- a/src/pages/api/shop/variant.js +++ b/src/pages/api/shop/variant.js @@ -54,7 +54,7 @@ export default async function handler(req, res) { if (priceFrom > 0 || priceTo > 0) { parameter.push( - `fq=price_discount_f:[${priceFrom == '' ? '*' : priceFrom} TO ${ + `fq=price_tier1_v2_f:[${priceFrom == '' ? '*' : priceFrom} TO ${ priceTo == '' ? '*' : priceTo }]` ) @@ -103,17 +103,12 @@ const escapeSolrQuery = (query) => { const productResponseMap = (products, pricelist) => { return products.map((product) => { - let price = product.price_f || 0 - let priceDiscount = product.price_discount_f || 0 - let discountPercentage = product.discount_f || 0 + let price = product.price_tier1_v2_f || 0 + let priceDiscount = 0 + let discountPercentage = 0 - if (pricelist) { - const pricelistDiscount = product?.[`price_${pricelist}_f`] || false - const pricelistDiscountPerc = product?.[`discount_${pricelist}_f`] || false - - if (pricelistDiscount && pricelistDiscount > 0) priceDiscount = pricelistDiscount - if (pricelistDiscountPerc && pricelistDiscountPerc > 0) - discountPercentage = pricelistDiscountPerc + if (pricelist && product?.[`price_${pricelist}_f`] < price) { + price = product?.[`price_${pricelist}_f`] || 0 } if (product?.flashsale_id_i > 0) { |
