summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/solr
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2024-07-26 06:53:58 +0000
committerIT Fixcomart <it@fixcomart.co.id>2024-07-26 06:53:58 +0000
commit310dc5b1ae50cec8e24cc36ace4d440b42f27eff (patch)
treee90a3cbec5a494dfaf8ecb8de4e76256c952a91e /indoteknik_custom/models/solr
parent88035e3c9586fdd58275834f64b6cad4c8df0711 (diff)
parent2813f944bb28906bdc7348bb7437af77a85c68cf (diff)
Merged in feature/iman-categories-homepage (pull request #181)
Feature/iman categories homepage
Diffstat (limited to 'indoteknik_custom/models/solr')
-rw-r--r--indoteknik_custom/models/solr/product_template.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py
index 3305c7ba..19143be3 100644
--- a/indoteknik_custom/models/solr/product_template.py
+++ b/indoteknik_custom/models/solr/product_template.py
@@ -66,11 +66,8 @@ class ProductTemplate(models.Model):
variant_codes = ', '.join([x.default_code or '' for x in template.product_variant_ids])
# Mengumpulkan semua kategori
- category_ids = []
- category_names = []
- for category in template.public_categ_ids:
- category_ids.append(category.id)
- category_names.append(category.name)
+ category_ids = [category.id for category in template.public_categ_ids]
+ category_names = [category.name for category in template.public_categ_ids]
document = solr_model.get_doc('product', template.id)
document.update({
@@ -93,7 +90,7 @@ class ProductTemplate(models.Model):
"variants_code_t": variant_codes,
"search_rank_i": template.search_rank,
"search_rank_weekly_i": template.search_rank_weekly,
- "category_id_i": ','.join(map(str, category_ids)), # ID kategori sebagai string yang dipisahkan koma
+ "category_id_ids": category_ids, # ID kategori sebagai string yang dipisahkan koma
"category_name_s": ', '.join(category_names), # Nama kategori sebagai string yang dipisahkan koma
"category_name": category_names, # Nama kategori sebagai list
"description_t": template.website_description or '',
@@ -102,12 +99,12 @@ class ProductTemplate(models.Model):
'sni_b': template.unpublished,
'tkdn_b': template.unpublished,
"qty_sold_f": template.qty_sold,
- "voucher_pastihemat" : {
- "min_purchase" : voucher.min_purchase_amount,
- "discount_type" : voucher.discount_type,
- "discount_amount" : voucher.discount_amount,
- "max_discount" : voucher.max_discount_amount
- }
+ # "voucher_pastihemat" : {
+ # "min_purchase" : voucher.min_purchase_amount,
+ # "discount_type" : voucher.discount_type,
+ # "discount_amount" : voucher.discount_amount,
+ # "max_discount" : voucher.max_discount_amount
+ # }
})
self.solr().add(docs=[document], softCommit=True)