[enhancement] use thumbnails in grid views, patch to make thumbnails
diff --git a/erpnext/templates/generators/item.html b/erpnext/templates/generators/item.html
index 30ccbce..f24b1a6 100644
--- a/erpnext/templates/generators/item.html
+++ b/erpnext/templates/generators/item.html
@@ -94,6 +94,8 @@
{% if variant_info %}
window.variant_info = {{ variant_info }};
+ {% else %}
+ window.variant_info = null;
{% endif %}
</script>
{% endblock %}
diff --git a/erpnext/templates/includes/product_in_grid.html b/erpnext/templates/includes/product_in_grid.html
index d2c1c46..ff39f1f 100644
--- a/erpnext/templates/includes/product_in_grid.html
+++ b/erpnext/templates/includes/product_in_grid.html
@@ -2,7 +2,7 @@
<a class="product-link" href="{{ (route or page_name)|abs_url }}">
<div class="col-sm-2 col-xs-4 product-image-wrapper">
- {{ product_image_square(website_image) }}
+ {{ product_image_square(thumbnail or website_image) }}
<div class="text-ellipsis inline-block small product-text">{{ item_name }}</div>
</div>
</a>
diff --git a/erpnext/templates/includes/product_in_list.html b/erpnext/templates/includes/product_in_list.html
index 2a6cbe1..8a4bdf6 100644
--- a/erpnext/templates/includes/product_in_list.html
+++ b/erpnext/templates/includes/product_in_list.html
@@ -3,7 +3,8 @@
<div style="height: 120px; overflow: hidden;">
<a href="{{ (route or page_name)|abs_url }}">
{%- if website_image -%}
- <img class="product-image" style="width: 80%; margin: auto;" src="{{ website_image|abs_url }}">
+ <img class="product-image" style="width: 80%; margin: auto;" src="{{
+ (thumbnail or website_image)|abs_url }}">
{%- else -%}
<div style="width: 80%; height: 120px; background-color: #F7FAFC;"></div>
{%- endif -%}
diff --git a/erpnext/templates/pages/product_search.py b/erpnext/templates/pages/product_search.py
index c0a020b..897a199 100644
--- a/erpnext/templates/pages/product_search.py
+++ b/erpnext/templates/pages/product_search.py
@@ -12,7 +12,7 @@
@frappe.whitelist(allow_guest=True)
def get_product_list(search=None, start=0, limit=10):
# base query
- query = """select name, item_name, page_name, website_image, item_group,
+ query = """select name, item_name, page_name, website_image, thumbnail, item_group,
web_long_description as website_description, parent_website_route
from `tabItem` where show_in_website = 1 and (variant_of is null or variant_of = '')"""