chore: Removed Shopping Cart Module

- Moved all files and web templates from Shopping Cart to E-commerce module
- Made Shopping Cart module obsolete
- Moved select E-commerce related files from Portal to E-commerce module
- Minor cleanups
- Fixed Shopping Cart and Product Configurator tests
This commit is contained in:
marination
2021-02-25 13:56:38 +05:30
parent 37a246e738
commit 22f41a17b7
45 changed files with 182 additions and 141 deletions

View File

@@ -1,86 +0,0 @@
{%- macro slide(image, title, subtitle, action, label, index, align="Left", theme="Dark") -%}
{%- set align_class = resolve_class({
'text-right': align == 'Right',
'text-centre': align == 'Centre',
'text-left': align == 'Left',
}) -%}
{%- set heading_class = resolve_class({
'text-white': theme == 'Dark',
'': theme == 'Light',
}) -%}
<div class="carousel-item {{ 'active' if index=='1' else ''}}" style="height: 450px;">
<img class="d-block h-100 w-100" style="object-fit: cover;" src="{{ image }}" alt="{{ title }}">
{%- if title or subtitle -%}
<div class="carousel-body container d-flex {{ align_class }}">
<div class="carousel-content align-self-center">
{%- if title -%}<h1 class="{{ heading_class }}">{{ title }}</h1>{%- endif -%}
{%- if subtitle -%}<p class="{{ heading_class }} mt-2">{{ subtitle }}</p>{%- endif -%}
{%- if action -%}
<a href="{{ action }}" class="btn btn-primary mt-3">
{{ label }}
</a>
{%- endif -%}
</div>
</div>
{%- endif -%}
</div>
{%- endmacro -%}
{%- set hero_slider_id = 'id-' + frappe.utils.generate_hash('HeroSlider', 12) -%}
<div id="{{ hero_slider_id }}" class="section-carousel carousel slide" data-ride="carousel">
{%- if show_indicators -%}
<ol class="carousel-indicators">
{%- for index in ['1', '2', '3', '4', '5'] -%}
{%- if values['slide_' + index + '_image'] -%}
<li data-target="#{{ hero_slider_id }}" data-slide-to="{{ frappe.utils.cint(index) - 1 }}" class="{{ 'active' if index=='1' else ''}}"></li>
{%- endif -%}
{%- endfor -%}
</ol>
{%- endif -%}
<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'] -%}
{%- set subtitle = values['slide_' + index + '_subtitle'] -%}
{%- set primary_action = values['slide_' + index + '_primary_action'] -%}
{%- set primary_action_label = values['slide_' + index + '_primary_action_label'] -%}
{%- set align = values['slide_' + index + '_content_align'] -%}
{%- set theme = values['slide_' + index + '_theme'] -%}
{%- if image -%}
{{ slide(image, title, subtitle, primary_action, primary_action_label, index, align, theme) }}
{%- endif -%}
{%- endfor -%}
</div>
{%- if show_controls -%}
<a class="carousel-control-prev" href="#{{ hero_slider_id }}" role="button" data-slide="prev">
<div class="carousel-control">
<svg class="mr-1" width="20" height="20" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.625 3.75L6.375 9L11.625 14.25" stroke="#4C5A67" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#{{ hero_slider_id }}" role="button" data-slide="next">
<div class="carousel-control">
<svg class="ml-1" width="20" height="20" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.375 14.25L11.625 9L6.375 3.75" stroke="#4C5A67" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<span class="sr-only">Next</span>
</a>
{%- endif -%}
</div>
<script>
frappe.ready(function () {
$('.carousel').carousel({
interval: false,
pause: "hover",
wrap: true
})
});
</script>

View File

@@ -1,284 +0,0 @@
{
"creation": "2020-11-17 15:21:51.207221",
"docstatus": 0,
"doctype": "Web Template",
"fields": [
{
"fieldname": "slider_name",
"fieldtype": "Data",
"label": "Slider Name",
"reqd": 1
},
{
"default": "1",
"fieldname": "show_indicators",
"fieldtype": "Check",
"label": "Show Indicators",
"reqd": 0
},
{
"default": "1",
"fieldname": "show_controls",
"fieldtype": "Check",
"label": "Show Controls",
"reqd": 0
},
{
"fieldname": "slide_1",
"fieldtype": "Section Break",
"label": "Slide 1",
"reqd": 0
},
{
"fieldname": "slide_1_image",
"fieldtype": "Attach Image",
"label": "Image",
"reqd": 0
},
{
"fieldname": "slide_1_title",
"fieldtype": "Data",
"label": "Title",
"reqd": 0
},
{
"fieldname": "slide_1_subtitle",
"fieldtype": "Small Text",
"label": "Subtitle",
"reqd": 0
},
{
"fieldname": "slide_1_primary_action_label",
"fieldtype": "Data",
"label": "Primary Action Label",
"reqd": 0
},
{
"fieldname": "slide_1_primary_action",
"fieldtype": "Data",
"label": "Primary Action",
"reqd": 0
},
{
"fieldname": "slide_1_content_align",
"fieldtype": "Select",
"label": "Content Align",
"options": "Left\nCentre\nRight",
"reqd": 0
},
{
"fieldname": "slide_1_theme",
"fieldtype": "Select",
"label": "Slide Theme",
"options": "Dark\nLight",
"reqd": 0
},
{
"fieldname": "slide_2",
"fieldtype": "Section Break",
"label": "Slide 2",
"reqd": 0
},
{
"fieldname": "slide_2_image",
"fieldtype": "Attach Image",
"label": "Image ",
"reqd": 0
},
{
"fieldname": "slide_2_title",
"fieldtype": "Data",
"label": "Title ",
"reqd": 0
},
{
"fieldname": "slide_2_subtitle",
"fieldtype": "Small Text",
"label": "Subtitle ",
"reqd": 0
},
{
"fieldname": "slide_2_primary_action_label",
"fieldtype": "Data",
"label": "Primary Action Label ",
"reqd": 0
},
{
"fieldname": "slide_2_primary_action",
"fieldtype": "Data",
"label": "Primary Action ",
"reqd": 0
},
{
"default": "Left",
"fieldname": "slide_2_content_align",
"fieldtype": "Select",
"label": "Content Align",
"options": "Left\nCentre\nRight",
"reqd": 0
},
{
"fieldname": "slide_2_theme",
"fieldtype": "Select",
"label": "Slide Theme",
"options": "Dark\nLight",
"reqd": 0
},
{
"fieldname": "slide_3",
"fieldtype": "Section Break",
"label": "Slide 3",
"reqd": 0
},
{
"fieldname": "slide_3_image",
"fieldtype": "Attach Image",
"label": "Image",
"reqd": 0
},
{
"fieldname": "slide_3_title",
"fieldtype": "Data",
"label": "Title",
"reqd": 0
},
{
"fieldname": "slide_3_subtitle",
"fieldtype": "Small Text",
"label": "Subtitle",
"reqd": 0
},
{
"fieldname": "slide_3_primary_action_label",
"fieldtype": "Data",
"label": "Primary Action Label",
"reqd": 0
},
{
"fieldname": "slide_3_primary_action",
"fieldtype": "Data",
"label": "Primary Action",
"reqd": 0
},
{
"fieldname": "slide_3_content_align",
"fieldtype": "Select",
"label": "Content Align",
"reqd": 0
},
{
"fieldname": "slide_3_theme",
"fieldtype": "Select",
"label": "Slide Theme",
"options": "Dark\nLight",
"reqd": 0
},
{
"fieldname": "slide_4",
"fieldtype": "Section Break",
"label": "Slide 4",
"reqd": 0
},
{
"fieldname": "slide_4_image",
"fieldtype": "Attach Image",
"label": "Image",
"reqd": 0
},
{
"fieldname": "slide_4_title",
"fieldtype": "Data",
"label": "Title",
"reqd": 0
},
{
"fieldname": "slide_4_subtitle",
"fieldtype": "Small Text",
"label": "Subtitle",
"reqd": 0
},
{
"fieldname": "slide_4_primary_action_label",
"fieldtype": "Data",
"label": "Primary Action Label",
"reqd": 0
},
{
"fieldname": "slide_4_primary_action",
"fieldtype": "Data",
"label": "Primary Action",
"reqd": 0
},
{
"fieldname": "slide_4_content_align",
"fieldtype": "Select",
"label": "Content Align",
"reqd": 0
},
{
"fieldname": "slide_4_theme",
"fieldtype": "Select",
"label": "Slide Theme",
"options": "Dark\nLight",
"reqd": 0
},
{
"fieldname": "slide_5",
"fieldtype": "Section Break",
"label": "Slide 5",
"reqd": 0
},
{
"fieldname": "slide_5_image",
"fieldtype": "Attach Image",
"label": "Image",
"reqd": 0
},
{
"fieldname": "slide_5_title",
"fieldtype": "Data",
"label": "Title",
"reqd": 0
},
{
"fieldname": "slide_5_subtitle",
"fieldtype": "Small Text",
"label": "Subtitle",
"reqd": 0
},
{
"fieldname": "slide_5_primary_action_label",
"fieldtype": "Data",
"label": "Primary Action Label",
"reqd": 0
},
{
"fieldname": "slide_5_primary_action",
"fieldtype": "Data",
"label": "Primary Action",
"reqd": 0
},
{
"fieldname": "slide_5_content_align",
"fieldtype": "Select",
"label": "Content Align",
"reqd": 0
},
{
"fieldname": "slide_5_theme",
"fieldtype": "Select",
"label": "Slide Theme",
"options": "Dark\nLight",
"reqd": 0
}
],
"idx": 2,
"modified": "2020-12-29 12:30:02.794994",
"modified_by": "Administrator",
"module": "Shopping Cart",
"name": "Hero Slider",
"owner": "Administrator",
"standard": 1,
"template": "",
"type": "Section"
}

View File

@@ -1,38 +0,0 @@
{% from "erpnext/templates/includes/macros.html" import item_card, item_card_body %}
<div class="section-with-cards item-card-group-section">
<div class="item-group-header d-flex justify-content-between">
<div class="title-section">
{%- if title -%}
<h2 class="section-title">{{ title }}</h2>
{%- endif -%}
{%- if subtitle -%}
<p class="section-description">{{ subtitle }}</p>
{%- endif -%}
</div>
<div class="primary-action-section">
{%- if primary_action -%}
<a href="{{ action }}" class="btn btn-primary pull-right">
{{ primary_action_label }}
</a>
{%- endif -%}
</div>
</div>
<div class="row">
{%- for index in ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'] -%}
{%- set item = values['card_' + index + '_item'] -%}
{%- if item -%}
{%- set item = frappe.get_doc("Item", item) -%}
{{ item_card(
item.item_name, item.image, item.route, item.description,
None, item.item_group, values['card_' + index + '_featured'],
True, "Center"
) }}
{%- endif -%}
{%- endfor -%}
</div>
</div>
<style>
</style>

View File

@@ -1,273 +0,0 @@
{
"__unsaved": 1,
"creation": "2020-11-17 15:35:05.285322",
"docstatus": 0,
"doctype": "Web Template",
"fields": [
{
"fieldname": "title",
"fieldtype": "Data",
"label": "Title",
"reqd": 1
},
{
"fieldname": "subtitle",
"fieldtype": "Data",
"label": "Subtitle",
"reqd": 0
},
{
"__unsaved": 1,
"fieldname": "primary_action_label",
"fieldtype": "Data",
"label": "Primary Action Label",
"reqd": 0
},
{
"__islocal": 1,
"__unsaved": 1,
"fieldname": "primary_action",
"fieldtype": "Data",
"label": "Primary Action",
"reqd": 0
},
{
"fieldname": "card_1",
"fieldtype": "Section Break",
"label": "Card 1",
"reqd": 0
},
{
"fieldname": "card_1_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_1_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
},
{
"fieldname": "card_2",
"fieldtype": "Section Break",
"label": "Card 2",
"reqd": 0
},
{
"fieldname": "card_2_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_2_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
},
{
"fieldname": "card_3",
"fieldtype": "Section Break",
"label": "Card 3",
"options": "",
"reqd": 0
},
{
"fieldname": "card_3_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_3_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
},
{
"fieldname": "card_4",
"fieldtype": "Section Break",
"label": "Card 4",
"reqd": 0
},
{
"fieldname": "card_4_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_4_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
},
{
"fieldname": "card_5",
"fieldtype": "Section Break",
"label": "Card 5",
"reqd": 0
},
{
"fieldname": "card_5_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_5_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
},
{
"fieldname": "card_6",
"fieldtype": "Section Break",
"label": "Card 6",
"reqd": 0
},
{
"fieldname": "card_6_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_6_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
},
{
"fieldname": "card_7",
"fieldtype": "Section Break",
"label": "Card 7",
"reqd": 0
},
{
"fieldname": "card_7_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_7_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
},
{
"fieldname": "card_8",
"fieldtype": "Section Break",
"label": "Card 8",
"reqd": 0
},
{
"fieldname": "card_8_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_8_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
},
{
"fieldname": "card_9",
"fieldtype": "Section Break",
"label": "Card 9",
"reqd": 0
},
{
"fieldname": "card_9_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_9_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
},
{
"fieldname": "card_10",
"fieldtype": "Section Break",
"label": "Card 10",
"reqd": 0
},
{
"fieldname": "card_10_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_10_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
},
{
"fieldname": "card_11",
"fieldtype": "Section Break",
"label": "Card 11",
"reqd": 0
},
{
"fieldname": "card_11_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_11_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
},
{
"fieldname": "card_12",
"fieldtype": "Section Break",
"label": "Card 12",
"reqd": 0
},
{
"fieldname": "card_12_item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"fieldname": "card_12_featured",
"fieldtype": "Check",
"label": "Featured",
"reqd": 0
}
],
"idx": 0,
"modified": "2020-11-19 18:48:52.633045",
"modified_by": "Administrator",
"module": "Shopping Cart",
"name": "Item Card Group",
"owner": "Administrator",
"standard": 1,
"template": "",
"type": "Section"
}

View File

@@ -1,33 +0,0 @@
{
"__unsaved": 1,
"creation": "2020-11-17 15:28:47.809342",
"docstatus": 0,
"doctype": "Web Template",
"fields": [
{
"__unsaved": 1,
"fieldname": "item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"reqd": 0
},
{
"__unsaved": 1,
"fieldname": "featured",
"fieldtype": "Check",
"label": "Featured",
"options": "",
"reqd": 0
}
],
"idx": 0,
"modified": "2020-11-17 15:33:34.982515",
"modified_by": "Administrator",
"module": "Shopping Cart",
"name": "Product Card",
"owner": "Administrator",
"standard": 1,
"template": "",
"type": "Component"
}

View File

@@ -1,40 +0,0 @@
{%- macro card(title, image, url, text_primary=False) -%}
{%- set align_class = resolve_class({
'text-right': text_primary,
'text-centre': align == 'Center',
'text-left': align == 'Left',
}) -%}
<div class="card h-100">
{% if image %}
<img class="card-img-top" src="{{ image }}" alt="{{ title }}">
{% endif %}
<div class="card-body text-center text-muted small">
{{ title or '' }}
</div>
<a href="{{ url or '#' }}" class="stretched-link"></a>
</div>
{%- endmacro -%}
<div class="section-with-cards product-category-section">
{%- if title -%}
<h2 class="section-title">{{ title }}</h2>
{%- endif -%}
{%- if subtitle -%}
<p class="section-description">{{ subtitle }}</p>
{%- endif -%}
<!-- {%- set card_size = card_size or 'Small' -%} -->
<div class="{{ resolve_class({'mt-6': title}) }}">
<div class="card-grid">
{%- for index in ['1', '2', '3', '4', '5', '6', '7', '8'] -%}
{%- set category = values['category_' + index] -%}
{%- if category -%}
{%- set category = frappe.get_doc("Item Group", category) -%}
{{ card(category.name, category.image, category.route) }}
{%- endif -%}
{%- endfor -%}
</div>
</div>
</div>
<style>
</style>

View File

@@ -1,85 +0,0 @@
{
"__unsaved": 1,
"creation": "2020-11-17 15:25:50.855934",
"docstatus": 0,
"doctype": "Web Template",
"fields": [
{
"fieldname": "title",
"fieldtype": "Data",
"label": "Title",
"reqd": 1
},
{
"fieldname": "subtitle",
"fieldtype": "Data",
"label": "Subtitle",
"reqd": 0
},
{
"fieldname": "category_1",
"fieldtype": "Link",
"label": "Item Group",
"options": "Item Group",
"reqd": 0
},
{
"fieldname": "category_2",
"fieldtype": "Link",
"label": "Item Group",
"options": "Item Group",
"reqd": 0
},
{
"fieldname": "category_3",
"fieldtype": "Link",
"label": "Item Group",
"options": "Item Group",
"reqd": 0
},
{
"fieldname": "category_4",
"fieldtype": "Link",
"label": "Item Group",
"options": "Item Group",
"reqd": 0
},
{
"fieldname": "category_5",
"fieldtype": "Link",
"label": "Item Group",
"options": "Item Group",
"reqd": 0
},
{
"fieldname": "category_6",
"fieldtype": "Link",
"label": "Item Group",
"options": "Item Group",
"reqd": 0
},
{
"fieldname": "category_7",
"fieldtype": "Link",
"label": "Item Group",
"options": "Item Group",
"reqd": 0
},
{
"fieldname": "category_8",
"fieldtype": "Link",
"label": "Item Group",
"options": "Item Group",
"reqd": 0
}
],
"idx": 0,
"modified": "2020-11-18 17:26:28.726260",
"modified_by": "Administrator",
"module": "Shopping Cart",
"name": "Product Category Cards",
"owner": "Administrator",
"standard": 1,
"template": "",
"type": "Section"
}