mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-17 02:26:33 +00:00
Website: Product Configurator and Bootstrap 4 (#15965)
- Refactored Homepage with customisable Hero Section - New Homepage Section to add content on Homepage as cards or using Custom HTML - Products page at "/all-products" with customisable filters - Item Configure dialog to find an Item Variant filtered by attribute values - Contact Us dialog on Item page - Customisable Item page content using the Website Content field
This commit is contained in:
@@ -71,8 +71,7 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
||||
"items": get_product_list_for_group(product_group = self.name, start=start,
|
||||
limit=context.page_length + 1, search=frappe.form_dict.get("search")),
|
||||
"parents": get_parent_item_groups(self.parent_item_group),
|
||||
"title": self.name,
|
||||
"products_as_list": cint(frappe.db.get_single_value('Website Settings', 'products_as_list'))
|
||||
"title": self.name
|
||||
})
|
||||
|
||||
if self.slideshow:
|
||||
@@ -119,7 +118,7 @@ def get_product_list_for_group(product_group=None, start=0, limit=10, search=Non
|
||||
for item in data:
|
||||
set_product_info_for_website(item)
|
||||
|
||||
return [get_item_for_list_in_html(r) for r in data]
|
||||
return data
|
||||
|
||||
def get_child_groups_for_list_in_html(item_group, start, limit, search):
|
||||
search_filters = None
|
||||
@@ -141,7 +140,7 @@ def get_child_groups_for_list_in_html(item_group, start, limit, search):
|
||||
limit = limit
|
||||
)
|
||||
|
||||
return [get_item_for_list_in_html(r) for r in data]
|
||||
return data
|
||||
|
||||
def adjust_qty_for_expired_items(data):
|
||||
adjusted_data = []
|
||||
@@ -172,9 +171,7 @@ def get_item_for_list_in_html(context):
|
||||
context["show_availability_status"] = cint(frappe.db.get_single_value('Products Settings',
|
||||
'show_availability_status'))
|
||||
|
||||
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'
|
||||
products_template = 'templates/includes/products_as_list.html'
|
||||
|
||||
return frappe.get_template(products_template).render(context)
|
||||
|
||||
@@ -188,15 +185,20 @@ def get_group_item_count(item_group):
|
||||
|
||||
|
||||
def get_parent_item_groups(item_group_name):
|
||||
base_parents = [
|
||||
{"name": frappe._("Home"), "route":"/"},
|
||||
{"name": frappe._("All Products"), "route":"/all-products"},
|
||||
]
|
||||
if not item_group_name:
|
||||
return [{"name": frappe._("Home"), "route":"/"}]
|
||||
return base_parents
|
||||
|
||||
item_group = frappe.get_doc("Item Group", item_group_name)
|
||||
parent_groups = frappe.db.sql("""select name, route from `tabItem Group`
|
||||
where lft <= %s and rgt >= %s
|
||||
and show_in_website=1
|
||||
order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True)
|
||||
|
||||
return [{"name": frappe._("Home"), "route":"/"}] + parent_groups
|
||||
return base_parents + parent_groups
|
||||
|
||||
def invalidate_cache_for(doc, item_group=None):
|
||||
if not item_group:
|
||||
|
||||
@@ -45,7 +45,7 @@ class website_maker(object):
|
||||
website_settings.append("top_bar_items", {
|
||||
"doctype": "Top Bar Item",
|
||||
"label": _("Products"),
|
||||
"url": "/products"
|
||||
"url": "/all-products"
|
||||
})
|
||||
website_settings.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user