changeset 905801635f45 in modules/web_shop_shopify:default
details:
https://hg.tryton.org/modules/web_shop_shopify?cmd=changeset&node=905801635f45
description:
Set alt attribute of shopify image
issue10848
review360271002
diffstat:
product.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (34 lines):
diff -r c58de41014f9 -r 905801635f45 product.py
--- a/product.py Tue Oct 12 11:18:05 2021 +0200
+++ b/product.py Wed Oct 13 09:18:11 2021 +0200
@@ -574,12 +574,13 @@
if product_image is None:
product_image = shopify.Image()
product_image.attach_image(
- self.image, filename=slugify(self.shopify_filename))
+ self.image, filename=slugify(self.shopify_name))
product_image.product_id = self.template.get_shopify_identifier(shop)
+ product_image.alt = self.shopify_name
return product_image
@property
- def shopify_filename(self):
+ def shopify_name(self):
if self.product:
return self.product.rec_name
else:
@@ -590,12 +591,12 @@
__name__ = 'product.image'
@property
- def shopify_filename(self):
+ def shopify_name(self):
name = super().shopify_filename
if self.product:
attributes_name = self.product.attributes_name
else:
attributes_name = self.attributes_name
if attributes_name:
- name += '-' + attributes_name
+ name += ' ' + attributes_name
return name