feat: update item group website slider
This commit is contained in:
parent
355943c3a0
commit
31a651365d
@ -222,4 +222,8 @@ body.product-page {
|
||||
.item-group-description {
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.carousel-inner.rounded-carousel {
|
||||
border-radius: $card-border-radius;
|
||||
}
|
||||
}
|
@ -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",
|
||||
|
@ -21,7 +21,8 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
||||
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 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
||||
"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):
|
||||
|
@ -73,7 +73,10 @@ class ProductFiltersBuilder:
|
||||
|
||||
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
|
||||
|
@ -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:
|
||||
|
@ -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'] -%}
|
||||
|
@ -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" %}
|
||||
|
@ -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" %}
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user