Website Changes
diff --git a/erpnext/controllers/website_list_for_contact.py b/erpnext/controllers/website_list_for_contact.py
index 6b514b2..a1982ef 100644
--- a/erpnext/controllers/website_list_for_contact.py
+++ b/erpnext/controllers/website_list_for_contact.py
@@ -49,7 +49,7 @@
order_by = "modified desc"))
else:
return []
-
+
return post_process(doctype, get_list(doctype, txt, filters, limit_start, limit_page_length,
fields="name", order_by = "modified desc"))
diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css
index 8b455f3..a57bf33 100644
--- a/erpnext/public/css/website.css
+++ b/erpnext/public/css/website.css
@@ -63,3 +63,6 @@
border-top: 2px solid #EBEFF2;
padding-top: 10px;
}
+.featured-products {
+ border-top: 1px solid #EBEFF2;
+}
diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less
index 08ae03a..7b0f1d6 100644
--- a/erpnext/public/less/website.less
+++ b/erpnext/public/less/website.less
@@ -74,3 +74,7 @@
border-top: 2px solid @light-border-color;
padding-top:10px;
}
+
+.featured-products {
+ border-top: 1px solid @light-border-color;
+}
diff --git a/erpnext/templates/pages/home.html b/erpnext/templates/pages/home.html
new file mode 100644
index 0000000..5c0f330
--- /dev/null
+++ b/erpnext/templates/pages/home.html
@@ -0,0 +1,31 @@
+{% extends "templates/web.html" %}
+
+{% block title %}{{brand_html}}{% endblock %}
+
+{% block page_content %}
+<script>{% include "templates/includes/product_list.js" %}</script>
+
+<script>
+frappe.ready(function() {
+ window.start = 0;
+ window.get_product_list();
+});
+</script>
+
+<div class="row">
+ <div class="col-sm-12">
+ <h2 class="text-center">{{ tag_line }}</h2>
+ <p class="lead text-center">{{ description }}</p>
+ <p class="text-center"><a href="/login" class="btn btn-primary text-center">Login</a></p>
+ <div style="margin-top:75px;">
+ <h5>{{_("FEATURED PRODUCTS")}}</h5>
+ <div class="featured-products">
+ <div id="search-list" class="row" style="margin-top:40px;">
+
+ </div>
+ </div>
+ <p class="text-center"><a href="/products" class="btn btn-primary">More Products</a></p>
+ </div>
+ </div>
+</div>
+{% endblock %}
diff --git a/erpnext/templates/pages/home.py b/erpnext/templates/pages/home.py
new file mode 100644
index 0000000..af75097
--- /dev/null
+++ b/erpnext/templates/pages/home.py
@@ -0,0 +1,37 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.utils import cstr, nowdate
+from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_html
+
+no_cache = 1
+no_sitemap = 1
+
+@frappe.whitelist(allow_guest=True)
+def get_product_list(search=None, start=0, limit=6):
+ # limit = 12 because we show 12 items in the grid view
+
+ # 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 disabled=0
+ 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 = '')"""
+
+ # order by
+ query += """ order by weightage desc, idx desc, modified desc limit %s, %s""" % (start, limit)
+
+ data = frappe.db.sql(query, {
+ "today": nowdate()
+ }, as_dict=1)
+
+ for d in data:
+ d.route = ((d.parent_website_route + "/") if d.parent_website_route else "") \
+ + (d.page_name or "")
+
+ return [get_item_for_list_in_html(r) for r in data]
+