Merge pull request #22599 from frappe/shopping-cart-issue

refactor: shopping cart
This commit is contained in:
rohitwaghchaure
2020-07-08 13:09:59 +05:30
committed by GitHub
5 changed files with 211 additions and 767 deletions

View File

@@ -51,10 +51,12 @@ frappe.ready(function() {
if (referral_sales_partner) { if (referral_sales_partner) {
$(".txtreferral_sales_partner").val(referral_sales_partner); $(".txtreferral_sales_partner").val(referral_sales_partner);
} }
// update login // update login
shopping_cart.show_shoppingcart_dropdown(); shopping_cart.show_shoppingcart_dropdown();
shopping_cart.set_cart_count(); shopping_cart.set_cart_count();
shopping_cart.bind_dropdown_cart_buttons(); shopping_cart.bind_dropdown_cart_buttons();
shopping_cart.show_cart_navbar();
}); });
$.extend(shopping_cart, { $.extend(shopping_cart, {
@@ -177,4 +179,12 @@ $.extend(shopping_cart, {
}, },
show_cart_navbar: function () {
frappe.call({
method: "erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings.is_cart_enabled",
callback: function(r) {
$(".shopping-cart").toggleClass('hidden', r.message ? false : true);
}
});
}
}); });

View File

@@ -1,31 +1,32 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
$.extend(cur_frm.cscript, { frappe.ui.form.on("Shopping Cart Settings", {
onload: function() { onload: function(frm) {
if(cur_frm.doc.__onload && cur_frm.doc.__onload.quotation_series) { if(frm.doc.__onload && frm.doc.__onload.quotation_series) {
cur_frm.fields_dict.quotation_series.df.options = cur_frm.doc.__onload.quotation_series; frm.fields_dict.quotation_series.df.options = frm.doc.__onload.quotation_series;
cur_frm.refresh_field("quotation_series"); frm.refresh_field("quotation_series");
} }
}, },
refresh: function(){ refresh: function(frm){
toggle_mandatory(cur_frm) toggle_mandatory(frm)
}, },
enable_checkout: function(){ enable_checkout: function(frm){
toggle_mandatory(cur_frm) toggle_mandatory(frm)
}, },
enabled: function() { enabled: function(frm) {
if (cur_frm.doc.enabled === 1) { if (frm.doc.enabled === 1) {
cur_frm.doc.show_configure_button = 1; frm.set_value('enable_variants', 1);
cur_frm.refresh_field('show_configure_button');
} }
let is_required = frm.doc.enabled ? 1 : 0;
frm.toggle_reqd(["company", "default_customer_group", "quotation_series"], is_required);
} }
}); });
function toggle_mandatory (cur_frm){ function toggle_mandatory (frm){
cur_frm.toggle_reqd("payment_gateway_account", false); frm.toggle_reqd("payment_gateway_account", false);
if(cur_frm.doc.enabled && cur_frm.doc.enable_checkout) { if(frm.doc.enabled && frm.doc.enable_checkout) {
cur_frm.toggle_reqd("payment_gateway_account", true); frm.toggle_reqd("payment_gateway_account", true);
} }
} }

View File

@@ -1,750 +1,182 @@
{ {
"allow_copy": 0, "creation": "2013-06-19 15:57:32",
"allow_events_in_timeline": 0, "description": "Default settings for Shopping Cart",
"allow_guest_to_view": 0, "doctype": "DocType",
"allow_import": 0, "document_type": "System",
"allow_rename": 0, "engine": "InnoDB",
"beta": 0, "field_order": [
"creation": "2013-06-19 15:57:32", "enabled",
"custom": 0, "display_settings",
"description": "Default settings for Shopping Cart", "show_attachments",
"docstatus": 0, "show_price",
"doctype": "DocType", "show_stock_availability",
"document_type": "System", "enable_variants",
"editable_grid": 0, "show_contact_us_button",
"fields": [ "show_quantity_in_website",
{ "show_apply_coupon_code_in_website",
"allow_bulk_edit": 0, "allow_items_not_in_stock",
"allow_in_quick_entry": 0, "section_break_2",
"allow_on_submit": 0, "company",
"bold": 0, "price_list",
"collapsible": 0, "column_break_4",
"columns": 0, "default_customer_group",
"fieldname": "enabled", "quotation_series",
"fieldtype": "Check", "section_break_8",
"hidden": 0, "enable_checkout",
"ignore_user_permissions": 0, "payment_success_url",
"ignore_xss_filter": 0, "column_break_11",
"in_filter": 0, "payment_gateway_account"
"in_global_search": 0, ],
"in_list_view": 1, "fields": [
"in_standard_filter": 0, {
"label": "Enable Shopping Cart", "default": "0",
"length": 0, "fieldname": "enabled",
"no_copy": 0, "fieldtype": "Check",
"permlevel": 0, "in_list_view": 1,
"print_hide": 0, "label": "Enable Shopping Cart"
"print_hide_if_no_value": 0, },
"read_only": 0, {
"remember_last_selected_value": 0, "fieldname": "display_settings",
"report_hide": 0, "fieldtype": "Section Break",
"reqd": 0, "label": "Display Settings"
"search_index": 0, },
"set_only_once": 0, {
"translatable": 0, "default": "0",
"unique": 0 "fieldname": "show_attachments",
}, "fieldtype": "Check",
{ "label": "Show Public Attachments"
"allow_bulk_edit": 0, },
"allow_in_quick_entry": 0, {
"allow_on_submit": 0, "default": "0",
"bold": 0, "fieldname": "show_price",
"collapsible": 0, "fieldtype": "Check",
"columns": 0, "label": "Show Price"
"depends_on": "", },
"description": "", {
"fieldname": "display_settings", "default": "0",
"fieldtype": "Section Break", "fieldname": "show_stock_availability",
"hidden": 0, "fieldtype": "Check",
"ignore_user_permissions": 0, "label": "Show Stock Availability"
"ignore_xss_filter": 0, },
"in_filter": 0, {
"in_global_search": 0, "default": "0",
"in_list_view": 0, "fieldname": "show_contact_us_button",
"in_standard_filter": 0, "fieldtype": "Check",
"label": "Display Settings", "label": "Show Contact Us Button"
"length": 0, },
"no_copy": 0, {
"permlevel": 0, "default": "0",
"precision": "", "depends_on": "show_stock_availability",
"print_hide": 0, "fieldname": "show_quantity_in_website",
"print_hide_if_no_value": 0, "fieldtype": "Check",
"read_only": 0, "label": "Show Stock Quantity"
"remember_last_selected_value": 0, },
"report_hide": 0, {
"reqd": 0, "default": "0",
"search_index": 0, "fieldname": "show_apply_coupon_code_in_website",
"set_only_once": 0, "fieldtype": "Check",
"translatable": 0, "label": "Show Apply Coupon Code"
"unique": 0 },
}, {
{ "default": "0",
"allow_bulk_edit": 0, "fieldname": "allow_items_not_in_stock",
"allow_in_quick_entry": 0, "fieldtype": "Check",
"allow_on_submit": 0, "label": "Allow items not in stock to be added to cart"
"bold": 0, },
"collapsible": 0, {
"columns": 0, "depends_on": "enabled",
"depends_on": "", "fieldname": "section_break_2",
"description": "", "fieldtype": "Section Break"
"fieldname": "show_attachments", },
"fieldtype": "Check", {
"hidden": 0, "fieldname": "company",
"ignore_user_permissions": 0, "fieldtype": "Link",
"ignore_xss_filter": 0, "in_list_view": 1,
"in_filter": 0, "label": "Company",
"in_global_search": 0, "options": "Company",
"in_list_view": 0, "remember_last_selected_value": 1
"in_standard_filter": 0, },
"label": "Show Public Attachments", {
"length": 0, "description": "Prices will not be shown if Price List is not set",
"no_copy": 0, "fieldname": "price_list",
"permlevel": 0, "fieldtype": "Link",
"precision": "", "label": "Price List",
"print_hide": 0, "options": "Price List"
"print_hide_if_no_value": 0, },
"read_only": 0, {
"remember_last_selected_value": 0, "fieldname": "column_break_4",
"report_hide": 0, "fieldtype": "Column Break"
"reqd": 0, },
"search_index": 0, {
"set_only_once": 0, "fieldname": "default_customer_group",
"translatable": 0, "fieldtype": "Link",
"unique": 0 "ignore_user_permissions": 1,
}, "label": "Default Customer Group",
{ "options": "Customer Group"
"allow_bulk_edit": 0, },
"allow_in_quick_entry": 0, {
"allow_on_submit": 0, "fieldname": "quotation_series",
"bold": 0, "fieldtype": "Select",
"collapsible": 0, "label": "Quotation Series"
"columns": 0, },
"depends_on": "", {
"description": "", "collapsible": 1,
"fieldname": "show_price", "collapsible_depends_on": "eval:doc.enable_checkout",
"fieldtype": "Check", "depends_on": "enabled",
"hidden": 0, "fieldname": "section_break_8",
"ignore_user_permissions": 0, "fieldtype": "Section Break",
"ignore_xss_filter": 0, "label": "Checkout Settings"
"in_filter": 0, },
"in_global_search": 0, {
"in_list_view": 0, "default": "0",
"in_standard_filter": 0, "fieldname": "enable_checkout",
"label": "Show Price", "fieldtype": "Check",
"length": 0, "label": "Enable Checkout"
"no_copy": 0, },
"permlevel": 0, {
"precision": "", "default": "Orders",
"print_hide": 0, "description": "After payment completion redirect user to selected page.",
"print_hide_if_no_value": 0, "fieldname": "payment_success_url",
"read_only": 0, "fieldtype": "Select",
"remember_last_selected_value": 0, "label": "Payment Success Url",
"report_hide": 0, "options": "\nOrders\nInvoices\nMy Account"
"reqd": 0, },
"search_index": 0, {
"set_only_once": 0, "fieldname": "column_break_11",
"translatable": 0, "fieldtype": "Column Break"
"unique": 0 },
}, {
{ "fieldname": "payment_gateway_account",
"allow_bulk_edit": 0, "fieldtype": "Link",
"allow_in_quick_entry": 0, "label": "Payment Gateway Account",
"allow_on_submit": 0, "options": "Payment Gateway Account"
"bold": 0, },
"collapsible": 0, {
"columns": 0, "default": "0",
"fieldname": "show_stock_availability", "fieldname": "enable_variants",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "label": "Enable Variants"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Show Stock Availability",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "show_configure_button",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Show Configure Button",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "show_contact_us_button",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Show Contact Us Button",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "show_stock_availability",
"fieldname": "show_quantity_in_website",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Show Stock Quantity",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "show_apply_coupon_code_in_website",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Show Apply Coupon Code",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "allow_items_not_in_stock",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow items not in stock to be added to cart",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "enabled",
"fieldname": "section_break_2",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Company",
"length": 0,
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 1,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "Prices will not be shown if Price List is not set",
"fieldname": "price_list",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Price List",
"length": 0,
"no_copy": 0,
"options": "Price List",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_4",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "",
"fieldname": "default_customer_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Customer Group",
"length": 0,
"no_copy": 0,
"options": "Customer Group",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "quotation_series",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Quotation Series",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "eval:doc.enable_checkout",
"columns": 0,
"depends_on": "enabled",
"fieldname": "section_break_8",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Checkout Settings",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": "",
"columns": 0,
"depends_on": "",
"fieldname": "enable_checkout",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Enable Checkout",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Orders",
"description": "After payment completion redirect user to selected page.",
"fieldname": "payment_success_url",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Payment Success Url",
"length": 0,
"no_copy": 0,
"options": "\nOrders\nInvoices\nMy Account",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_11",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "payment_gateway_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Payment Gateway Account",
"length": 0,
"no_copy": 0,
"options": "Payment Gateway Account",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "fa fa-shopping-cart",
"idx": 1,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2019-10-14 13:54:24.575322",
"modified_by": "Administrator",
"module": "Shopping Cart",
"name": "Shopping Cart Settings",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 0,
"role": "Website Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_order": "ASC",
"track_changes": 0,
"track_seen": 0,
"track_views": 0
} }
],
"icon": "fa fa-shopping-cart",
"idx": 1,
"issingle": 1,
"modified": "2020-07-07 02:13:23.175604",
"modified_by": "Administrator",
"module": "Shopping Cart",
"name": "Shopping Cart Settings",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"email": 1,
"print": 1,
"read": 1,
"role": "Website Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "ASC"
}

View File

@@ -80,6 +80,7 @@ def get_shopping_cart_settings():
return frappe.local.shopping_cart_settings return frappe.local.shopping_cart_settings
@frappe.whitelist(allow_guest=True)
def is_cart_enabled(): def is_cart_enabled():
return get_shopping_cart_settings().enabled return get_shopping_cart_settings().enabled

View File

@@ -2,7 +2,7 @@
{% set cart_settings = shopping_cart.cart_settings %} {% set cart_settings = shopping_cart.cart_settings %}
<div class="mt-3"> <div class="mt-3">
{% if cart_settings.show_configure_button | int %} {% if cart_settings.enable_variants | int %}
<button class="btn btn-primary btn-configure" <button class="btn btn-primary btn-configure"
data-item-code="{{ doc.name }}" data-item-code="{{ doc.name }}"
data-item-name="{{ doc.item_name }}" data-item-name="{{ doc.item_name }}"