Item, Item Group and Partner Web Page generators moved from Shopping Cart to ERPNext
diff --git a/erpnext/templates/pages/__init__.py b/erpnext/templates/pages/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/templates/pages/__init__.py
diff --git a/erpnext/templates/pages/partners.html b/erpnext/templates/pages/partners.html
new file mode 100644
index 0000000..089c15b
--- /dev/null
+++ b/erpnext/templates/pages/partners.html
@@ -0,0 +1,30 @@
+{% block title %} {{ title }} {% endblock %}
+
+{% block header %}<h2>{{ title }}</h2>{% endblock %}
+
+{% block content %}
+<div class="partners-content">
+ {% for partner_info in partners %}
+ <div class="row">
+ <div class="col-md-3">
+ {% if partner_info.logo -%}
+ <a href="{{ partner_info.page_name }}">
+ <img itemprop="brand" src="{{ partner_info.logo }}" class="partner-logo"
+ alt="{{ partner_info.partner_name }}" title="{{ partner_info.partner_name }}" />
+ </a>
+ {%- endif %}
+ </div>
+ <div class="col-md-9">
+ <a href="{{ partner_info.page_name }}">
+ <h4>{{ partner_info.partner_name }}</h4>
+ </a>
+ <p style="color: #999">{{ partner_info.territory }} - {{ partner_info.partner_type }}</p>
+ <p>{{ partner_info.introduction }}</p>
+ </div>
+ </div>
+ <hr>
+ {% endfor %}
+</div>
+{% endblock %}
+
+{% block sidebar %}{% include "templates/includes/sidebar.html" %}{% endblock %}
\ No newline at end of file
diff --git a/erpnext/templates/pages/partners.py b/erpnext/templates/pages/partners.py
new file mode 100644
index 0000000..94b553c
--- /dev/null
+++ b/erpnext/templates/pages/partners.py
@@ -0,0 +1,13 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+import frappe.website.render
+
+def get_context(context):
+ return {
+ "partners": frappe.db.sql("""select * from `tabSales Partner`
+ where show_in_website=1 order by name asc""", as_dict=True),
+ "title": "Partners"
+ }
diff --git a/erpnext/templates/pages/product_search.html b/erpnext/templates/pages/product_search.html
new file mode 100644
index 0000000..8e57cb5
--- /dev/null
+++ b/erpnext/templates/pages/product_search.html
@@ -0,0 +1,33 @@
+{% block title %} {{ "Product Search" }} {% endblock %}
+
+{% block header %}<h2>Product Search</h2>{% endblock %}
+
+{% block content %}
+<script>{% include "templates/includes/product_list.js" %}</script>
+
+<script>
+$(document).ready(function() {
+ var txt = get_url_arg("q");
+ $(".search-results").html("Search results for: " + txt);
+ window.search = txt;
+ window.start = 0;
+ window.get_product_list();
+});
+</script>
+
+{% include "templates/includes/product_search_box.html" %}
+<div class="product-search-content">
+ <h3 class="search-results">Search Results</h3>
+ <div id="search-list" class="row">
+
+ </div>
+ <div style="text-align: center;">
+ <div class="more-btn"
+ style="display: none; text-align: center;">
+ <button class="btn">More...</button>
+ </div>
+ </div>
+</div>
+{% endblock %}
+
+{% block sidebar %}{% include "templates/includes/sidebar.html" %}{% endblock %}
\ No newline at end of file
diff --git a/erpnext/templates/pages/product_search.py b/erpnext/templates/pages/product_search.py
new file mode 100644
index 0000000..8d4a8f6
--- /dev/null
+++ b/erpnext/templates/pages/product_search.py
@@ -0,0 +1,33 @@
+# Copyright (c) 2013, Web Notes 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
+from erpnext.templates.generators.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=10):
+ # base query
+ query = """select name, item_name, page_name, website_image, item_group,
+ web_long_description as website_description
+ from `tabItem` where docstatus = 0 and show_in_website = 1 """
+
+ # search term condition
+ if search:
+ query += """and (web_long_description like %(search)s or
+ item_name like %(search)s or name like %(search)s)"""
+ search = "%" + cstr(search) + "%"
+
+ # order by
+ query += """order by weightage desc, modified desc limit %s, %s""" % (start, limit)
+
+ data = frappe.db.sql(query, {
+ "search": search,
+ }, as_dict=1)
+
+ return [get_item_for_list_in_html(r) for r in data]
+