website cleanups
diff --git a/erpnext/templates/generators/item.html b/erpnext/templates/generators/item.html
index d560b80..8db39a3 100644
--- a/erpnext/templates/generators/item.html
+++ b/erpnext/templates/generators/item.html
@@ -22,19 +22,20 @@
{% endif %}
</div>
<div class="col-md-6">
- <h3 itemprop="name" style="margin-top: 0px;">{{ item_name }}</h3>
- <p class="help">Item Code: <span itemprop="productID">{{ name }}</span></p>
- <h4>Product Description</h4>
+ <!-- <h3 itemprop="name" style="margin-top: 0px;">{{ item_name }}</h3> -->
<div itemprop="description">
- {{ web_long_description or description or "[No description given]" }}
+ {{ web_long_description or description or _("No description given") }}
</div>
+ <p class="text-muted">
+ {{ _("Item Code") }}: <span itemprop="productID">{{ name }}</span></p>
+ <br>
<div style="min-height: 100px; margin: 10px 0;">
<div class="item-price-info" style="display: none;">
<h4 class="item-price" itemprop="price"></h4>
<div class="item-stock" itemprop="availablity"></div>
<div id="item-add-to-cart">
<button class="btn btn-primary">
- <i class="icon-shopping-cart"></i> Add to Cart</button>
+ <i class="icon-shopping-cart"></i> + {{ _("Add to Cart") }}</button>
</div>
<div id="item-update-cart" class="input-group col-md-4" style="display: none;
padding-left: 0px; padding-right: 0px;">
@@ -51,7 +52,7 @@
{% if doc.get({"doctype":"Item Website Specification"}) -%}
<div class="row" style="margin-top: 20px">
<div class="col-md-12">
- <h4>Specifications</h4>
+ <h4>{{ _("Specifications") }}</h4>
<table class="table table-bordered" style="width: 100%">
{% for d in doc.get(
{"doctype":"Item Website Specification"}) -%}
diff --git a/erpnext/templates/generators/item_group.html b/erpnext/templates/generators/item_group.html
index 1415adf..c52629f 100644
--- a/erpnext/templates/generators/item_group.html
+++ b/erpnext/templates/generators/item_group.html
@@ -1,7 +1,3 @@
-{% block title %} {{ title }} {% endblock %}
-
-{% block header %}<h2>{{ title }}</h2>{% endblock %}
-
{% block content %}
<div class="item-group-content">
{% include 'templates/includes/product_search_box.html' %}
@@ -11,22 +7,9 @@
{% endif %}
{% if description %}<!-- description -->
<div itemprop="description">{{ description or ""}}</div>
- {% else %}
- <h3>{{ name }}</h3>
{% endif %}
</div>
<div>
- {% if sub_groups %}
- <hr />
- <div class="row">
- {% for d in sub_groups %}
- <div class="col-sm-4">
- <a href="{{ d.page_name }}">{{ d.name }} ({{ d.count }})</a>
- </div>
- {% endfor %}
- </div>
- <hr />
- {% endif %}
{% if items %}
<div id="search-list" class="row">
{% for item in items %}
@@ -37,7 +20,7 @@
<div class="alert alert-info info">Showing top 100 items.</div>
{% endif %}
{% else %}
- <div class="alert alert-warning">No items listed.</div>
+ <div class="text-muted">No items listed.</div>
{% endif %}
</div>
</div>
@@ -53,5 +36,3 @@
</script>
{% endblock %}
-
-{% block sidebar %}{% include "templates/includes/sidebar.html" %}{% endblock %}
diff --git a/erpnext/templates/generators/item_group.py b/erpnext/templates/generators/item_group.py
index 772f4f1..fab581c 100644
--- a/erpnext/templates/generators/item_group.py
+++ b/erpnext/templates/generators/item_group.py
@@ -13,9 +13,6 @@
def get_context(context):
item_group_context = context.doc.as_dict()
item_group_context.update({
- "sub_groups": frappe.db.sql("""select name, page_name
- from `tabItem Group` where parent_item_group=%s
- and ifnull(show_in_website,0)=1""", context.docname, as_dict=1),
"items": get_product_list_for_group(product_group = context.docname, limit=100),
"parent_groups": get_parent_item_groups(context.docname),
"title": context.docname
@@ -24,22 +21,20 @@
if context.doc.slideshow:
item_group_context.update(get_slideshow(context.doc))
- for d in item_group_context.get("sub_groups"):
- d.count = get_group_item_count(d.name)
-
return item_group_context
def get_product_list_for_group(product_group=None, start=0, limit=10):
child_groups = ", ".join(['"' + i[0] + '"' for i in get_child_groups(product_group)])
# 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
- and (item_group in (%s)
- or name in (select parent from `tabWebsite Item Group` where item_group in (%s))) """ % (child_groups, child_groups)
+ query = """select t1.name, t1.item_name, t1.page_name, t1.website_image, t1.item_group,
+ t1.web_long_description as website_description, t2.name as route
+ from `tabItem` t1, `tabWebsite Route` t2
+ where t1.show_in_website = 1 and (item_group in (%s)
+ or t1.name in (select parent from `tabWebsite Item Group` where item_group in (%s)))
+ and t1.name = t2.docname and t2.ref_doctype='Item' """ % (child_groups, child_groups)
- query += """order by weightage desc, modified desc limit %s, %s""" % (start, limit)
+ query += """order by t1.weightage desc, t1.modified desc limit %s, %s""" % (start, limit)
data = frappe.db.sql(query, {"product_group": product_group}, as_dict=1)