diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-05-05 09:46:05 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-05-05 09:46:05 +0700 |
| commit | 957246b5836f94f3663230545467407740f10736 (patch) | |
| tree | 92732a1c19265d8120ff714135bb8526dfc3117e | |
| parent | 55a29fb33823733e486a24e6d5747b58d531294a (diff) | |
push
| -rw-r--r-- | indoteknik_custom/models/solr/product_template.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 4b7139bd..20402c84 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -85,7 +85,12 @@ class ProductTemplate(models.Model): cleaned_desc = BeautifulSoup(template.website_description or '', "html.parser").get_text() website_description = template.website_description if cleaned_desc else '' - carousel_images = ', '.join([self.env['ir.attachment'].api_image('image.carousel', 'image', carousel.id) for carousel in template.image_carousel_lines]) + # carousel_images = ', '.join([self.env['ir.attachment'].api_image('image.carousel', 'image', carousel.id) for carousel in template.image_carousel_lines]) + carousel_images = [] + for carousel in template.image_carousel_lines: + image_url = self.env['ir.attachment'].api_image('image.carousel', 'image', carousel.id) + if image_url: # Hanya tambahkan jika URL valid + carousel_images.append(image_url) document = solr_model.get_doc('product', template.id) document.update({ "id": template.id, @@ -95,7 +100,7 @@ class ProductTemplate(models.Model): "product_rating_f": template.virtual_rating, "product_id_i": template.id, "image_s": self.env['ir.attachment'].api_image('product.template', 'image_512', template.id), - "image_carousels": carousel_images, + "image_carousel_ss": carousel_images, 'image_mobile_s': self.env['ir.attachment'].api_image('product.template', 'image_256', template.id), "variant_total_i": template.product_variant_count, "stock_total_f": template.qty_stock_vendor, |
