Merge branch 'develop' into item-image-alt
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index 45526a3..f4c7376 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -123,6 +123,7 @@
"weightage",
"slideshow",
"website_image",
+ "website_image_alt",
"thumbnail",
"cb72",
"website_warehouse",
@@ -1054,15 +1055,21 @@
"fieldtype": "Data",
"label": "Default Manufacturer Part No",
"read_only": 1
+ },
+ {
+ "fieldname": "website_image_alt",
+ "fieldtype": "Data",
+ "label": "Image Alt Text"
}
],
"has_web_view": 1,
"icon": "fa fa-tag",
"idx": 2,
"image_field": "image",
+ "index_web_pages_for_search": 1,
"links": [],
"max_attachments": 1,
- "modified": "2020-07-31 21:21:10.956453",
+ "modified": "2020-08-07 14:24:58.384992",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index d7b43bf..d209f48 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -343,7 +343,7 @@
if variant:
context.variant = frappe.get_doc("Item", variant)
- for fieldname in ("website_image", "web_long_description", "description",
+ for fieldname in ("website_image", "website_image_alt", "web_long_description", "description",
"website_specifications"):
if context.variant.get(fieldname):
value = context.variant.get(fieldname)
diff --git a/erpnext/templates/generators/item/item_image.html b/erpnext/templates/generators/item/item_image.html
index 0dd4c35..5d46a45 100644
--- a/erpnext/templates/generators/item/item_image.html
+++ b/erpnext/templates/generators/item/item_image.html
@@ -23,7 +23,7 @@
})
</script>
{% else %}
-{{ product_image(website_image or image or 'no-image.jpg') }}
+{{ product_image(website_image or image or 'no-image.jpg', alt=website_image_alt or item_name) }}
{% endif %}
<!-- Simple image preview -->
diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html
index 3c82e90..ea6b00f 100644
--- a/erpnext/templates/includes/macros.html
+++ b/erpnext/templates/includes/macros.html
@@ -7,9 +7,9 @@
</div>
{% endmacro %}
-{% macro product_image(website_image, css_class="") %}
+{% macro product_image(website_image, css_class="", alt="") %}
<div class="border text-center rounded h-100 {{ css_class }}" style="overflow: hidden;">
- <img itemprop="image" class="website-image h-100 w-100" src="{{ frappe.utils.quoted(website_image or 'no-image.jpg') | abs_url }}">
+ <img itemprop="image" class="website-image h-100 w-100" alt="{{ alt }}" src="{{ frappe.utils.quoted(website_image or 'no-image.jpg') | abs_url }}">
</div>
{% endmacro %}