diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-19 09:36:24 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-19 09:36:24 +0700 |
| commit | d1c0e083ac8f64dfaa8505fc11e30728dbd5a58d (patch) | |
| tree | 0f715c4420e83d3ece6bec1ffe42bf3e79699d12 | |
| parent | f19bed80a5711d2904745b1dff283d7936337b06 (diff) | |
<iman> update voucher pasti hemat avoid failed
| -rw-r--r-- | src/lib/product/components/ProductCard.jsx | 2 | ||||
| -rw-r--r-- | src/utils/solrMapping.js | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 35e2a665..b5bb147c 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -16,7 +16,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { const utmSource = useUtmSource(); const [discount, setDiscount] = useState(0); - let voucherPastiHemat = 0; + let voucherPastiHemat = product?.voucherPastiHemat ? 0 : product.newVoucherPastiHemat; if (product?.voucherPastiHemat ? product?.voucherPastiHemat.length : voucherPastiHemat > 0) { const stringVoucher = product?.voucherPastiHemat[0]; diff --git a/src/utils/solrMapping.js b/src/utils/solrMapping.js index d4694eb2..ff851f6c 100644 --- a/src/utils/solrMapping.js +++ b/src/utils/solrMapping.js @@ -38,6 +38,7 @@ export const productMappingSolr = (products, pricelist) => { qtySold: product?.qty_sold_f || 0, isTkdn:product?.tkdn_b || false, isSni:product?.sni_b || false, + newVoucherPastiHemat: [], voucherPastiHemat:product?.voucher_pastihemat || [] }; @@ -56,6 +57,14 @@ export const productMappingSolr = (products, pricelist) => { name: product.category_name_s || '', }, ]; + productMapped.newVoucherPastiHemat = [ + { + min_purchase: product.min_purchase_f || 0, + discount_type: product.discount_type_s || '', + discount_amount: product.discount_amount_f || 0, + max_discount: product.max_discount_f || 0, + }, + ]; return productMapped; }); }; |
