diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-09-08 10:59:55 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-09-08 10:59:55 +0700 |
| commit | 43f020d6f6ba271381e934c9e811f052de70a779 (patch) | |
| tree | defc0674d2c659ca4d5e24cbb22d103dcd130ec0 /indoteknik_custom/models | |
| parent | fa4f4e6f06ee77a2c448293c806d0f34e643f394 (diff) | |
fix flashsale product detail
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/solr/apache_solr.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/solr/product_product.py | 7 | ||||
| -rw-r--r-- | indoteknik_custom/models/solr/product_template.py | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/indoteknik_custom/models/solr/apache_solr.py b/indoteknik_custom/models/solr/apache_solr.py index 518280ac..fd4928e7 100644 --- a/indoteknik_custom/models/solr/apache_solr.py +++ b/indoteknik_custom/models/solr/apache_solr.py @@ -17,13 +17,13 @@ class ApacheSolr(models.Model): _order = 'id desc' def connect(self, schema): - env = config.get('solr_env', 'development') + env = config.get('solr_env', 'production') url = '' if env == 'development': url = 'http://192.168.23.5:8983/solr/' elif env == 'production': - url = 'http://10.148.0.5:8983/solr/' + url = 'http://34.101.189.218:8983/solr/' return pysolr.Solr(url + schema, always_commit=True, timeout=30) diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py index 48ee9daa..88ab8dd5 100644 --- a/indoteknik_custom/models/solr/product_product.py +++ b/indoteknik_custom/models/solr/product_product.py @@ -142,7 +142,7 @@ class ProductProduct(models.Model): 'name': doc.get('name_s'), 'image': doc.get('image_s'), }, - 'code': doc.get('default_code_s'), + 'code': doc.get('default_code_s', ''), 'name': doc.get('display_name_s'), 'price': { 'price': doc.get('price_f'), @@ -151,9 +151,10 @@ class ProductProduct(models.Model): }, 'stock': doc.get('stock_total_f'), 'weight': doc.get('weight_f'), - 'manufacture': None + 'manufacture': None, + 'is_flashsale': True if flashsale else False } - + manufacture_id = doc.get('manufacture_id_i') if manufacture_id: result['manufacture'] = { diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 9950c93a..e212c709 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -193,7 +193,7 @@ class ProductTemplate(models.Model): 'categories': [], 'flash_sale': { 'remaining_time': flashsale._remaining_time_in_second() or 0, - 'tag': flashsale.flashsale_tag or None + 'tag': doc.get('flashsale_tag_s') }, 'lowest_price': { 'price': doc.get('price_f'), |
