feat: update item group website slider
diff --git a/erpnext/public/scss/shopping_cart.scss b/erpnext/public/scss/shopping_cart.scss
index adc6f1b..de55c50 100644
--- a/erpnext/public/scss/shopping_cart.scss
+++ b/erpnext/public/scss/shopping_cart.scss
@@ -222,4 +222,8 @@
.item-group-description {
max-width: 800px;
}
+
+ .carousel-inner.rounded-carousel {
+ border-radius: $card-border-radius;
+ }
}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/item_group/item_group.json b/erpnext/setup/doctype/item_group/item_group.json
index 119d541..31624ed 100644
--- a/erpnext/setup/doctype/item_group/item_group.json
+++ b/erpnext/setup/doctype/item_group/item_group.json
@@ -24,6 +24,7 @@
"route",
"weightage",
"slideshow",
+ "website_title",
"description",
"website_specifications",
"website_filters_section",
@@ -200,6 +201,11 @@
"fieldtype": "Table",
"label": "Attributes",
"options": "Website Attribute"
+ },
+ {
+ "fieldname": "website_title",
+ "fieldtype": "Data",
+ "label": "Title"
}
],
"icon": "fa fa-sitemap",
@@ -208,7 +214,7 @@
"is_tree": 1,
"links": [],
"max_attachments": 3,
- "modified": "2020-12-29 14:04:26.075008",
+ "modified": "2020-12-30 12:57:38.876956",
"modified_by": "Administrator",
"module": "Setup",
"name": "Item Group",
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index 7a60da3..f545b98 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -21,7 +21,8 @@
website = frappe._dict(
condition_field = "show_in_website",
template = "templates/generators/item_group.html",
- no_cache = 1
+ no_cache = 1,
+ no_breadcrumbs = 1
)
def autoname(self):
@@ -100,6 +101,29 @@
"title": self.name
})
+ if self.slideshow:
+ values = {
+ 'show_indicators': 1,
+ 'show_controls': 0,
+ 'rounded': 1,
+ 'slider_name': self.slideshow
+ }
+ slideshow = frappe.get_doc("Website Slideshow", self.slideshow)
+ slides = slideshow.get({"doctype":"Website Slideshow Item"})
+ for index, slide in enumerate(slides):
+ values[f"slide_{index + 1}_image"] = slide.image
+ values[f"slide_{index + 1}_title"] = slide.heading
+ values[f"slide_{index + 1}_subtitle"] = slide.description
+ values[f"slide_{index + 1}_theme"] = slide.theme or "Light"
+ values[f"slide_{index + 1}_content_align"] = slide.content_align or "Centre"
+ values[f"slide_{index + 1}_primary_action_label"] = slide.label
+ values[f"slide_{index + 1}_primary_action"] = slide.url
+
+ context.slideshow = values
+
+ context.breadcrumbs = 0
+ context.title = self.website_title or self.name
+
return context
def delete_child_item_groups_key(self):
diff --git a/erpnext/shopping_cart/filters.py b/erpnext/shopping_cart/filters.py
index 8c887f9..6c63d87 100644
--- a/erpnext/shopping_cart/filters.py
+++ b/erpnext/shopping_cart/filters.py
@@ -73,7 +73,10 @@
if selected_attributes:
valid_attributes.append(
- _dict(item_attribute_values=selected_attributes)
+ _dict(
+ item_attribute_values=selected_attributes,
+ name=attr_doc.name
+ )
)
return valid_attributes
diff --git a/erpnext/shopping_cart/product_query.py b/erpnext/shopping_cart/product_query.py
index 897e3b2..c5d3445 100644
--- a/erpnext/shopping_cart/product_query.py
+++ b/erpnext/shopping_cart/product_query.py
@@ -1,7 +1,6 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
class ProductQuery:
diff --git a/erpnext/shopping_cart/web_template/hero_slider/hero_slider.html b/erpnext/shopping_cart/web_template/hero_slider/hero_slider.html
index ace23bf..1b39534 100644
--- a/erpnext/shopping_cart/web_template/hero_slider/hero_slider.html
+++ b/erpnext/shopping_cart/web_template/hero_slider/hero_slider.html
@@ -37,7 +37,7 @@
{%- endfor -%}
</ol>
{%- endif -%}
- <div id="{{ slider_name }}423243" class="carousel-inner">
+ <div class="carousel-inner {{ resolve_class({'rounded-carousel': rounded }) }}">
{%- for index in ['1', '2', '3', '4', '5'] -%}
{%- set image = values['slide_' + index + '_image'] -%}
{%- set title = values['slide_' + index + '_title'] -%}
diff --git a/erpnext/templates/generators/item_group.html b/erpnext/templates/generators/item_group.html
index f2f16d8..393c3a4 100644
--- a/erpnext/templates/generators/item_group.html
+++ b/erpnext/templates/generators/item_group.html
@@ -1,7 +1,7 @@
{% extends "templates/web.html" %}
{% block header %}
-<h2 class="mb-6">{{ name }}</h2>
+<!-- <h2>{{ title }}</h2> -->
{% endblock header %}
{% block script %}
@@ -12,15 +12,22 @@
<div class="item-group-content" itemscope itemtype="http://schema.org/Product">
<div class="item-group-slideshow">
{% if slideshow %}<!-- slideshow -->
- {% include "templates/includes/slideshow.html" %}
+ {{ web_block(
+ "Hero Slider",
+ values=slideshow,
+ add_container=0,
+ add_top_padding=0,
+ add_bottom_padding=0,
+ ) }}
{% endif %}
+ <h2 class="mt-3">{{ title }}</h2>
{% if description %}<!-- description -->
- <div class="item-group-description" itemprop="description">{{ description or ""}}</div>
+ <div class="item-group-description text-muted mb-5" itemprop="description">{{ description or ""}}</div>
{% endif %}
</div>
- <div class="row mt-5">
+ <div class="row">
<div class="col-12 order-2 col-md-9 order-md-2 item-card-group-section">
- <div class="row">
+ <div class="row products-list">
{% if items %}
{% for item in items %}
{% include "erpnext/www/all-products/item_row.html" %}
diff --git a/erpnext/www/all-products/index.html b/erpnext/www/all-products/index.html
index 1d194ee..17e6d02 100644
--- a/erpnext/www/all-products/index.html
+++ b/erpnext/www/all-products/index.html
@@ -31,7 +31,7 @@
<div class="row">
<div class="col-12 order-2 col-md-9 order-md-2 item-card-group-section">
- <div class="row">
+ <div class="row products-list">
{% if items %}
{% for item in items %}
{% include "erpnext/www/all-products/item_row.html" %}
diff --git a/erpnext/www/all-products/index.js b/erpnext/www/all-products/index.js
index cb9e7e6..0721056 100644
--- a/erpnext/www/all-products/index.js
+++ b/erpnext/www/all-products/index.js
@@ -54,7 +54,7 @@
field_filters: JSON.stringify(if_key_exists(this.field_filters)),
attribute_filters: JSON.stringify(if_key_exists(this.attribute_filters)),
});
- window.history.pushState('filters', '', '/all-products?' + query_string);
+ window.history.pushState('filters', '', `${location.pathname}?` + query_string);
$('.page_content input').prop('disabled', true);
this.get_items_with_filters()