Website Changes

This commit is contained in:
Kanchan Chauhan 2016-04-22 14:39:02 +05:30 committed by Anand Doshi
parent 0394aec6a4
commit e0818f8f46
5 changed files with 76 additions and 1 deletions

View File

@ -49,7 +49,7 @@ def get_transaction_list(doctype, txt=None, filters=None, limit_start=0, limit_p
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"))

View File

@ -63,3 +63,6 @@
border-top: 2px solid #EBEFF2;
padding-top: 10px;
}
.featured-products {
border-top: 1px solid #EBEFF2;
}

View File

@ -74,3 +74,7 @@
border-top: 2px solid @light-border-color;
padding-top:10px;
}
.featured-products {
border-top: 1px solid @light-border-color;
}

View File

@ -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 %}

View File

@ -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]