diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-08-19 09:23:53 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-08-19 09:23:53 +0700 |
| commit | f4f55acddc7d5b071289095b139614acce35308c (patch) | |
| tree | 5c2079172719847bafbdde2676563243986ef56a | |
| parent | ea746ffa7f6d0099bf8a1d470e51ab99653d27d3 (diff) | |
trying to fix bug solr
| -rw-r--r-- | indoteknik_custom/models/solr/product_template.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index c4aefe19..e362626b 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -121,12 +121,11 @@ class ProductTemplate(models.Model): "category_name": category_names, # Nama kategori sebagai list "description_t": template.website_description or '', "description_clean_t": cleaned_desc or '', - 'has_product_info_b': True, - 'publish_b': not template.unpublished, - 'sni_b': template.sni, - 'tkdn_b': template.tkdn, - "qty_sold_f": template.qty_sold, - "is_in_bu_b": is_in_bu, + 'has_product_info_b': self.bool_to_solr(True), + 'publish_b': self.bool_to_solr(not template.unpublished), + 'sni_b': self.bool_to_solr(template.sni), + 'tkdn_b': self.bool_to_solr(template.tkdn), + "is_in_bu_b": self.bool_to_solr(is_in_bu), "voucher_min_purchase_f" : voucher.min_purchase_amount or 0, "voucher_discount_type_s" : voucher.discount_type or '', "voucher_discount_amount_f" : voucher.discount_amount or 0, @@ -143,6 +142,10 @@ class ProductTemplate(models.Model): if not document.get('has_price_info_b'): template._sync_price_to_solr() + + def bool_to_solr(val): + return 'true' if val else 'false' + def get_category_hierarchy_ids(self, category_id): """ |
