summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-10-27 17:02:37 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-10-27 17:02:37 +0700
commit36a395626740cf36324d8fec0ba39a92477ad0ae (patch)
tree2d1e88864f3e99c5ee0374c0a64ebf4ae714ec69
parentf305582bc3336a19c07a2a0d9b9636413bb8c8a5 (diff)
<Miqdad> add voucher in variants
-rw-r--r--src/utils/solrMapping.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/utils/solrMapping.js b/src/utils/solrMapping.js
index 33f0cbaf..b7733e92 100644
--- a/src/utils/solrMapping.js
+++ b/src/utils/solrMapping.js
@@ -121,7 +121,6 @@ export const variantsMappingSolr = (parent, products, pricelist) => {
image: product.image_s || '',
code: product.default_code_s || '',
isFlashsale: flashsaleTime(product?.flashsale_end_date_s)?.isFlashSale,
- isFlashsale: flashsaleTime(product?.flashsale_end_date_s)?.isFlashSale,
name: product.display_name_s || '',
price: { price, priceDiscount, discountPercentage },
variantTotal: product.variant_total_i || 0,
@@ -140,12 +139,35 @@ export const variantsMappingSolr = (parent, products, pricelist) => {
logo: parent[0]?.x_logo_manufacture_s,
};
}
+
productMapped.parent = {
id: parent[0]?.product_id_i || '',
image: parent[0]?.image_s || '',
name: parent[0]?.name_s || '',
description: parent[0]?.description_t || '',
};
+
+ productMapped.newVoucherPastiHemat = [
+ {
+ min_purchase:
+ parent[0]?.voucher_min_purchase_f ??
+ product?.voucher_min_purchase_f ??
+ 0,
+ discount_type:
+ parent[0]?.voucher_discount_type_s ??
+ product?.voucher_discount_type_s ??
+ '',
+ discount_amount:
+ parent[0]?.voucher_discount_amount_f ??
+ product?.voucher_discount_amount_f ??
+ 0,
+ max_discount:
+ parent[0]?.voucher_max_discount_f ??
+ product?.voucher_max_discount_f ??
+ 0,
+ },
+ ];
+
return productMapped;
});
};