summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/solr/product_product.py
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-09-13 14:49:13 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-09-13 14:49:13 +0700
commit4cfc5c3214cc6060f978bc9e1f52533899330ee2 (patch)
tree129c9f52f41604675ce3d630e6fe3045cdd15ff6 /indoteknik_custom/models/solr/product_product.py
parent7c67529ed27e32d32a6ddc4cd3fe296ce0d7bca2 (diff)
Update product and variant sync flashsale data
Diffstat (limited to 'indoteknik_custom/models/solr/product_product.py')
-rw-r--r--indoteknik_custom/models/solr/product_product.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py
index 7e2a99cc..93e26793 100644
--- a/indoteknik_custom/models/solr/product_product.py
+++ b/indoteknik_custom/models/solr/product_product.py
@@ -62,10 +62,11 @@ class ProductProduct(models.Model):
'category_name_s': category_name,
'category_name': category_name,
'search_rank_i': variant.product_tmpl_id.search_rank,
- 'has_product_info_b': True,
- 'search_rank_weekly_i': variant.product_tmpl_id.search_rank_weekly
+ 'search_rank_weekly_i': variant.product_tmpl_id.search_rank_weekly,
+ 'attributes': [x.name for x in variant.product_template_attribute_value_ids],
+ 'has_product_info_b': True
})
-
+
self.solr().add(docs=[document], softCommit=True)
variant.change_solr_data('Perubahan pada data product')
@@ -92,9 +93,12 @@ class ProductProduct(models.Model):
document = solr_model.get_doc('variants', variant.id)
document.update({
+ "id": variant.id,
"flashsale_id_i": flashsale_data.get('flashsale_id', 0),
"flashsale_tag_s": flashsale_data.get('flashsale_tag', ''),
"flashsale_name_s": flashsale_data.get('flashsale_name', ''),
+ "flashsale_start_date_s": flashsale_data.get('flashsale_start_date', ''),
+ "flashsale_end_date_s": flashsale_data.get('flashsale_end_date', ''),
"flashsale_base_price_f": flashsale_data.get('flashsale_base_price', 0),
"flashsale_discount_f": flashsale_data.get('flashsale_discount', 0),
"flashsale_price_f": flashsale_data.get('flashsale_price', 0),
@@ -102,13 +106,13 @@ class ProductProduct(models.Model):
"discount_f": discount,
"price_discount_f": price_excl_after_disc,
"tax_f": tax,
- "has_price_info_b": True,
"discount_tier1_f": tier1.get('discount_tier1', 0),
"price_tier1_f": tier1.get('price_tier1', 0),
"discount_tier2_f": tier2.get('discount_tier2', 0),
"price_tier2_f": tier2.get('price_tier2', 0),
"discount_tier3_f": tier3.get('discount_tier3', 0),
- "price_tier3_f": tier3.get('price_tier3', 0)
+ "price_tier3_f": tier3.get('price_tier3', 0),
+ "has_price_info_b": True
})
self.solr().add(docs=[document], softCommit=True)
variant.change_solr_data('Ada perubahan pada harga product')