summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-09-01 14:19:16 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-09-01 14:19:16 +0700
commita08e9a90e24159b8d3a22844dac4416809c5ddff (patch)
treee37d2c3d6a277862f2ccf92224f6e6cfad1fae86
parent532336ef618e2e4b57092180e8d3ecf3c3b82bf2 (diff)
Fix solr product template
-rw-r--r--indoteknik_custom/models/solr/product_template.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py
index 692eaa94..63daeb46 100644
--- a/indoteknik_custom/models/solr/product_template.py
+++ b/indoteknik_custom/models/solr/product_template.py
@@ -106,14 +106,17 @@ class ProductTemplate(models.Model):
for template in self:
price_excl_after_disc = price_excl = discount = tax = 0
flashsale_data = tier1 = tier2 = tier3 = {}
-
+
for variant in template.product_variant_ids:
if price_excl_after_disc == 0 or variant._get_website_price_after_disc_and_tax() < price_excl_after_disc:
+ variant_flashsale = variant._get_flashsale_price()
+ flashsale_price = flashsale_data.get('flashsale_price')
+ if not flashsale_price or variant_flashsale['flashsale_price'] < flashsale_data.get('flashsale_price', 0):
+ flashsale_data = variant_flashsale
price_excl = variant._get_website_price_exclude_tax()
price_excl_after_disc = variant._get_website_price_after_disc_and_tax()
discount = variant._get_website_disc(0)
tax = variant._get_website_tax()
- flashsale_data = variant._get_flashsale_price()
# add price tiering for base price, discount, and price after discount (tier 1 - 3)
tier1 = variant._get_pricelist_tier1()
tier2 = variant._get_pricelist_tier2()