mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 21:59:13 +00:00
Website Changes
This commit is contained in:
committed by
Anand Doshi
parent
0394aec6a4
commit
e0818f8f46
@@ -63,3 +63,6 @@
|
|||||||
border-top: 2px solid #EBEFF2;
|
border-top: 2px solid #EBEFF2;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
.featured-products {
|
||||||
|
border-top: 1px solid #EBEFF2;
|
||||||
|
}
|
||||||
|
|||||||
@@ -74,3 +74,7 @@
|
|||||||
border-top: 2px solid @light-border-color;
|
border-top: 2px solid @light-border-color;
|
||||||
padding-top:10px;
|
padding-top:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.featured-products {
|
||||||
|
border-top: 1px solid @light-border-color;
|
||||||
|
}
|
||||||
|
|||||||
31
erpnext/templates/pages/home.html
Normal file
31
erpnext/templates/pages/home.html
Normal 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 %}
|
||||||
37
erpnext/templates/pages/home.py
Normal file
37
erpnext/templates/pages/home.py
Normal 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]
|
||||||
|
|
||||||
Reference in New Issue
Block a user