summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-10-06 14:11:15 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-10-06 14:11:15 +0700
commit7a23a18a45fbd38fabc33f4e1a74d9f31e86cd60 (patch)
tree01324a8202ef7de98a3f4d1d1f204a67ddaf10af
parent8737ffba70651633d06f5185659f4429b26bd18b (diff)
Fix get flash sale price on sync to solr
-rw-r--r--indoteknik_custom/models/solr/product_product.py2
-rw-r--r--indoteknik_custom/models/solr/product_template.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py
index 20a68b47..31a0026d 100644
--- a/indoteknik_custom/models/solr/product_product.py
+++ b/indoteknik_custom/models/solr/product_product.py
@@ -84,7 +84,7 @@ class ProductProduct(models.Model):
price_excl_after_disc = variant._get_website_price_after_disc_and_tax()
tax = variant._get_website_tax()
discount = variant._get_website_disc(0)
- flashsale_data = variant._get_flashsale_price()
+ flashsale_data = variant.with_context(price_for="web")._get_flashsale_price()
price_excl_v2 = variant._v2_get_website_price_exclude_tax()
price_excl_after_disc_v2 = variant._v2_get_website_price_after_disc_and_tax()
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py
index 30c3b3c5..d7439bcb 100644
--- a/indoteknik_custom/models/solr/product_template.py
+++ b/indoteknik_custom/models/solr/product_template.py
@@ -103,7 +103,7 @@ class ProductTemplate(models.Model):
tier_data = {}
for variant in template.product_variant_ids:
- variant_flashsale = variant._get_flashsale_price()
+ variant_flashsale = variant.with_context(price_for="web")._get_flashsale_price()
variant_flashsale_price = variant_flashsale.get('flashsale_price', 0)
flashsale_data_price = flashsale_data.get('flashsale_price', 0)