diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css index 8b5b900ce5..25d08f615f 100644 --- a/erpnext/public/css/website.css +++ b/erpnext/public/css/website.css @@ -48,10 +48,12 @@ text-transform: uppercase; font-size: 12px; } +.product-search { + margin-bottom: 15px; +} @media (max-width: 767px) { .product-search { width: 100%; - margin-bottom: 13px; } } .borderless td, @@ -124,3 +126,24 @@ border-top: 1px solid #d1d8dd; padding-top: 15px; } +.product-list-link .row { + border-bottom: 1px solid #EBEFF2; +} +.product-list-link .row:hover { + background-color: #fafbfc; +} +.product-list-link .row > div { + padding-top: 15px; + padding-bottom: 15px; +} +.product-list-link:first-child .row { + border-top: 1px solid #EBEFF2; +} +.item-group-nav-buttons { + margin-top: 15px; +} +@media (min-width: 992px) { + .footer-subscribe { + max-width: 350px; + } +} diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less index b420ba6d8e..0246caccd5 100644 --- a/erpnext/public/less/website.less +++ b/erpnext/public/less/website.less @@ -50,16 +50,20 @@ padding: 15px 0px; } -.product-label{ +.product-label { padding-bottom: 4px; text-transform: uppercase; font-size: 12px; } +.product-search { + margin-bottom: 15px; +} + + @media (max-width: 767px) { .product-search { width: 100%; - margin-bottom: 13px; } } @@ -157,3 +161,31 @@ } } +.product-list-link { + .row { + border-bottom: 1px solid @light-border-color; + } + + .row:hover { + background-color: @light-bg; + } + + .row > div { + padding-top: 15px; + padding-bottom: 15px; + } +} + +.product-list-link:first-child .row { + border-top: 1px solid @light-border-color; +} + +.item-group-nav-buttons { + margin-top: 15px; +} + +@media (min-width: 992px) { + .footer-subscribe { + max-width: 350px; + } +} diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index 43b88d65f8..4b26cfc347 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe import urllib -from frappe.utils import nowdate +from frappe.utils import nowdate, cint, cstr from frappe.utils.nestedset import NestedSet from frappe.website.website_generator import WebsiteGenerator from frappe.website.render import clear_cache @@ -60,7 +60,8 @@ class ItemGroup(NestedSet, WebsiteGenerator): context.update({ "items": get_product_list_for_group(product_group = self.name, start=start, limit=24, search=frappe.form_dict.get("q")), "parent_groups": get_parent_item_groups(self.name), - "title": self.name + "title": self.name, + "products_as_list": cint(frappe.db.get_single_value('Website Settings', 'products_as_list')) }) if self.slideshow: @@ -73,8 +74,8 @@ def get_product_list_for_group(product_group=None, start=0, limit=10, search=Non child_groups = ", ".join(['"' + i[0] + '"' for i in get_child_groups(product_group)]) # base query - query = """select name, item_name, page_name, website_image, thumbnail, item_group, - web_long_description as website_description, + query = """select name, item_name, item_code, page_name, website_image, thumbnail, item_group, + description, web_long_description as website_description, concat(parent_website_route, "/", page_name) as route from `tabItem` where show_in_website = 1 @@ -89,7 +90,7 @@ def get_product_list_for_group(product_group=None, start=0, limit=10, search=Non query += """ and (web_long_description like %(search)s or item_name like %(search)s or name like %(search)s)""" - search = "%" + cstr(search) + "%" + search = "%" + cstr(search) + "%" query += """order by weightage desc, modified desc limit %s, %s""" % (start, limit) @@ -108,7 +109,12 @@ def get_item_for_list_in_html(context): # user may forget it during upload if (context.get("website_image") or "").startswith("files/"): context["website_image"] = "/" + urllib.quote(context["website_image"]) - return frappe.get_template("templates/includes/product_in_grid.html").render(context) + + products_template = 'templates/includes/products_as_grid.html' + if cint(frappe.db.get_single_value('Products Settings', 'products_as_list')): + products_template = 'templates/includes/products_as_list.html' + + return frappe.get_template(products_template).render(context) def get_group_item_count(item_group): child_groups = ", ".join(['"' + i[0] + '"' for i in get_child_groups(item_group)]) @@ -134,4 +140,4 @@ def invalidate_cache_for(doc, item_group=None): d = frappe.get_doc("Item Group", d.name) route = d.get_route() if route: - clear_cache(route) \ No newline at end of file + clear_cache(route) diff --git a/erpnext/templates/generators/item_group.html b/erpnext/templates/generators/item_group.html index 195b3c500c..d01426373b 100644 --- a/erpnext/templates/generators/item_group.html +++ b/erpnext/templates/generators/item_group.html @@ -27,19 +27,19 @@