[fix] don't show expired items in website item list. Fixes #4210.
diff --git a/erpnext/templates/generators/item.html b/erpnext/templates/generators/item.html
index acbcedf..500a118 100644
--- a/erpnext/templates/generators/item.html
+++ b/erpnext/templates/generators/item.html
@@ -24,7 +24,7 @@
 				{{ web_long_description or description or _("No description given") }}
 				</div>
 				<p class="text-muted">
-					{{ _("Item Code") }}: <span itemprop="productID">{{ name }}</span></p>
+					{{ _("Item Code") }}: <span itemprop="productID">{{ variant and variant.name or name }}</span></p>
 				<br>
 				<div class="item-attribute-selectors">
                     {% if has_variants %}
diff --git a/erpnext/templates/pages/product_search.py b/erpnext/templates/pages/product_search.py
index 897a199..9a6e8d3 100644
--- a/erpnext/templates/pages/product_search.py
+++ b/erpnext/templates/pages/product_search.py
@@ -3,7 +3,7 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe.utils import cstr
+from frappe.utils import cstr, nowdate
 from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_html
 
 no_cache = 1
@@ -14,7 +14,10 @@
 	# base query
 	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 = '')"""
+		from `tabItem`
+		where show_in_website = 1
+			and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %(today)s)
+			and (variant_of is null or variant_of = '')"""
 
 	# search term condition
 	if search:
@@ -29,6 +32,7 @@
 
 	data = frappe.db.sql(query, {
 		"search": search,
+		"today": nowdate()
 	}, as_dict=1)
 
 	for d in data: