+
+ {{ _(offer.offer_title) }}: + {{ _(offer.offer_subtitle) if offer.offer_subtitle else '' }} + + {{ _("More") }} + +
+
primary_action: function() {
var data = d.get_values();
frappe.call({
- method: "webshop.webshop.doctype.item_review.item_review.add_item_review",
+ method: "shop.shop.doctype.item_review.item_review.add_item_review",
args: {
web_item: "{{ doc.name }}",
title: data.title,
diff --git a/webshop/templates/generators/item/item_specifications.html b/shop/templates/generators/item/item_specifications.html
similarity index 100%
rename from webshop/templates/generators/item/item_specifications.html
rename to shop/templates/generators/item/item_specifications.html
diff --git a/webshop/templates/generators/item_group.html b/shop/templates/generators/item_group.html
similarity index 94%
rename from webshop/templates/generators/item_group.html
rename to shop/templates/generators/item_group.html
index 3b4d960784..73d2ca49e3 100644
--- a/webshop/templates/generators/item_group.html
+++ b/shop/templates/generators/item_group.html
@@ -1,4 +1,4 @@
-{% from "webshop/templates/includes/macros.html" import field_filter_section, attribute_filter_section, discount_range_filters %}
+{% from "shop/templates/includes/macros.html" import field_filter_section, attribute_filter_section, discount_range_filters %}
{% extends "templates/web.html" %}
{% block header %}
diff --git a/webshop/templates/includes/cart/address_card.html b/shop/templates/includes/cart/address_card.html
similarity index 100%
rename from webshop/templates/includes/cart/address_card.html
rename to shop/templates/includes/cart/address_card.html
diff --git a/webshop/templates/includes/cart/address_picker_card.html b/shop/templates/includes/cart/address_picker_card.html
similarity index 100%
rename from webshop/templates/includes/cart/address_picker_card.html
rename to shop/templates/includes/cart/address_picker_card.html
diff --git a/shop/templates/includes/cart/cart_address.html b/shop/templates/includes/cart/cart_address.html
new file mode 100644
index 0000000000..88dfb2dc4b
--- /dev/null
+++ b/shop/templates/includes/cart/cart_address.html
@@ -0,0 +1,272 @@
+{% from "shop/templates/includes/cart/cart_macros.html" import show_address %}
+
+{% if addresses | length == 1%}
+{% set select_address = True %}
+{% endif %}
+
+
+
+
+ {{ _("Shipping Address") }}
+
+
+
+
+
+ {% for address in shipping_addresses %}
+ {% if doc.shipping_address_name == address.name %}
+
+
+ {% include "templates/includes/cart/address_card.html" %}
+
+
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+
+ {{ _("Billing Address") }}
+
+
+
+
+
+ {% for address in billing_addresses %}
+ {% if doc.customer_address == address.name %}
+
+
+ {% include "templates/includes/cart/address_card.html" %}
+
+
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/webshop/templates/includes/cart/cart_address_picker.html b/shop/templates/includes/cart/cart_address_picker.html
similarity index 100%
rename from webshop/templates/includes/cart/cart_address_picker.html
rename to shop/templates/includes/cart/cart_address_picker.html
diff --git a/webshop/templates/includes/cart/cart_dropdown.html b/shop/templates/includes/cart/cart_dropdown.html
similarity index 100%
rename from webshop/templates/includes/cart/cart_dropdown.html
rename to shop/templates/includes/cart/cart_dropdown.html
diff --git a/webshop/templates/includes/cart/cart_items.html b/shop/templates/includes/cart/cart_items.html
similarity index 97%
rename from webshop/templates/includes/cart/cart_items.html
rename to shop/templates/includes/cart/cart_items.html
index b820c706c1..2358eca4e4 100644
--- a/webshop/templates/includes/cart/cart_items.html
+++ b/shop/templates/includes/cart/cart_items.html
@@ -1,4 +1,4 @@
-{% from "webshop/templates/includes/macros.html" import product_image %}
+{% from "shop/templates/includes/macros.html" import product_image %}
{% macro item_subtotal(item) %}
diff --git a/webshop/templates/includes/cart/cart_items_dropdown.html b/shop/templates/includes/cart/cart_items_dropdown.html
similarity index 74%
rename from webshop/templates/includes/cart/cart_items_dropdown.html
rename to shop/templates/includes/cart/cart_items_dropdown.html
index da978d384f..f3e7eb30a6 100644
--- a/webshop/templates/includes/cart/cart_items_dropdown.html
+++ b/shop/templates/includes/cart/cart_items_dropdown.html
@@ -1,4 +1,4 @@
-{% from "webshop/templates/includes/order/order_macros.html" import item_name_and_description_cart %}
+{% from "shop/templates/includes/order/order_macros.html" import item_name_and_description_cart %}
{% for d in doc.items %}
diff --git a/webshop/templates/includes/cart/cart_items_total.html b/shop/templates/includes/cart/cart_items_total.html
similarity index 100%
rename from webshop/templates/includes/cart/cart_items_total.html
rename to shop/templates/includes/cart/cart_items_total.html
diff --git a/webshop/templates/includes/cart/cart_macros.html b/shop/templates/includes/cart/cart_macros.html
similarity index 100%
rename from webshop/templates/includes/cart/cart_macros.html
rename to shop/templates/includes/cart/cart_macros.html
diff --git a/webshop/templates/includes/cart/cart_payment_summary.html b/shop/templates/includes/cart/cart_payment_summary.html
similarity index 55%
rename from webshop/templates/includes/cart/cart_payment_summary.html
rename to shop/templates/includes/cart/cart_payment_summary.html
index 107ef28c0d..6817ca890b 100644
--- a/webshop/templates/includes/cart/cart_payment_summary.html
+++ b/shop/templates/includes/cart/cart_payment_summary.html
@@ -1,5 +1,6 @@
{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
+{% set shipping_rules = shipping_rules or [] %}
{{ _("Payment Summary") }}
@@ -8,30 +9,55 @@
{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
-
-
- {% set total_items = frappe.utils.cstr(frappe.utils.flt(doc.total_qty, 0)) %}
- {{ _("Net Total (") + total_items + _(" Items)") }}
- {{ doc.get_formatted("net_total") }}
-
+
+
+ {% set total_items = frappe.utils.cstr(frappe.utils.flt(doc.total_qty, 0)) %}
+ {{ _("Net Total (") + total_items + _(" Items)") }}
+ {{ doc.get_formatted("net_total") }}
+
-
- {% for d in doc.taxes %}
- {% if d.tax_amount %}
-
-
- {{ d.description }}
-
-
- {{ d.get_formatted("tax_amount") }}
-
-
- {% endif %}
- {% endfor %}
-
+ {% for d in doc.taxes %}
+ {% if d.tax_amount %}
+
+
+ {{ d.description }}
+
+
+ {{ d.get_formatted("tax_amount") }}
+
+
+ {% endif %}
+ {% endfor %}
-
-
+ {#
+ {% if shipping_rules | length > 0 %}
+
+ {{ _("Shipping Method") }}
+
+
+
+
+ {% endif %}
+ #}
+
+ {% if cart_settings.enable_manual_shipping_charge and not doc.shipping_rule %}
+
+ {{ _("Shipping Charge") }}
+ {{ frappe.utils.fmt_money(cart_settings.default_shipping_charge,
+ currency=doc.currency) }}
+
+ {% endif %}
+
+
+
+
-
-
- {{ _("Grand Total") }}
- {{ doc.get_formatted("grand_total") }}
-
-
+
+
+ {{ _("Grand Total") }}
+ {{ doc.get_formatted("grand_total") }}
+
+
{% endif %}
diff --git a/webshop/templates/includes/cart/coupon_code.html b/shop/templates/includes/cart/coupon_code.html
similarity index 100%
rename from webshop/templates/includes/cart/coupon_code.html
rename to shop/templates/includes/cart/coupon_code.html
diff --git a/webshop/templates/includes/cart/place_order.html b/shop/templates/includes/cart/place_order.html
similarity index 100%
rename from webshop/templates/includes/cart/place_order.html
rename to shop/templates/includes/cart/place_order.html
diff --git a/webshop/templates/includes/macros.html b/shop/templates/includes/macros.html
similarity index 100%
rename from webshop/templates/includes/macros.html
rename to shop/templates/includes/macros.html
diff --git a/shop/templates/includes/navbar/navbar_items.html b/shop/templates/includes/navbar/navbar_items.html
new file mode 100644
index 0000000000..b3c87e8127
--- /dev/null
+++ b/shop/templates/includes/navbar/navbar_items.html
@@ -0,0 +1,25 @@
+{% extends 'frappe/templates/includes/navbar/navbar_items.html' %}
+
+{% block navbar_right_extension %}
+
+ {{ _("Products") }}
+
+
+
+
+
+
+
+{% if frappe.db.get_single_value("Shop Settings", "enable_wishlist") %}
+
+
+
+
+
+
+{% endif %}
+{% endblock %}
\ No newline at end of file
diff --git a/webshop/templates/includes/order/order_macros.html b/shop/templates/includes/order/order_macros.html
similarity index 95%
rename from webshop/templates/includes/order/order_macros.html
rename to shop/templates/includes/order/order_macros.html
index e5c9bbe0bd..2d4bb2227c 100644
--- a/webshop/templates/includes/order/order_macros.html
+++ b/shop/templates/includes/order/order_macros.html
@@ -1,4 +1,4 @@
-{% from "webshop/templates/includes/macros.html" import product_image %}
+{% from "shop/templates/includes/macros.html" import product_image %}
{% macro item_name_and_description(d) %}
diff --git a/webshop/templates/includes/order/order_taxes.html b/shop/templates/includes/order/order_taxes.html
similarity index 100%
rename from webshop/templates/includes/order/order_taxes.html
rename to shop/templates/includes/order/order_taxes.html
diff --git a/webshop/templates/includes/product_page.js b/shop/templates/includes/product_page.js
similarity index 75%
rename from webshop/templates/includes/product_page.js
rename to shop/templates/includes/product_page.js
index 05dcf55bc9..e95c6f6e78 100644
--- a/webshop/templates/includes/product_page.js
+++ b/shop/templates/includes/product_page.js
@@ -1,47 +1,47 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-frappe.ready(function() {
+frappe.ready(function () {
window.item_code = $('[itemscope] [itemprop="productID"]').text().trim();
var qty = 0;
frappe.call({
type: "POST",
- method: "webshop.webshop.shopping_cart.product_info.get_product_info_for_website",
+ method: "shop.shop.shopping_cart.product_info.get_product_info_for_website",
args: {
item_code: get_item_code()
},
- callback: function(r) {
- if(r.message) {
- if(r.message.cart_settings.enabled) {
+ callback: function (r) {
+ if (r.message) {
+ if (r.message.cart_settings.enabled) {
let hide_add_to_cart = !r.message.product_info.price
|| (!r.message.product_info.in_stock && !r.message.cart_settings.allow_items_not_in_stock);
$(".item-cart, .item-price, .item-stock").toggleClass('hide', hide_add_to_cart);
}
- if(r.message.cart_settings.show_price) {
+ if (r.message.cart_settings.show_price) {
$(".item-price").toggleClass("hide", false);
}
- if(r.message.cart_settings.show_stock_availability) {
+ if (r.message.cart_settings.show_stock_availability) {
$(".item-stock").toggleClass("hide", false);
}
- if(r.message.product_info.price) {
+ if (r.message.product_info.price) {
$(".item-price")
.html(r.message.product_info.price.formatted_price_sales_uom + "\
(" + r.message.product_info.price.formatted_price + " / " + r.message.product_info.uom + ")");
- if(r.message.product_info.in_stock===0) {
+ if (r.message.product_info.in_stock === 0) {
$(".item-stock").html(" {{ _("Not in stock") }}");
}
- else if(r.message.product_info.in_stock===1 && r.message.cart_settings.show_stock_availability) {
+ else if (r.message.product_info.in_stock === 1 && r.message.cart_settings.show_stock_availability) {
var qty_display = "{{ _("In stock") }}";
if (r.message.product_info.show_stock_qty) {
- qty_display += " ("+r.message.product_info.stock_qty+")";
+ qty_display += " (" + r.message.product_info.stock_qty + ")";
}
$(".item-stock").html("\
- "+qty_display+"");
+ "+ qty_display + "");
}
- if(r.message.product_info.qty) {
+ if (r.message.product_info.qty) {
qty = r.message.product_info.qty;
toggle_update_cart(r.message.product_info.qty);
} else {
@@ -52,14 +52,14 @@ frappe.ready(function() {
}
})
- $("#item-add-to-cart button").on("click", function() {
- frappe.provide('webshop.shopping_cart');
+ $("#item-add-to-cart button").on("click", function () {
+ frappe.provide('shop.shop.shopping_cart');
- webshop.shopping_cart.update_cart({
+ shop.shop.shopping_cart.update_cart({
item_code: get_item_code(),
qty: $("#item-spinner .cart-qty").val(),
- callback: function(r) {
- if(!r.exc) {
+ callback: function (r) {
+ if (!r.exc) {
toggle_update_cart(1);
qty = 1;
}
@@ -76,7 +76,7 @@ frappe.ready(function() {
if (btn.attr('data-dir') == 'up') {
newVal = Number.parseInt(oldValue) + 1;
- } else if (btn.attr('data-dir') == 'dwn') {
+ } else if (btn.attr('data-dir') == 'dwn') {
if (Number.parseInt(oldValue) > 1) {
newVal = Number.parseInt(oldValue) - 1;
}
@@ -87,11 +87,11 @@ frappe.ready(function() {
input.val(newVal);
});
- $("[itemscope] .item-view-attribute .form-control").on("change", function() {
+ $("[itemscope] .item-view-attribute .form-control").on("change", function () {
try {
var item_code = encodeURIComponent(get_item_code());
- } catch(e) {
+ } catch (e) {
// unable to find variant
// then chose the closest available one
@@ -120,7 +120,7 @@ frappe.ready(function() {
});
});
-var toggle_update_cart = function(qty) {
+var toggle_update_cart = function (qty) {
$("#item-add-to-cart").toggle(qty ? false : true);
$("#item-update-cart")
.toggle(qty ? true : false)
@@ -130,11 +130,11 @@ var toggle_update_cart = function(qty) {
function get_item_code() {
var variant_info = window.variant_info;
- if(variant_info) {
+ if (variant_info) {
var attributes = get_selected_attributes();
var no_of_attributes = Object.keys(attributes).length;
- for(var i in variant_info) {
+ for (var i in variant_info) {
var variant = variant_info[i];
if (variant.attributes.length < no_of_attributes) {
@@ -143,15 +143,15 @@ function get_item_code() {
}
var match = true;
- for(var j in variant.attributes) {
- if(attributes[variant.attributes[j].attribute]
+ for (var j in variant.attributes) {
+ if (attributes[variant.attributes[j].attribute]
!= variant.attributes[j].attribute_value
) {
match = false;
break;
}
}
- if(match) {
+ if (match) {
return variant.name;
}
}
@@ -171,23 +171,23 @@ function find_closest_match(selected_attribute, selected_attribute_value) {
var matched;
var variant_info = window.variant_info;
- for(var i in variant_info) {
+ for (var i in variant_info) {
var variant = variant_info[i];
var match_score = 0;
var has_selected_attribute = false;
- for(var j in variant.attributes) {
- if(attributes[variant.attributes[j].attribute]===variant.attributes[j].attribute_value) {
+ for (var j in variant.attributes) {
+ if (attributes[variant.attributes[j].attribute] === variant.attributes[j].attribute_value) {
match_score = match_score + 1;
- if (variant.attributes[j].attribute==selected_attribute && variant.attributes[j].attribute_value==selected_attribute_value) {
+ if (variant.attributes[j].attribute == selected_attribute && variant.attributes[j].attribute_value == selected_attribute_value) {
has_selected_attribute = true;
}
}
}
if (has_selected_attribute
- && ((match_score > previous_match_score) || (match_score==previous_match_score && previous_no_of_attributes < variant.attributes.length))) {
+ && ((match_score > previous_match_score) || (match_score == previous_match_score && previous_no_of_attributes < variant.attributes.length))) {
previous_match_score = match_score;
matched = variant;
previous_no_of_attributes = variant.attributes.length;
@@ -210,7 +210,7 @@ function find_closest_match(selected_attribute, selected_attribute_value) {
function get_selected_attributes() {
var attributes = {};
- $('[itemscope]').find(".item-view-attribute .form-control").each(function() {
+ $('[itemscope]').find(".item-view-attribute .form-control").each(function () {
attributes[$(this).attr('data-attribute')] = $(this).val();
});
return attributes;
diff --git a/webshop/webshop/web_template/product_category_cards/__init__.py b/shop/templates/pages/__init__.py
similarity index 100%
rename from webshop/webshop/web_template/product_category_cards/__init__.py
rename to shop/templates/pages/__init__.py
diff --git a/shop/templates/pages/cart.html b/shop/templates/pages/cart.html
new file mode 100644
index 0000000000..ab3121aabb
--- /dev/null
+++ b/shop/templates/pages/cart.html
@@ -0,0 +1,213 @@
+{% extends "templates/web.html" %}
+
+{% block title %} {{ _("Shopping Cart") }} {% endblock %}
+
+{% block header %}{{ _("Shopping Cart") }}{% endblock %}
+
+ {% block header_actions %}
+ {% endblock %}
+
+ {% block page_content %}
+
+ {% from "templates/includes/macros.html" import item_name_and_description %}
+
+ {% if doc.items %}
+
+
+
+
+
+
+
+ {{ _('Items') }}
+
+
+
+
+ {{ _('Item') }}
+ {{ _('Quantity') }}
+ {% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
+ {{ _('Subtotal') }}
+ {% endif %}
+
+
+
+
+ {% include "templates/includes/cart/cart_items.html" %}
+
+
+ {% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
+
+ {% include "templates/includes/cart/cart_items_total.html" %}
+
+ {% endif %}
+
+
+
+
+ {% if cart_settings.enable_checkout %}
+
+ {{ _('Past Orders') }}
+
+ {% else %}
+
+ {{ _('Past Quotes') }}
+
+ {% endif %}
+
+
+ {% if doc.items %}
+
+ {% endif %}
+
+
+
+
+
+ {% if doc.items %}
+ {% if doc.terms %}
+
+ {{ _("Terms and Conditions") }}
+
+ {{ doc.terms }}
+
+
+ {% endif %}
+
+
+
+
+
+
+ {% set show_coupon_code = cart_settings.show_apply_coupon_code_in_website and
+ cart_settings.enable_checkout %}
+ {% set coupon_code = doc.coupon_code if doc.coupon_code else "" %}
+
+ {% if show_coupon_code == 1%}
+ {% if coupon_code %}
+ {% include "templates/includes/cart/coupon_code.html" %}
+ {% else %}
+
+
+
+
+
+
+
+ {% endif %}
+ {% endif %}
+
+
+
+ {% include "templates/includes/cart/cart_payment_summary.html" %}
+
+
+
+ {% include "templates/includes/cart/place_order.html" %}
+
+
+
+ {% if frappe.session.user == "Guest" %}
+
+ {{ _("Save your details?") }}
+ {{ _("Sign up with your mobile number to track orders and save your
+ address.") }}
+
+ {{ _("Signup with Mobile Number") }}
+
+
+ {{ _("Already have an account?") }} {{ _("Login")
+ }}
+
+
+
+ {% if cart_settings.allow_guest_checkout %}
+
+ {{ _("Alternatively, Checkout as Guest") }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% endif %}
+ {% endif %}
+
+ {% include "templates/includes/cart/cart_address.html" %}
+
+
+ {% endif %}
+
+
+
+
+
+ {{ _("Total Amount") }}
+ {{ doc.get_formatted("grand_total") }}
+
+
+
+
+ {% else %}
+
+
+
+
+ {{ _('Your cart is Empty') }}
+ {% if cart_settings.enable_checkout %}
+
+ {{ _('See past orders') }}
+
+ {% else %}
+
+ {{ _('See past quotations') }}
+
+ {% endif %}
+
+ {% endif %}
+
+ {% endblock %}
+
+ {% block base_scripts %}
+
+ {{ include_script("frappe-web.bundle.js") }}
+ {{ include_script("controls.bundle.js") }}
+ {{ include_script("dialog.bundle.js") }}
+ {% endblock %}
\ No newline at end of file
diff --git a/shop/templates/pages/cart.js b/shop/templates/pages/cart.js
new file mode 100644
index 0000000000..b7670aef26
--- /dev/null
+++ b/shop/templates/pages/cart.js
@@ -0,0 +1,354 @@
+// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+// JS exclusive to /cart page
+frappe.provide("shop.shop.shopping_cart");
+var shopping_cart = shop.shop.shopping_cart;
+
+$.extend(shopping_cart, {
+ show_error: function (title, text) {
+ $("#cart-container").html('' +
+ title + '
' + text + '
');
+ },
+
+ bind_events: function () {
+ shopping_cart.bind_place_order();
+ shopping_cart.bind_request_quotation();
+ shopping_cart.bind_change_qty();
+ shopping_cart.bind_remove_cart_item();
+ shopping_cart.bind_change_notes();
+ shopping_cart.bind_coupon_code();
+ shopping_cart.bind_remove_coupon_code();
+ shopping_cart.bind_guest_country_change();
+ shopping_cart.bind_guest_state_change();
+ shopping_cart.bind_shipping_rule_change();
+ },
+
+ bind_place_order: function () {
+ $(".btn-place-order, .btn-place-order-mobile").on("click", function () {
+ shopping_cart.place_order(this);
+ });
+ },
+
+ bind_request_quotation: function () {
+ $('.btn-request-for-quotation').on('click', function () {
+ shopping_cart.request_quotation(this);
+ });
+ },
+
+ bind_change_qty: function () {
+ // bind update button
+ $(".cart-items").on("change", ".cart-qty", function () {
+ var item_code = $(this).attr("data-item-code");
+ var newVal = $(this).val();
+ shopping_cart.shopping_cart_update({ item_code, qty: newVal });
+ });
+
+ $(".cart-items").on('click', '.number-spinner button', function () {
+ var btn = $(this),
+ input = btn.closest('.number-spinner').find('input'),
+ oldValue = input.val().trim(),
+ newVal = 0;
+
+ if (btn.attr('data-dir') == 'up') {
+ newVal = parseInt(oldValue) + 1;
+ } else {
+ if (oldValue > 1) {
+ newVal = parseInt(oldValue) - 1;
+ }
+ }
+ input.val(newVal);
+
+ let notes = input.closest("td").siblings().find(".notes").text().trim();
+ var item_code = input.attr("data-item-code");
+ shopping_cart.shopping_cart_update({
+ item_code,
+ qty: newVal,
+ additional_notes: notes
+ });
+ });
+ },
+
+ bind_change_notes: function () {
+ $('.cart-items').on('change', 'textarea', function () {
+ const $textarea = $(this);
+ const item_code = $textarea.attr('data-item-code');
+ const qty = $textarea.closest('tr').find('.cart-qty').val();
+ const notes = $textarea.val();
+ shopping_cart.shopping_cart_update({
+ item_code,
+ qty,
+ additional_notes: notes
+ });
+ });
+ },
+
+ bind_remove_cart_item: function () {
+ $(".cart-items").on("click", ".remove-cart-item", (e) => {
+ const $remove_cart_item_btn = $(e.currentTarget);
+ var item_code = $remove_cart_item_btn.data("item-code");
+
+ shopping_cart.shopping_cart_update({
+ item_code: item_code,
+ qty: 0
+ });
+ });
+ },
+
+ render_tax_row: function ($cart_taxes, doc, shipping_rules) {
+ var shipping_selector;
+ if (shipping_rules) {
+ shipping_selector = '';
+ }
+
+ var $tax_row = $(repl('\
+ \
+ \
+ ' +
+ (shipping_selector || '%(description)s
') +
+ '\
+ \
+ \
+ \
+ %(formatted_tax_amount)s
\
+ \
+ ', doc)).appendTo($cart_taxes);
+
+ if (shipping_selector) {
+ $tax_row.find('select option').each(function (i, opt) {
+ if ($(opt).html() == doc.description) {
+ $(opt).attr("selected", "selected");
+ }
+ });
+ $tax_row.find('select').on("change", function () {
+ shopping_cart.apply_shipping_rule($(this).val(), this);
+ });
+ }
+ },
+
+ apply_shipping_rule: function (rule, btn) {
+ return frappe.call({
+ btn: btn,
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.apply_shipping_rule",
+ args: { shipping_rule: rule },
+ callback: function (r) {
+ if (!r.exc) {
+ shopping_cart.render(r.message);
+ }
+ }
+ });
+ },
+
+ place_order: function (btn) {
+ shopping_cart.freeze();
+
+ let guest_details = {};
+ if (frappe.session.user === "Guest") {
+ guest_details = {
+ email: $(".guest-email").val(),
+ fullname: $(".guest-fullname").val(),
+ phone: $(".guest-phone").val(),
+ address: $(".guest-address").val(),
+ state: $(".guest-state").val(),
+ country: $(".guest-country").val(),
+ };
+
+ if (!guest_details.email || !guest_details.fullname || !guest_details.address) {
+ shopping_cart.unfreeze();
+ frappe.msgprint(__("Please fill in all mandatory guest details."));
+ return;
+ }
+ }
+
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.place_order",
+ btn: btn,
+ args: {
+ guest_details: guest_details
+ },
+ callback: function (r) {
+ if (r.exc) {
+ shopping_cart.unfreeze();
+ var msg = "";
+ if (r._server_messages) {
+ msg = JSON.parse(r._server_messages || []).join("
");
+ }
+
+ $("#cart-error")
+ .empty()
+ .html(msg || frappe._("Something went wrong!"))
+ .toggle(true);
+ } else {
+ $(btn).hide();
+ window.location.href = '/upi_payment?order=' + encodeURIComponent(r.message) + '&t=' + Date.now();
+ }
+ }
+ });
+ },
+
+ request_quotation: function (btn) {
+ shopping_cart.freeze();
+
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.request_for_quotation",
+ btn: btn,
+ callback: function (r) {
+ if (r.exc) {
+ shopping_cart.unfreeze();
+ var msg = "";
+ if (r._server_messages) {
+ msg = JSON.parse(r._server_messages || []).join("
");
+ }
+
+ $("#cart-error")
+ .empty()
+ .html(msg || frappe._("Something went wrong!"))
+ .toggle(true);
+ } else {
+ $(btn).hide();
+ window.location.href = '/quotations/' + encodeURIComponent(r.message);
+ }
+ }
+ });
+ },
+
+ bind_coupon_code: function () {
+ $(".bt-coupon").on("click", function () {
+ shopping_cart.apply_coupon_code(this);
+ });
+ },
+
+ apply_coupon_code: function (btn) {
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.apply_coupon_code",
+ btn: btn,
+ args: {
+ applied_code: $('.txtcoupon').val(),
+ applied_referral_sales_partner: $('.txtreferral_sales_partner').val()
+ },
+ callback: function (r) {
+ if (r && r.message) {
+ location.reload();
+ }
+ }
+ });
+ },
+
+ bind_remove_coupon_code: function () {
+ $(".bt-remove-coupon-code").on("click", function () {
+ shopping_cart.remove_coupon_code(this);
+ });
+ },
+ remove_coupon_code: function (btn) {
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.remove_coupon_code",
+ btn: btn,
+ callback: function (r) {
+ if (r && r.message) {
+ location.reload();
+ }
+ }
+ });
+ },
+
+ bind_guest_country_change: function () {
+ $(".guest-country").on("change", function () {
+ var country = $(this).val();
+ if (country) {
+ // Populate states
+ frappe.call({
+ method: "frappe.geo.utils.get_states",
+ args: { country: country },
+ callback: function (r) {
+ var $state = $(".guest-state");
+ $state.empty().append('');
+ if (r.message) {
+ r.message.forEach(function (state) {
+ $state.append('');
+ });
+ }
+ }
+ });
+ shopping_cart.update_guest_country(country);
+ }
+ });
+ },
+
+ update_guest_country: function (country) {
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.update_guest_country",
+ args: { country: country },
+ callback: function (r) {
+ if (r.message) {
+ location.reload();
+ }
+ }
+ });
+ },
+
+ bind_guest_state_change: function () {
+ $(".guest-state").on("change", function () {
+ var state = $(this).val();
+ if (state) {
+ shopping_cart.update_guest_state(state);
+ }
+ });
+ },
+
+ update_guest_state: function (state) {
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.update_guest_state",
+ args: { state: state },
+ callback: function (r) {
+ if (r.message) {
+ location.reload();
+ }
+ }
+ });
+ },
+
+ bind_shipping_rule_change: function () {
+ $(".shipping-rule-selector").on("change", function () {
+ var shipping_rule = $(this).val();
+ if (shipping_rule) {
+ shopping_cart.apply_shipping_rule(shipping_rule);
+ }
+ });
+ },
+
+ apply_shipping_rule: function (shipping_rule) {
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.apply_shipping_rule",
+ args: { shipping_rule: shipping_rule },
+ callback: function (r) {
+ if (r.message) {
+ location.reload();
+ }
+ }
+ });
+ }
+});
+
+frappe.ready(function () {
+ if (window.location.pathname === "/cart") {
+ $(".cart-icon").hide();
+ }
+ shopping_cart.parent = $(".cart-container");
+ shopping_cart.bind_events();
+});
+
+function show_terms() {
+ var html = $(".cart-terms").html();
+ frappe.msgprint(html);
+}
diff --git a/webshop/templates/pages/cart.py b/shop/templates/pages/cart.py
similarity index 78%
rename from webshop/templates/pages/cart.py
rename to shop/templates/pages/cart.py
index ef8a6475e9..287eb689c7 100644
--- a/webshop/templates/pages/cart.py
+++ b/shop/templates/pages/cart.py
@@ -3,7 +3,7 @@
no_cache = 1
-from webshop.webshop.shopping_cart.cart import get_cart_quotation
+from shop.shop.shopping_cart.cart import get_cart_quotation
def get_context(context):
diff --git a/webshop/templates/pages/customer_reviews.html b/shop/templates/pages/customer_reviews.html
similarity index 95%
rename from webshop/templates/pages/customer_reviews.html
rename to shop/templates/pages/customer_reviews.html
index d95911e5f1..29145890a2 100644
--- a/webshop/templates/pages/customer_reviews.html
+++ b/shop/templates/pages/customer_reviews.html
@@ -1,5 +1,5 @@
{% extends "templates/web.html" %}
-{% from "webshop/templates/includes/macros.html" import user_review, ratings_summary %}
+{% from "shop/templates/includes/macros.html" import user_review, ratings_summary %}
{% block title %} {{ _("Customer Reviews") }} {% endblock %}
diff --git a/webshop/templates/pages/customer_reviews.py b/shop/templates/pages/customer_reviews.py
similarity index 73%
rename from webshop/templates/pages/customer_reviews.py
rename to shop/templates/pages/customer_reviews.py
index 657a0d44f7..576a2b1376 100644
--- a/webshop/templates/pages/customer_reviews.py
+++ b/shop/templates/pages/customer_reviews.py
@@ -2,11 +2,11 @@
# License: GNU General Public License v3. See license.txt
import frappe
-from webshop.webshop.doctype.webshop_settings.webshop_settings import (
+from shop.shop.doctype.shop_settings.shop_settings import (
get_shopping_cart_settings,
)
-from webshop.webshop.doctype.item_review.item_review import get_item_reviews
-from webshop.webshop.doctype.website_item.website_item import check_if_user_is_customer
+from shop.shop.doctype.item_review.item_review import get_item_reviews
+from shop.shop.doctype.website_item.website_item import check_if_user_is_customer
def get_context(context):
diff --git a/webshop/templates/pages/order.html b/shop/templates/pages/order.html
similarity index 97%
rename from webshop/templates/pages/order.html
rename to shop/templates/pages/order.html
index 2e11784b91..37f8afe507 100644
--- a/webshop/templates/pages/order.html
+++ b/shop/templates/pages/order.html
@@ -1,5 +1,5 @@
{% extends "templates/web.html" %}
-{% from "webshop/templates/includes/order/order_macros.html" import item_name_and_description %}
+{% from "shop/templates/includes/order/order_macros.html" import item_name_and_description %}
{% block breadcrumbs %}
{% include "templates/includes/breadcrumbs.html" %}
@@ -125,7 +125,7 @@ {{ doc.name }}
- {% include "webshop/templates/includes/order/order_taxes.html" %}
+ {% include "shop/templates/includes/order/order_taxes.html" %}
diff --git a/webshop/templates/pages/order.js b/shop/templates/pages/order.js
similarity index 97%
rename from webshop/templates/pages/order.js
rename to shop/templates/pages/order.js
index c1215a82bc..80ba05c785 100644
--- a/webshop/templates/pages/order.js
+++ b/shop/templates/pages/order.js
@@ -39,7 +39,7 @@ frappe.ready(() => {
loyalty_points,
}
- const payment_gateway_account = await frappe.db.get_single_value('Webshop Settings', 'payment_gateway_account')
+ const payment_gateway_account = await frappe.db.get_single_value('Shop Settings', 'payment_gateway_account')
if (payment_gateway_account) {
args_obj.payment_gateway_account = payment_gateway_account;
diff --git a/webshop/templates/pages/order.py b/shop/templates/pages/order.py
similarity index 92%
rename from webshop/templates/pages/order.py
rename to shop/templates/pages/order.py
index 2c6fe2f789..19e22a7d1f 100644
--- a/webshop/templates/pages/order.py
+++ b/shop/templates/pages/order.py
@@ -4,7 +4,7 @@
import frappe
from frappe import _
-from webshop.webshop.doctype.webshop_settings.webshop_settings import show_attachments
+from shop.shop.doctype.shop_settings.shop_settings import show_attachments
def get_context(context):
@@ -23,7 +23,7 @@ def get_context(context):
"Payment Request", {"reference_name": frappe.form_dict.name}, "name"
)
- context.enabled_checkout = frappe.get_doc("Webshop Settings").enable_checkout
+ context.enabled_checkout = frappe.get_doc("Shop Settings").enable_checkout
default_print_format = frappe.db.get_value(
"Property Setter",
diff --git a/webshop/templates/pages/product_search.html b/shop/templates/pages/product_search.html
similarity index 100%
rename from webshop/templates/pages/product_search.html
rename to shop/templates/pages/product_search.html
diff --git a/webshop/templates/pages/product_search.py b/shop/templates/pages/product_search.py
similarity index 94%
rename from webshop/templates/pages/product_search.py
rename to shop/templates/pages/product_search.py
index ba8348e566..e5b6a146c3 100644
--- a/webshop/templates/pages/product_search.py
+++ b/shop/templates/pages/product_search.py
@@ -7,14 +7,14 @@
from frappe.utils import cint, cstr
from redis.commands.search.query import Query
-from webshop.webshop.redisearch_utils import (
+from shop.shop.redisearch_utils import (
WEBSITE_ITEM_CATEGORY_AUTOCOMPLETE,
WEBSITE_ITEM_INDEX,
WEBSITE_ITEM_NAME_AUTOCOMPLETE,
is_redisearch_enabled,
)
-from webshop.webshop.shopping_cart.product_info import set_product_info_for_website
-from webshop.webshop.doctype.override_doctype.item_group import get_item_for_list_in_html
+from shop.shop.shopping_cart.product_info import set_product_info_for_website
+from shop.shop.doctype.override_doctype.item_group import get_item_for_list_in_html
no_cache = 1
diff --git a/webshop/templates/pages/wishlist.html b/shop/templates/pages/wishlist.html
similarity index 80%
rename from webshop/templates/pages/wishlist.html
rename to shop/templates/pages/wishlist.html
index 2409a29928..58bbe21233 100644
--- a/webshop/templates/pages/wishlist.html
+++ b/shop/templates/pages/wishlist.html
@@ -9,7 +9,7 @@
- {% from "webshop/templates/includes/macros.html" import wishlist_card %}
+ {% from "shop/templates/includes/macros.html" import wishlist_card %}
{% for item in items %}
{{ wishlist_card(item, settings) }}
{% endfor %}
@@ -19,7 +19,7 @@
{% else %}
-
+
{{ _('Wishlist is empty!') }}
diff --git a/webshop/templates/pages/wishlist.py b/shop/templates/pages/wishlist.py
similarity index 91%
rename from webshop/templates/pages/wishlist.py
rename to shop/templates/pages/wishlist.py
index 66b359caa5..e06cbca93c 100644
--- a/webshop/templates/pages/wishlist.py
+++ b/shop/templates/pages/wishlist.py
@@ -2,12 +2,12 @@
# License: GNU General Public License v3. See license.txt
import frappe
-from webshop.webshop.doctype.webshop_settings.webshop_settings import (
+from shop.shop.doctype.shop_settings.shop_settings import (
get_shopping_cart_settings,
)
-from webshop.webshop.shopping_cart.cart import _set_price_list
+from shop.shop.shopping_cart.cart import _set_price_list
from erpnext.utilities.product import get_price
-from webshop.webshop.shopping_cart.cart import get_party
+from shop.shop.shopping_cart.cart import get_party
def get_context(context):
diff --git a/webshop/www/__init__.py b/shop/www/__init__.py
similarity index 100%
rename from webshop/www/__init__.py
rename to shop/www/__init__.py
diff --git a/webshop/www/all-products/__init__.py b/shop/www/all-products/__init__.py
similarity index 100%
rename from webshop/www/all-products/__init__.py
rename to shop/www/all-products/__init__.py
diff --git a/webshop/www/all-products/index.html b/shop/www/all-products/index.html
similarity index 91%
rename from webshop/www/all-products/index.html
rename to shop/www/all-products/index.html
index cbd76632b6..f548036efe 100644
--- a/webshop/www/all-products/index.html
+++ b/shop/www/all-products/index.html
@@ -1,4 +1,4 @@
-{% from "webshop/templates/includes/macros.html" import attribute_filter_section, field_filter_section, discount_range_filters %}
+{% from "shop/templates/includes/macros.html" import attribute_filter_section, field_filter_section, discount_range_filters %}
{% extends "templates/web.html" %}
{% block title %}{{ _("All Products") }}{% endblock %}
diff --git a/webshop/www/all-products/index.js b/shop/www/all-products/index.js
similarity index 78%
rename from webshop/www/all-products/index.js
rename to shop/www/all-products/index.js
index 5af461a647..4a07fc7f71 100644
--- a/webshop/www/all-products/index.js
+++ b/shop/www/all-products/index.js
@@ -8,7 +8,7 @@ $(() => {
let view_type = localStorage.getItem("product_view") || "List View";
// Render Product Views, Filters & Search
- new webshop.ProductView({
+ new shop.ProductView({
view_type: view_type,
products_section: $('#product-listing'),
item_group: me.item_group
@@ -18,8 +18,8 @@ $(() => {
}
bind_card_actions() {
- webshop.webshop.shopping_cart.bind_add_to_cart_action();
- webshop.webshop.wishlist.bind_wishlist_action();
+ shop.shop.shopping_cart.bind_add_to_cart_action();
+ shop.shop.wishlist.bind_wishlist_action();
}
}
diff --git a/webshop/www/all-products/index.py b/shop/www/all-products/index.py
similarity index 72%
rename from webshop/www/all-products/index.py
rename to shop/www/all-products/index.py
index 3c80a18cea..2be2b7fd9f 100644
--- a/webshop/www/all-products/index.py
+++ b/shop/www/all-products/index.py
@@ -1,7 +1,7 @@
import frappe
from frappe.utils import cint
-from webshop.webshop.product_data_engine.filters import ProductFiltersBuilder
+from shop.shop.product_data_engine.filters import ProductFiltersBuilder
sitemap = 1
@@ -16,7 +16,7 @@ def get_context(context):
context.attribute_filters = filter_engine.get_attribute_filters()
context.page_length = (
- cint(frappe.db.get_single_value("Webshop Settings", "products_per_page")) or 20
+ cint(frappe.db.get_single_value("Shop Settings", "products_per_page")) or 20
)
context.no_cache = 1
diff --git a/webshop/www/all-products/not_found.html b/shop/www/all-products/not_found.html
similarity index 100%
rename from webshop/www/all-products/not_found.html
rename to shop/www/all-products/not_found.html
diff --git a/shop/www/mobile_signup.html b/shop/www/mobile_signup.html
new file mode 100644
index 0000000000..23403d805d
--- /dev/null
+++ b/shop/www/mobile_signup.html
@@ -0,0 +1,131 @@
+{% extends "templates/web.html" %}
+
+{% block title %} {{ _("Signup") }} {% endblock %}
+
+{% block page_content %}
+
+
+
+ {{ _("Create Account") }}
+ {{ _("Sign up with your mobile number to continue") }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ _("Already have an account?") }}
+ {{ _("Login here") }}
+
+
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/shop/www/mobile_signup.py b/shop/www/mobile_signup.py
new file mode 100644
index 0000000000..9e1e1460af
--- /dev/null
+++ b/shop/www/mobile_signup.py
@@ -0,0 +1,7 @@
+import frappe
+
+def get_context(context):
+ context.no_cache = 1
+ if frappe.session.user != "Guest":
+ frappe.local.flags.redirect_location = "/cart"
+ raise frappe.Redirect
diff --git a/webshop/www/shop-by-category/__init__.py b/shop/www/shop-by-category/__init__.py
similarity index 100%
rename from webshop/www/shop-by-category/__init__.py
rename to shop/www/shop-by-category/__init__.py
diff --git a/webshop/www/shop-by-category/category_card_section.html b/shop/www/shop-by-category/category_card_section.html
similarity index 100%
rename from webshop/www/shop-by-category/category_card_section.html
rename to shop/www/shop-by-category/category_card_section.html
diff --git a/webshop/www/shop-by-category/index.html b/shop/www/shop-by-category/index.html
similarity index 100%
rename from webshop/www/shop-by-category/index.html
rename to shop/www/shop-by-category/index.html
diff --git a/webshop/www/shop-by-category/index.js b/shop/www/shop-by-category/index.js
similarity index 100%
rename from webshop/www/shop-by-category/index.js
rename to shop/www/shop-by-category/index.js
diff --git a/webshop/www/shop-by-category/index.py b/shop/www/shop-by-category/index.py
similarity index 96%
rename from webshop/www/shop-by-category/index.py
rename to shop/www/shop-by-category/index.py
index beeabb53f5..cd93b9419c 100644
--- a/webshop/www/shop-by-category/index.py
+++ b/shop/www/shop-by-category/index.py
@@ -7,7 +7,7 @@
def get_context(context):
context.body_class = "product-page"
- settings = frappe.get_cached_doc("Webshop Settings")
+ settings = frappe.get_cached_doc("Shop Settings")
context.categories_enabled = settings.enable_field_filters
if context.categories_enabled:
@@ -45,7 +45,7 @@ def get_tabs(categories):
tab_values[f"tab_{index + 1}_title"] = frappe.unscrub(tab)
# pre-render cards for each tab
tab_values[f"tab_{index + 1}_content"] = frappe.render_template(
- "webshop/www/shop-by-category/category_card_section.html",
+ "shop/www/shop-by-category/category_card_section.html",
{"data": categorical_data[tab], "type": tab},
)
return tab_values
diff --git a/shop/www/upi_payment.html b/shop/www/upi_payment.html
new file mode 100644
index 0000000000..61867115b1
--- /dev/null
+++ b/shop/www/upi_payment.html
@@ -0,0 +1,219 @@
+{% extends "templates/base.html" %}
+
+{% block content %}
+
+
+
+
+
+ Scan & Pay via UPI
+
+
+
+ {# Loading state #}
+
+
+ Loading order details...
+
+
+ {# Error state #}
+
+
+ {# Order details - populated by JS #}
+
+
+ Order: —
+ —
+
+
+ {% if not upi_id %}
+
+
+ UPI ID not configured in Shop Settings.
+
+ {% else %}
+
+ {# Static QR Code #}
+
+
+
+ Scan the QR code using any UPI app
+
+ GPay
+ PhonePe
+ Paytm
+ BHIM
+
+
+
+
+
+
+ UPI ID: {{ upi_id }}
+ Payee: {{ payee_name }}
+ Ref: —
+
+
+ {# Pay via UPI App button (mobile only) #}
+
+ 📱 {{ _("Pay via UPI App") }}
+
+
+ {% endif %}
+
+ {# Confirm Payment Button - shown after deep link click or QR scan #}
+
+
+ {# Success state #}
+
+
+ ✅ Payment Recorded!
+ Ref:
+
+ Redirecting to your order...
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/shop/www/upi_payment.py b/shop/www/upi_payment.py
new file mode 100644
index 0000000000..72aad904b7
--- /dev/null
+++ b/shop/www/upi_payment.py
@@ -0,0 +1,12 @@
+import frappe
+
+# Prevent Frappe page caching
+no_cache = 1
+
+def get_context(context):
+ context.no_cache = 1
+ # We only pass static UPI settings server-side.
+ # Order details are fetched dynamically via JavaScript AJAX call
+ # to completely bypass any Frappe/browser page caching.
+ context.upi_id = frappe.db.get_single_value("Shop Settings", "upi_id") or ""
+ context.payee_name = frappe.db.get_single_value("Shop Settings", "payee_name") or ""
diff --git a/webshop/hooks.py b/webshop/hooks.py
deleted file mode 100644
index ed854d07cd..0000000000
--- a/webshop/hooks.py
+++ /dev/null
@@ -1,78 +0,0 @@
-from . import __version__ as _version
-
-app_name = "webshop"
-app_title = "Webshop"
-app_publisher = "Frappe Technologies Pvt. Ltd."
-app_description = "Open Source eCommerce Platform"
-app_email = "contact@frappe.io"
-app_license = "GNU General Public License (v3)"
-app_version = _version
-
-required_apps = ["payments", "erpnext"]
-
-web_include_css = "webshop-web.bundle.css"
-
-web_include_js = "web.bundle.js"
-
-after_install = "webshop.setup.install.after_install"
-on_logout = "webshop.webshop.shopping_cart.utils.clear_cart_count"
-on_session_creation = [
- "webshop.webshop.utils.portal.update_debtors_account",
- "webshop.webshop.shopping_cart.utils.set_cart_count",
-]
-update_website_context = [
- "webshop.webshop.shopping_cart.utils.update_website_context",
-]
-
-website_generators = ["Website Item", "Item Group"]
-
-override_doctype_class = {
- "Payment Request": "webshop.webshop.doctype.override_doctype.payment_request.PaymentRequest",
- "Item Group": "webshop.webshop.doctype.override_doctype.item_group.WebshopItemGroup",
- "Item": "webshop.webshop.doctype.override_doctype.item.WebshopItem",
-}
-
-doctype_js = {
- "Item": "public/js/override/item.js",
- "Homepage": "public/js/override/homepage.js",
-}
-
-doc_events = {
- "Item": {
- "on_update": [
- "webshop.webshop.crud_events.item.update_website_item.execute",
- "webshop.webshop.crud_events.item.invalidate_item_variants_cache.execute",
- ],
- "before_rename": [
- "webshop.webshop.crud_events.item.validate_duplicate_website_item.execute",
- ],
- "after_rename": [
- "webshop.webshop.crud_events.item.invalidate_item_variants_cache.execute",
- ],
- },
- "Sales Taxes and Charges Template": {
- "on_update": [
- "webshop.webshop.doctype.webshop_settings.webshop_settings.validate_cart_settings",
- ],
- },
- "Quotation": {
- "validate": [
- "webshop.webshop.crud_events.quotation.validate_shopping_cart_items.execute",
- ],
- },
- "Price List": {
- "validate": [
- "webshop.webshop.crud_events.price_list.check_impact_on_cart.execute"
- ],
- },
- "Tax Rule": {
- "validate": [
- "webshop.webshop.crud_events.tax_rule.validate_use_for_cart.execute",
- ],
- },
-}
-
-has_website_permission = {
- "Website Item": "webshop.webshop.doctype.website_item.website_item.has_website_permission_for_website_item",
- "Item Group": "webshop.webshop.doctype.website_item.website_item.has_website_permission_for_item_group"
-}
diff --git a/webshop/modules.txt b/webshop/modules.txt
deleted file mode 100644
index 6ec6d53352..0000000000
--- a/webshop/modules.txt
+++ /dev/null
@@ -1 +0,0 @@
-Webshop
\ No newline at end of file
diff --git a/webshop/patches.txt b/webshop/patches.txt
deleted file mode 100644
index 5c7abf22a9..0000000000
--- a/webshop/patches.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-[pre_model_sync]
-
-[post_model_sync]
-
-webshop.patches.add_homepage_field #09-05-2024
-webshop.patches.enable_allow_to_guest_view_for_item_group
-webshop.patches.clear_cache_for_item_group_route
\ No newline at end of file
diff --git a/webshop/public/js/init.js b/webshop/public/js/init.js
deleted file mode 100644
index fa3ebcaccf..0000000000
--- a/webshop/public/js/init.js
+++ /dev/null
@@ -1,2 +0,0 @@
-if (!window.webshop) window.webshop = {}
-if (!frappe.boot) frappe.boot = {}
diff --git a/webshop/public/js/shopping_cart.js b/webshop/public/js/shopping_cart.js
deleted file mode 100644
index 82c8199598..0000000000
--- a/webshop/public/js/shopping_cart.js
+++ /dev/null
@@ -1,243 +0,0 @@
-// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-// shopping cart
-frappe.provide("webshop.webshop.shopping_cart");
-var shopping_cart = webshop.webshop.shopping_cart;
-
-var getParams = function (url) {
- var params = [];
- var parser = document.createElement('a');
- parser.href = url;
- var query = parser.search.substring(1);
- var vars = query.split('&');
- for (var i = 0; i < vars.length; i++) {
- var pair = vars[i].split('=');
- params[pair[0]] = decodeURIComponent(pair[1]);
- }
- return params;
-};
-
-frappe.ready(function() {
- var full_name = frappe.session && frappe.session.user_fullname;
- // update user
- if(full_name) {
- $('.navbar li[data-label="User"] a')
- .html(' ' + full_name);
- }
- // set coupon code and sales partner code
-
- var url_args = getParams(window.location.href);
-
- var referral_coupon_code = url_args['cc'];
- var referral_sales_partner = url_args['sp'];
-
- var d = new Date();
- // expires within 30 minutes
- d.setTime(d.getTime() + (0.02 * 24 * 60 * 60 * 1000));
- var expires = "expires="+d.toUTCString();
- if (referral_coupon_code) {
- document.cookie = "referral_coupon_code=" + referral_coupon_code + ";" + expires + ";path=/";
- }
- if (referral_sales_partner) {
- document.cookie = "referral_sales_partner=" + referral_sales_partner + ";" + expires + ";path=/";
- }
- referral_coupon_code=frappe.get_cookie("referral_coupon_code");
- referral_sales_partner=frappe.get_cookie("referral_sales_partner");
-
- if (referral_coupon_code && $(".tot_quotation_discount").val()==undefined ) {
- $(".txtcoupon").val(referral_coupon_code);
- }
- if (referral_sales_partner) {
- $(".txtreferral_sales_partner").val(referral_sales_partner);
- }
-
- // update login
- shopping_cart.show_shoppingcart_dropdown();
- shopping_cart.set_cart_count();
- shopping_cart.show_cart_navbar();
-});
-
-$.extend(shopping_cart, {
- show_shoppingcart_dropdown: function() {
- $(".shopping-cart").on('shown.bs.dropdown', function() {
- if (!$('.shopping-cart-menu .cart-container').length) {
- return frappe.call({
- method: 'webshop.webshop.shopping_cart.cart.get_shopping_cart_menu',
- callback: function(r) {
- if (r.message) {
- $('.shopping-cart-menu').html(r.message);
- }
- }
- });
- }
- });
- },
-
- update_cart: function(opts) {
- if (frappe.session.user==="Guest") {
- if (localStorage) {
- localStorage.setItem("last_visited", window.location.pathname);
- }
- frappe.call('webshop.webshop.api.get_guest_redirect_on_action').then((res) => {
- window.location.href = res.message || "/login";
- });
- } else {
- shopping_cart.freeze();
- return frappe.call({
- type: "POST",
- method: "webshop.webshop.shopping_cart.cart.update_cart",
- args: {
- item_code: opts.item_code,
- qty: opts.qty,
- additional_notes: opts.additional_notes !== undefined ? opts.additional_notes : undefined,
- with_items: opts.with_items || 0
- },
- btn: opts.btn,
- callback: function(r) {
- shopping_cart.unfreeze();
- shopping_cart.set_cart_count(true);
- if(opts.callback)
- opts.callback(r);
- }
- });
- }
- },
-
- set_cart_count: function(animate=false) {
- $(".intermediate-empty-cart").remove();
-
- var cart_count = frappe.get_cookie("cart_count");
- if(frappe.session.user==="Guest") {
- cart_count = 0;
- }
-
- if(cart_count) {
- $(".shopping-cart").toggleClass('hidden', false);
- }
-
- var $cart = $('.cart-icon');
- var $badge = $cart.find("#cart-count");
-
- if(parseInt(cart_count) === 0 || cart_count === undefined) {
- $cart.css("display", "none");
- $(".cart-tax-items").hide();
- $(".btn-place-order").hide();
- $(".cart-payment-addresses").hide();
-
- let intermediate_empty_cart_msg = `
-
- ${ __("Cart is Empty") }
-
- `;
- $(".cart-table").after(intermediate_empty_cart_msg);
- }
- else {
- $cart.css("display", "inline");
- $("#cart-count").text(cart_count);
- }
-
- if(cart_count) {
- $badge.html(cart_count);
-
- if (animate) {
- $cart.addClass("cart-animate");
- setTimeout(() => {
- $cart.removeClass("cart-animate");
- }, 500);
- }
- } else {
- $badge.remove();
- }
- },
-
- shopping_cart_update: function({item_code, qty, cart_dropdown, additional_notes}) {
- shopping_cart.update_cart({
- item_code,
- qty,
- additional_notes,
- with_items: 1,
- btn: this,
- callback: function(r) {
- if(!r.exc) {
- $(".cart-items").html(r.message.items);
- $(".cart-tax-items").html(r.message.total);
- $(".payment-summary").html(r.message.taxes_and_totals);
- shopping_cart.set_cart_count();
-
- if (cart_dropdown != true) {
- $(".cart-icon").hide();
- }
- }
- },
- });
- },
-
- show_cart_navbar: function () {
- frappe.call({
- method: "webshop.webshop.doctype.webshop_settings.webshop_settings.is_cart_enabled",
- callback: function(r) {
- $(".shopping-cart").toggleClass('hidden', r.message ? false : true);
- }
- });
- },
-
- toggle_button_class(button, remove, add) {
- button.removeClass(remove);
- button.addClass(add);
- },
-
- bind_add_to_cart_action() {
- $('.page_content').on('click', '.btn-add-to-cart-list', (e) => {
- const $btn = $(e.currentTarget);
- $btn.prop('disabled', true);
-
- if (frappe.session.user==="Guest") {
- if (localStorage) {
- localStorage.setItem("last_visited", window.location.pathname);
- }
- frappe.call('webshop.webshop.api.get_guest_redirect_on_action').then((res) => {
- window.location.href = res.message || "/login";
- });
- return;
- }
-
- $btn.addClass('hidden');
- $btn.closest('.cart-action-container').addClass('d-flex');
- $btn.parent().find('.go-to-cart').removeClass('hidden');
- $btn.parent().find('.go-to-cart-grid').removeClass('hidden');
- $btn.parent().find('.cart-indicator').removeClass('hidden');
-
- const item_code = $btn.data('item-code');
- webshop.webshop.shopping_cart.update_cart({
- item_code,
- qty: 1
- });
-
- });
- },
-
- freeze() {
- if (window.location.pathname !== "/cart") return;
-
- if (!$('#freeze').length) {
- let freeze = $('')
- .appendTo("body");
-
- setTimeout(function() {
- freeze.addClass("show");
- }, 1);
- } else {
- $("#freeze").addClass("show");
- }
- },
-
- unfreeze() {
- if ($('#freeze').length) {
- let freeze = $('#freeze').removeClass("show");
- setTimeout(function() {
- freeze.remove();
- }, 1);
- }
- }
-});
diff --git a/webshop/public/scss/webshop-web.bundle.scss b/webshop/public/scss/webshop-web.bundle.scss
deleted file mode 100644
index f284e39afa..0000000000
--- a/webshop/public/scss/webshop-web.bundle.scss
+++ /dev/null
@@ -1 +0,0 @@
-@import "./webshop_cart";
\ No newline at end of file
diff --git a/webshop/templates/generators/item/item_add_to_cart.html b/webshop/templates/generators/item/item_add_to_cart.html
deleted file mode 100644
index c49dba5edb..0000000000
--- a/webshop/templates/generators/item/item_add_to_cart.html
+++ /dev/null
@@ -1,181 +0,0 @@
-{% if shopping_cart and shopping_cart.cart_settings.enabled %}
-
-{% set cart_settings = shopping_cart.cart_settings %}
-{% set product_info = shopping_cart.product_info %}
-
-
-
-
- {% if cart_settings.show_price and product_info.price %}
- {% set price_info = product_info.price %}
-
-
-
- {% if price_info.formatted_mrp %}
- {{ price_info.formatted_price_sales_uom }}
- {% else %}
- {{ price_info.formatted_price_sales_uom }}
- {% endif %}
-
-
- {% if price_info.formatted_mrp %}
-
- MRP {{ price_info.formatted_mrp }}
-
-
- -{{ price_info.get("formatted_discount_percent") or price_info.get("formatted_discount_rate")}}
-
- {% endif %}
-
-
-
- ({{ price_info.formatted_price }} / {{ product_info.uom }})
-
-
- {% else %}
- {{ _("UOM") }} : {{ product_info.uom }}
- {% endif %}
-
- {% if cart_settings.show_stock_availability %}
-
- {% if product_info.get("on_backorder") %}
-
- {{ _('Available on backorder') }}
-
- {% elif product_info.in_stock == 0 %}
-
- {{ _('Out of stock') }}
-
- {% elif product_info.in_stock == 1 %}
-
- {{ _('In stock') }}
- {% if product_info.show_stock_qty and product_info.stock_qty %}
- ({{ product_info.stock_qty }})
- {% endif %}
-
- {% endif %}
-
- {% endif %}
-
-
- {% if doc.offers %}
-
-
-
-
-
- Available Offers
-
-
- {% for offer in doc.offers %}
-
-
-
-
-
- {{ _(offer.offer_title) }}:
- {{ _(offer.offer_subtitle) if offer.offer_subtitle else '' }}
-
- {{ _("More") }}
-
-
-
- {% endfor %}
-
- {% endif %}
-
-
-
-
-
- {% if product_info.price and (cart_settings.allow_items_not_in_stock or product_info.get("in_stock")) %}
-
- {{ _("View in Cart") if cart_settings.enable_checkout else _("View in Quote") }}
-
-
- {% endif %}
-
-
- {% if cart_settings.show_contact_us_button %}
- {% include "templates/generators/item/item_inquiry.html" %}
- {% endif %}
-
-
-
-
-
-
-
-{% endif %}
diff --git a/webshop/templates/includes/cart/cart_address.html b/webshop/templates/includes/cart/cart_address.html
deleted file mode 100644
index c12f5796dc..0000000000
--- a/webshop/templates/includes/cart/cart_address.html
+++ /dev/null
@@ -1,264 +0,0 @@
-{% from "webshop/templates/includes/cart/cart_macros.html" import show_address %}
-
-{% if addresses | length == 1%}
- {% set select_address = True %}
-{% endif %}
-
-
-
- {{ _("Shipping Address") }}
-
-
-
-
- {% for address in shipping_addresses %}
- {% if doc.shipping_address_name == address.name %}
-
-
- {% include "templates/includes/cart/address_card.html" %}
-
-
- {% endif %}
- {% endfor %}
-
-
-
-
-
-
-
-
-
-
- {{ _("Billing Address") }}
-
-
-
-
- {% for address in billing_addresses %}
- {% if doc.customer_address == address.name %}
-
-
- {% include "templates/includes/cart/address_card.html" %}
-
-
- {% endif %}
- {% endfor %}
-
-
-
-
-
-
diff --git a/webshop/templates/includes/navbar/navbar_items.html b/webshop/templates/includes/navbar/navbar_items.html
deleted file mode 100644
index 73e97bf913..0000000000
--- a/webshop/templates/includes/navbar/navbar_items.html
+++ /dev/null
@@ -1,22 +0,0 @@
-{% extends 'frappe/templates/includes/navbar/navbar_items.html' %}
-
-{% block navbar_right_extension %}
-
-
-
-
-
-
- {% if frappe.db.get_single_value("Webshop Settings", "enable_wishlist") %}
-
-
-
-
-
-
- {% endif %}
-{% endblock %}
diff --git a/webshop/templates/pages/cart.html b/webshop/templates/pages/cart.html
deleted file mode 100644
index ee4e3ea5dd..0000000000
--- a/webshop/templates/pages/cart.html
+++ /dev/null
@@ -1,144 +0,0 @@
-{% extends "templates/web.html" %}
-
-{% block title %} {{ _("Shopping Cart") }} {% endblock %}
-
-{% block header %}{{ _("Shopping Cart") }}{% endblock %}
-
-{% block header_actions %}
-{% endblock %}
-
-{% block page_content %}
-
-{% from "templates/includes/macros.html" import item_name_and_description %}
-
-{% if doc.items %}
-
-
-
-
-
-
-
- {{ _('Items') }}
-
-
-
-
- {{ _('Item') }}
- {{ _('Quantity') }}
- {% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
- {{ _('Subtotal') }}
- {% endif %}
-
-
-
-
- {% include "templates/includes/cart/cart_items.html" %}
-
-
- {% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
-
- {% include "templates/includes/cart/cart_items_total.html" %}
-
- {% endif %}
-
-
-
-
- {% if cart_settings.enable_checkout %}
-
- {{ _('Past Orders') }}
-
- {% else %}
-
- {{ _('Past Quotes') }}
-
- {% endif %}
-
-
- {% if doc.items %}
-
- {% endif %}
-
-
-
-
-
- {% if doc.items %}
- {% if doc.terms %}
-
- {{ _("Terms and Conditions") }}
-
- {{ doc.terms }}
-
-
- {% endif %}
-
-
-
-
-
-
- {% set show_coupon_code = cart_settings.show_apply_coupon_code_in_website and cart_settings.enable_checkout %}
- {% set coupon_code = doc.coupon_code if doc.coupon_code else "" %}
-
- {% if show_coupon_code == 1%}
- {% if coupon_code %}
- {% include "templates/includes/cart/coupon_code.html" %}
- {% else %}
-
-
-
-
-
-
-
- {% endif %}
- {% endif %}
-
-
-
- {% include "templates/includes/cart/cart_payment_summary.html" %}
-
-
-
- {% include "templates/includes/cart/place_order.html" %}
-
-
-
- {% include "templates/includes/cart/cart_address.html" %}
-
-
- {% endif %}
-
-
-{% else %}
-
-
-
-
- {{ _('Your cart is Empty') }}
- {% if cart_settings.enable_checkout %}
-
- {{ _('See past orders') }}
-
- {% else %}
-
- {{ _('See past quotations') }}
-
- {% endif %}
-
-{% endif %}
-
-{% endblock %}
-
-{% block base_scripts %}
-
-{{ include_script("frappe-web.bundle.js") }}
-{{ include_script("controls.bundle.js") }}
-{{ include_script("dialog.bundle.js") }}
-{% endblock %}
diff --git a/webshop/templates/pages/cart.js b/webshop/templates/pages/cart.js
deleted file mode 100644
index dd03f3d1c7..0000000000
--- a/webshop/templates/pages/cart.js
+++ /dev/null
@@ -1,249 +0,0 @@
-// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-// JS exclusive to /cart page
-frappe.provide("webshop.webshop.shopping_cart");
-var shopping_cart = webshop.webshop.shopping_cart;
-
-$.extend(shopping_cart, {
- show_error: function(title, text) {
- $("#cart-container").html('' +
- title + '
' + text + '
');
- },
-
- bind_events: function() {
- shopping_cart.bind_place_order();
- shopping_cart.bind_request_quotation();
- shopping_cart.bind_change_qty();
- shopping_cart.bind_remove_cart_item();
- shopping_cart.bind_change_notes();
- shopping_cart.bind_coupon_code();
- shopping_cart.bind_remove_coupon_code();
- },
-
- bind_place_order: function() {
- $(".btn-place-order").on("click", function() {
- shopping_cart.place_order(this);
- });
- },
-
- bind_request_quotation: function() {
- $('.btn-request-for-quotation').on('click', function() {
- shopping_cart.request_quotation(this);
- });
- },
-
- bind_change_qty: function() {
- // bind update button
- $(".cart-items").on("change", ".cart-qty", function() {
- var item_code = $(this).attr("data-item-code");
- var newVal = $(this).val();
- shopping_cart.shopping_cart_update({item_code, qty: newVal});
- });
-
- $(".cart-items").on('click', '.number-spinner button', function () {
- var btn = $(this),
- input = btn.closest('.number-spinner').find('input'),
- oldValue = input.val().trim(),
- newVal = 0;
-
- if (btn.attr('data-dir') == 'up') {
- newVal = parseInt(oldValue) + 1;
- } else {
- if (oldValue > 1) {
- newVal = parseInt(oldValue) - 1;
- }
- }
- input.val(newVal);
-
- let notes = input.closest("td").siblings().find(".notes").text().trim();
- var item_code = input.attr("data-item-code");
- shopping_cart.shopping_cart_update({
- item_code,
- qty: newVal,
- additional_notes: notes
- });
- });
- },
-
- bind_change_notes: function() {
- $('.cart-items').on('change', 'textarea', function() {
- const $textarea = $(this);
- const item_code = $textarea.attr('data-item-code');
- const qty = $textarea.closest('tr').find('.cart-qty').val();
- const notes = $textarea.val();
- shopping_cart.shopping_cart_update({
- item_code,
- qty,
- additional_notes: notes
- });
- });
- },
-
- bind_remove_cart_item: function() {
- $(".cart-items").on("click", ".remove-cart-item", (e) => {
- const $remove_cart_item_btn = $(e.currentTarget);
- var item_code = $remove_cart_item_btn.data("item-code");
-
- shopping_cart.shopping_cart_update({
- item_code: item_code,
- qty: 0
- });
- });
- },
-
- render_tax_row: function($cart_taxes, doc, shipping_rules) {
- var shipping_selector;
- if(shipping_rules) {
- shipping_selector = '';
- }
-
- var $tax_row = $(repl('\
- \
- \
- ' +
- (shipping_selector || '%(description)s
') +
- '\
- \
- \
- \
- %(formatted_tax_amount)s
\
- \
- ', doc)).appendTo($cart_taxes);
-
- if(shipping_selector) {
- $tax_row.find('select option').each(function(i, opt) {
- if($(opt).html() == doc.description) {
- $(opt).attr("selected", "selected");
- }
- });
- $tax_row.find('select').on("change", function() {
- shopping_cart.apply_shipping_rule($(this).val(), this);
- });
- }
- },
-
- apply_shipping_rule: function(rule, btn) {
- return frappe.call({
- btn: btn,
- type: "POST",
- method: "webshop.webshop.shopping_cart.cart.apply_shipping_rule",
- args: { shipping_rule: rule },
- callback: function(r) {
- if(!r.exc) {
- shopping_cart.render(r.message);
- }
- }
- });
- },
-
- place_order: function(btn) {
- shopping_cart.freeze();
-
- return frappe.call({
- type: "POST",
- method: "webshop.webshop.shopping_cart.cart.place_order",
- btn: btn,
- callback: function(r) {
- if(r.exc) {
- shopping_cart.unfreeze();
- var msg = "";
- if(r._server_messages) {
- msg = JSON.parse(r._server_messages || []).join("
");
- }
-
- $("#cart-error")
- .empty()
- .html(msg || frappe._("Something went wrong!"))
- .toggle(true);
- } else {
- $(btn).hide();
- window.location.href = '/orders/' + encodeURIComponent(r.message);
- }
- }
- });
- },
-
- request_quotation: function(btn) {
- shopping_cart.freeze();
-
- return frappe.call({
- type: "POST",
- method: "webshop.webshop.shopping_cart.cart.request_for_quotation",
- btn: btn,
- callback: function(r) {
- if(r.exc) {
- shopping_cart.unfreeze();
- var msg = "";
- if(r._server_messages) {
- msg = JSON.parse(r._server_messages || []).join("
");
- }
-
- $("#cart-error")
- .empty()
- .html(msg || frappe._("Something went wrong!"))
- .toggle(true);
- } else {
- $(btn).hide();
- window.location.href = '/quotations/' + encodeURIComponent(r.message);
- }
- }
- });
- },
-
- bind_coupon_code: function() {
- $(".bt-coupon").on("click", function() {
- shopping_cart.apply_coupon_code(this);
- });
- },
-
- apply_coupon_code: function(btn) {
- return frappe.call({
- type: "POST",
- method: "webshop.webshop.shopping_cart.cart.apply_coupon_code",
- btn: btn,
- args : {
- applied_code : $('.txtcoupon').val(),
- applied_referral_sales_partner: $('.txtreferral_sales_partner').val()
- },
- callback: function(r) {
- if (r && r.message){
- location.reload();
- }
- }
- });
- },
-
- bind_remove_coupon_code: function() {
- $(".bt-remove-coupon-code").on("click", function() {
- shopping_cart.remove_coupon_code(this);
- });
- },
- remove_coupon_code: function(btn) {
- return frappe.call({
- type: "POST",
- method: "webshop.webshop.shopping_cart.cart.remove_coupon_code",
- btn: btn,
- callback: function(r) {
- if (r && r.message){
- location.reload();
- }
- }
- });
- },
-});
-
-frappe.ready(function() {
- if (window.location.pathname === "/cart") {
- $(".cart-icon").hide();
- }
- shopping_cart.parent = $(".cart-container");
- shopping_cart.bind_events();
-});
-
-function show_terms() {
- var html = $(".cart-terms").html();
- frappe.msgprint(html);
-}
diff --git a/webshop/webshop/api.py b/webshop/webshop/api.py
deleted file mode 100644
index 82650d868d..0000000000
--- a/webshop/webshop/api.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-
-import json
-
-import frappe
-from frappe.utils import cint
-
-from webshop.webshop.product_data_engine.filters import ProductFiltersBuilder
-from webshop.webshop.product_data_engine.query import ProductQuery
-from webshop.webshop.doctype.override_doctype.item_group import get_child_groups_for_website
-
-
-@frappe.whitelist(allow_guest=True)
-def get_product_filter_data(query_args=None):
- """
- Returns filtered products and discount filters.
-
- Args:
- query_args (dict): contains filters to get products list
-
- Query Args filters:
- search (str): Search Term.
- field_filters (dict): Keys include item_group, brand, etc.
- attribute_filters(dict): Keys include Color, Size, etc.
- start (int): Offset items by
- item_group (str): Valid Item Group
- from_filters (bool): Set as True to jump to page 1
- """
- if isinstance(query_args, str):
- query_args = json.loads(query_args)
-
- query_args = frappe._dict(query_args or {})
-
- if query_args:
- search = query_args.get("search")
- field_filters = query_args.get("field_filters", {})
- attribute_filters = query_args.get("attribute_filters", {})
- start = cint(query_args.start) if query_args.get("start") else 0
- item_group = query_args.get("item_group")
- from_filters = query_args.get("from_filters")
- else:
- search, attribute_filters, item_group, from_filters = None, None, None, None
- field_filters = {}
- start = 0
-
- # if new filter is checked, reset start to show filtered items from page 1
- if from_filters:
- start = 0
-
- sub_categories = []
- if item_group:
- sub_categories = get_child_groups_for_website(item_group, immediate=True)
-
- engine = ProductQuery()
-
- try:
- result = engine.query(
- attribute_filters,
- field_filters,
- search_term=search,
- start=start,
- item_group=item_group,
- )
- except Exception:
- frappe.log_error("Product query with filter failed")
- return {"exc": "Something went wrong!"}
-
- # discount filter data
- filters = {}
- discounts = result["discounts"]
-
- if discounts:
- filter_engine = ProductFiltersBuilder()
- filters["discount_filters"] = filter_engine.get_discount_filters(discounts)
-
- return {
- "items": result["items"] or [],
- "filters": filters,
- "settings": engine.settings,
- "sub_categories": sub_categories,
- "items_count": result["items_count"],
- }
-
-
-@frappe.whitelist(allow_guest=True)
-def get_guest_redirect_on_action():
- return frappe.db.get_single_value("Webshop Settings", "redirect_on_action")
diff --git a/webshop/webshop/doctype/webshop_settings/webshop_settings.json b/webshop/webshop/doctype/webshop_settings/webshop_settings.json
deleted file mode 100644
index 024ec2efd3..0000000000
--- a/webshop/webshop/doctype/webshop_settings/webshop_settings.json
+++ /dev/null
@@ -1,415 +0,0 @@
-{
- "actions": [],
- "creation": "2021-02-10 17:13:39.139103",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "products_per_page",
- "filter_categories_section",
- "enable_field_filters",
- "filter_fields",
- "enable_attribute_filters",
- "filter_attributes",
- "display_settings_section",
- "hide_variants",
- "enable_variants",
- "show_price",
- "column_break_9",
- "login_required_to_view_products",
- "show_stock_availability",
- "show_quantity_in_website",
- "allow_items_not_in_stock",
- "column_break_13",
- "show_apply_coupon_code_in_website",
- "show_contact_us_button",
- "show_attachments",
- "section_break_18",
- "company",
- "price_list",
- "enabled",
- "store_page_docs",
- "column_break_21",
- "default_customer_group",
- "quotation_series",
- "allow_non_website_items_in_cart_quotation",
- "checkout_settings_section",
- "enable_checkout",
- "show_price_in_quotation",
- "column_break_27",
- "save_quotations_as_draft",
- "payment_gateway_account",
- "payment_success_url",
- "add_ons_section",
- "enable_wishlist",
- "column_break_22",
- "enable_reviews",
- "column_break_23",
- "enable_recommendations",
- "item_search_settings_section",
- "redisearch_warning",
- "search_index_fields",
- "is_redisearch_enabled",
- "is_redisearch_loaded",
- "shop_by_category_section",
- "slideshow",
- "guest_display_settings_section",
- "hide_price_for_guest",
- "redirect_on_action"
- ],
- "fields": [
- {
- "default": "6",
- "fieldname": "products_per_page",
- "fieldtype": "Int",
- "label": "Products per Page"
- },
- {
- "collapsible": 1,
- "fieldname": "filter_categories_section",
- "fieldtype": "Section Break",
- "label": "Filters and Categories"
- },
- {
- "default": "0",
- "fieldname": "hide_variants",
- "fieldtype": "Check",
- "label": "Hide Variants"
- },
- {
- "default": "0",
- "description": "The field filters will also work as categories in the Shop by Category page.",
- "fieldname": "enable_field_filters",
- "fieldtype": "Check",
- "label": "Enable Field Filters (Categories)"
- },
- {
- "default": "0",
- "fieldname": "enable_attribute_filters",
- "fieldtype": "Check",
- "label": "Enable Attribute Filters"
- },
- {
- "depends_on": "enable_field_filters",
- "fieldname": "filter_fields",
- "fieldtype": "Table",
- "label": "Website Item Fields",
- "options": "Website Filter Field"
- },
- {
- "depends_on": "enable_attribute_filters",
- "fieldname": "filter_attributes",
- "fieldtype": "Table",
- "label": "Attributes",
- "options": "Website Attribute"
- },
- {
- "default": "0",
- "fieldname": "enabled",
- "fieldtype": "Check",
- "in_list_view": 1,
- "label": "Enable Shopping Cart"
- },
- {
- "depends_on": "doc.enabled",
- "fieldname": "store_page_docs",
- "fieldtype": "HTML"
- },
- {
- "fieldname": "display_settings_section",
- "fieldtype": "Section Break",
- "label": "Display Settings"
- },
- {
- "default": "0",
- "fieldname": "show_attachments",
- "fieldtype": "Check",
- "label": "Show Public Attachments"
- },
- {
- "default": "0",
- "fieldname": "show_price",
- "fieldtype": "Check",
- "label": "Show Price"
- },
- {
- "default": "0",
- "fieldname": "show_stock_availability",
- "fieldtype": "Check",
- "label": "Show Stock Availability"
- },
- {
- "default": "0",
- "fieldname": "enable_variants",
- "fieldtype": "Check",
- "label": "Enable Variant Selection"
- },
- {
- "fieldname": "column_break_13",
- "fieldtype": "Column Break"
- },
- {
- "default": "0",
- "fieldname": "show_contact_us_button",
- "fieldtype": "Check",
- "label": "Show Contact Us Button"
- },
- {
- "default": "0",
- "depends_on": "show_stock_availability",
- "fieldname": "show_quantity_in_website",
- "fieldtype": "Check",
- "label": "Show Stock Quantity"
- },
- {
- "default": "0",
- "fieldname": "show_apply_coupon_code_in_website",
- "fieldtype": "Check",
- "label": "Show Apply Coupon Code"
- },
- {
- "default": "0",
- "fieldname": "allow_items_not_in_stock",
- "fieldtype": "Check",
- "label": "Allow items not in stock to be added to cart"
- },
- {
- "fieldname": "section_break_18",
- "fieldtype": "Section Break",
- "label": "Shopping Cart"
- },
- {
- "depends_on": "enabled",
- "fieldname": "company",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Company",
- "mandatory_depends_on": "eval: doc.enabled === 1",
- "options": "Company",
- "remember_last_selected_value": 1
- },
- {
- "depends_on": "enabled",
- "description": "Prices will not be shown if Price List is not set",
- "fieldname": "price_list",
- "fieldtype": "Link",
- "label": "Price List",
- "mandatory_depends_on": "eval: doc.enabled === 1",
- "options": "Price List"
- },
- {
- "fieldname": "column_break_21",
- "fieldtype": "Column Break"
- },
- {
- "depends_on": "enabled",
- "fieldname": "default_customer_group",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Customer Group",
- "mandatory_depends_on": "eval: doc.enabled === 1",
- "options": "Customer Group"
- },
- {
- "depends_on": "enabled",
- "fieldname": "quotation_series",
- "fieldtype": "Select",
- "label": "Quotation Series",
- "mandatory_depends_on": "eval: doc.enabled === 1"
- },
- {
- "collapsible": 1,
- "collapsible_depends_on": "eval:doc.enable_checkout",
- "depends_on": "enabled",
- "fieldname": "checkout_settings_section",
- "fieldtype": "Section Break",
- "label": "Checkout Settings"
- },
- {
- "default": "0",
- "fieldname": "enable_checkout",
- "fieldtype": "Check",
- "label": "Enable Checkout"
- },
- {
- "default": "Orders",
- "depends_on": "enable_checkout",
- "description": "After payment completion redirect user to selected page.",
- "fieldname": "payment_success_url",
- "fieldtype": "Select",
- "label": "Payment Success Url",
- "mandatory_depends_on": "enable_checkout",
- "options": "\nOrders\nInvoices\nMy Account"
- },
- {
- "fieldname": "column_break_27",
- "fieldtype": "Column Break"
- },
- {
- "default": "0",
- "depends_on": "eval: doc.enable_checkout == 0",
- "fieldname": "save_quotations_as_draft",
- "fieldtype": "Check",
- "label": "Save Quotations as Draft"
- },
- {
- "depends_on": "enable_checkout",
- "fieldname": "payment_gateway_account",
- "fieldtype": "Link",
- "label": "Payment Gateway Account",
- "mandatory_depends_on": "enable_checkout",
- "options": "Payment Gateway Account"
- },
- {
- "collapsible": 1,
- "depends_on": "enable_field_filters",
- "fieldname": "shop_by_category_section",
- "fieldtype": "Section Break",
- "label": "Shop by Category"
- },
- {
- "fieldname": "slideshow",
- "fieldtype": "Link",
- "label": "Slideshow",
- "options": "Website Slideshow"
- },
- {
- "collapsible": 1,
- "fieldname": "add_ons_section",
- "fieldtype": "Section Break",
- "label": "Add-ons"
- },
- {
- "default": "0",
- "fieldname": "enable_wishlist",
- "fieldtype": "Check",
- "label": "Enable Wishlist"
- },
- {
- "default": "0",
- "fieldname": "enable_reviews",
- "fieldtype": "Check",
- "label": "Enable Reviews and Ratings"
- },
- {
- "fieldname": "search_index_fields",
- "fieldtype": "Small Text",
- "label": "Search Index Fields",
- "mandatory_depends_on": "is_redisearch_enabled",
- "read_only_depends_on": "eval:!doc.is_redisearch_loaded"
- },
- {
- "collapsible": 1,
- "fieldname": "item_search_settings_section",
- "fieldtype": "Section Break",
- "label": "Item Search Settings"
- },
- {
- "default": "0",
- "fieldname": "is_redisearch_loaded",
- "fieldtype": "Check",
- "hidden": 1,
- "label": "Is Redisearch Loaded"
- },
- {
- "depends_on": "eval:!doc.is_redisearch_loaded",
- "fieldname": "redisearch_warning",
- "fieldtype": "HTML",
- "label": "Redisearch Warning",
- "options": "Redisearch is not loaded. If you want to use the advanced product search feature, refer here.
"
- },
- {
- "default": "0",
- "depends_on": "eval:doc.show_price",
- "fieldname": "hide_price_for_guest",
- "fieldtype": "Check",
- "label": "Hide Price for Guest"
- },
- {
- "fieldname": "column_break_9",
- "fieldtype": "Column Break"
- },
- {
- "collapsible": 1,
- "fieldname": "guest_display_settings_section",
- "fieldtype": "Section Break",
- "label": "Guest Display Settings"
- },
- {
- "description": "Link to redirect Guest on actions that need login such as add to cart, wishlist, etc. E.g.: /login",
- "fieldname": "redirect_on_action",
- "fieldtype": "Data",
- "label": "Redirect on Action"
- },
- {
- "fieldname": "column_break_22",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "column_break_23",
- "fieldtype": "Column Break"
- },
- {
- "default": "0",
- "fieldname": "enable_recommendations",
- "fieldtype": "Check",
- "label": "Enable Recommendations"
- },
- {
- "default": "0",
- "depends_on": "eval: doc.enable_checkout == 0",
- "fieldname": "show_price_in_quotation",
- "fieldtype": "Check",
- "label": "Show Price in Quotation"
- },
- {
- "default": "0",
- "fieldname": "is_redisearch_enabled",
- "fieldtype": "Check",
- "label": "Enable Redisearch",
- "read_only_depends_on": "eval:!doc.is_redisearch_loaded"
- },
- {
- "default": "0",
- "fieldname": "login_required_to_view_products",
- "fieldtype": "Check",
- "label": "Login Required to View Products"
- },
- {
- "default": "0",
- "depends_on": "enabled",
- "fieldname": "allow_non_website_items_in_cart_quotation",
- "fieldtype": "Check",
- "in_list_view": 1,
- "label": "Allow Non Website Items in Cart Quotation"
- }
- ],
- "index_web_pages_for_search": 1,
- "issingle": 1,
- "links": [],
- "modified": "2025-03-22 13:01:51.906319",
- "modified_by": "Administrator",
- "module": "Webshop",
- "name": "Webshop Settings",
- "owner": "Administrator",
- "permissions": [
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "print": 1,
- "read": 1,
- "role": "System Manager",
- "share": 1,
- "write": 1
- },
- {
- "read": 1,
- "role": "All"
- }
- ],
- "sort_field": "modified",
- "sort_order": "DESC",
- "states": [],
- "track_changes": 1
-}
\ No newline at end of file
{{ _("Shipping Address") }}
++ {% for address in shipping_addresses %} + {% if doc.shipping_address_name == address.name %} +
{{ _("Billing Address") }}
++ {% for address in billing_addresses %} + {% if doc.customer_address == address.name %} +
{{ _("Payment Summary") }}
@@ -8,30 +9,55 @@
{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
-
-
- {% set total_items = frappe.utils.cstr(frappe.utils.flt(doc.total_qty, 0)) %}
- {{ _("Net Total (") + total_items + _(" Items)") }}
- {{ doc.get_formatted("net_total") }}
-
+
+
+ {% set total_items = frappe.utils.cstr(frappe.utils.flt(doc.total_qty, 0)) %}
+ {{ _("Net Total (") + total_items + _(" Items)") }}
+ {{ doc.get_formatted("net_total") }}
+
-
- {% for d in doc.taxes %}
- {% if d.tax_amount %}
-
-
- {{ d.description }}
-
-
- {{ d.get_formatted("tax_amount") }}
-
-
- {% endif %}
- {% endfor %}
-
+ {% for d in doc.taxes %}
+ {% if d.tax_amount %}
+
+
+ {{ d.description }}
+
+
+ {{ d.get_formatted("tax_amount") }}
+
+
+ {% endif %}
+ {% endfor %}
-
-
+ {#
+ {% if shipping_rules | length > 0 %}
+
+ {{ _("Shipping Method") }}
+
+
+
+
+ {% endif %}
+ #}
+
+ {% if cart_settings.enable_manual_shipping_charge and not doc.shipping_rule %}
+
+ {{ _("Shipping Charge") }}
+ {{ frappe.utils.fmt_money(cart_settings.default_shipping_charge,
+ currency=doc.currency) }}
+
+ {% endif %}
+
+
+
+
-
-
- {{ _("Grand Total") }}
- {{ doc.get_formatted("grand_total") }}
-
-
+
+
+ {{ _("Grand Total") }}
+ {{ doc.get_formatted("grand_total") }}
+
+
{% endif %}
diff --git a/webshop/templates/includes/cart/coupon_code.html b/shop/templates/includes/cart/coupon_code.html
similarity index 100%
rename from webshop/templates/includes/cart/coupon_code.html
rename to shop/templates/includes/cart/coupon_code.html
diff --git a/webshop/templates/includes/cart/place_order.html b/shop/templates/includes/cart/place_order.html
similarity index 100%
rename from webshop/templates/includes/cart/place_order.html
rename to shop/templates/includes/cart/place_order.html
diff --git a/webshop/templates/includes/macros.html b/shop/templates/includes/macros.html
similarity index 100%
rename from webshop/templates/includes/macros.html
rename to shop/templates/includes/macros.html
diff --git a/shop/templates/includes/navbar/navbar_items.html b/shop/templates/includes/navbar/navbar_items.html
new file mode 100644
index 0000000000..b3c87e8127
--- /dev/null
+++ b/shop/templates/includes/navbar/navbar_items.html
@@ -0,0 +1,25 @@
+{% extends 'frappe/templates/includes/navbar/navbar_items.html' %}
+
+{% block navbar_right_extension %}
+
| {{ _("Net Total (") + total_items + _(" Items)") }} | -{{ doc.get_formatted("net_total") }} | -
| {{ _("Net Total (") + total_items + _(" Items)") }} | +{{ doc.get_formatted("net_total") }} | +
| - {{ d.description }} - | -- {{ d.get_formatted("tax_amount") }} - | -
| {{ _("Grand Total") }} | -{{ doc.get_formatted("grand_total") }} | -
| {{ _("Grand Total") }} | +{{ doc.get_formatted("grand_total") }} | +
{{ _("Shopping Cart") }}{% endblock %}
+
+ {% block header_actions %}
+ {% endblock %}
+
+ {% block page_content %}
+
+ {% from "templates/includes/macros.html" import item_name_and_description %}
+
+ {% if doc.items %}
+
+
+
+
+
+
+
+ {{ _('Items') }}
+
+
+
+
+ {{ _('Item') }}
+ {{ _('Quantity') }}
+ {% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
+ {{ _('Subtotal') }}
+ {% endif %}
+
+
+
+
+ {% include "templates/includes/cart/cart_items.html" %}
+
+
+ {% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
+
+ {% include "templates/includes/cart/cart_items_total.html" %}
+
+ {% endif %}
+
+
+
+
+ {% if cart_settings.enable_checkout %}
+
+ {{ _('Past Orders') }}
+
+ {% else %}
+
+ {{ _('Past Quotes') }}
+
+ {% endif %}
+
+
+ {% if doc.items %}
+
+ {% endif %}
+
+
+
+
+
+ {% if doc.items %}
+ {% if doc.terms %}
+
+ {{ _("Terms and Conditions") }}
+
+ {{ doc.terms }}
+
+
+ {% endif %}
+
+
+
+
+
+
+ {% set show_coupon_code = cart_settings.show_apply_coupon_code_in_website and
+ cart_settings.enable_checkout %}
+ {% set coupon_code = doc.coupon_code if doc.coupon_code else "" %}
+
+ {% if show_coupon_code == 1%}
+ {% if coupon_code %}
+ {% include "templates/includes/cart/coupon_code.html" %}
+ {% else %}
+
+
+
+
+
+
+
+ {% endif %}
+ {% endif %}
+
+
+
+ {% include "templates/includes/cart/cart_payment_summary.html" %}
+
+
+
+ {% include "templates/includes/cart/place_order.html" %}
+
+
+
+ {% if frappe.session.user == "Guest" %}
+
+ {{ _("Save your details?") }}
+ {{ _("Sign up with your mobile number to track orders and save your
+ address.") }}
+
+ {{ _("Signup with Mobile Number") }}
+
+
+ {{ _("Already have an account?") }} {{ _("Login")
+ }}
+
+
+
+ {% if cart_settings.allow_guest_checkout %}
+
+ {{ _("Alternatively, Checkout as Guest") }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% endif %}
+ {% endif %}
+
+ {% include "templates/includes/cart/cart_address.html" %}
+
+
+ {% endif %}
+
+
+
+
+
+ {{ _("Total Amount") }}
+ {{ doc.get_formatted("grand_total") }}
+
+
+
+
+ {% else %}
+
+
+
+
+ {{ _('Your cart is Empty') }}
+ {% if cart_settings.enable_checkout %}
+
+ {{ _('See past orders') }}
+
+ {% else %}
+
+ {{ _('See past quotations') }}
+
+ {% endif %}
+
+ {% endif %}
+
+ {% endblock %}
+
+ {% block base_scripts %}
+
+ {{ include_script("frappe-web.bundle.js") }}
+ {{ include_script("controls.bundle.js") }}
+ {{ include_script("dialog.bundle.js") }}
+ {% endblock %}
\ No newline at end of file
diff --git a/shop/templates/pages/cart.js b/shop/templates/pages/cart.js
new file mode 100644
index 0000000000..b7670aef26
--- /dev/null
+++ b/shop/templates/pages/cart.js
@@ -0,0 +1,354 @@
+// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+// JS exclusive to /cart page
+frappe.provide("shop.shop.shopping_cart");
+var shopping_cart = shop.shop.shopping_cart;
+
+$.extend(shopping_cart, {
+ show_error: function (title, text) {
+ $("#cart-container").html('' +
+ title + '
' + text + '
');
+ },
+
+ bind_events: function () {
+ shopping_cart.bind_place_order();
+ shopping_cart.bind_request_quotation();
+ shopping_cart.bind_change_qty();
+ shopping_cart.bind_remove_cart_item();
+ shopping_cart.bind_change_notes();
+ shopping_cart.bind_coupon_code();
+ shopping_cart.bind_remove_coupon_code();
+ shopping_cart.bind_guest_country_change();
+ shopping_cart.bind_guest_state_change();
+ shopping_cart.bind_shipping_rule_change();
+ },
+
+ bind_place_order: function () {
+ $(".btn-place-order, .btn-place-order-mobile").on("click", function () {
+ shopping_cart.place_order(this);
+ });
+ },
+
+ bind_request_quotation: function () {
+ $('.btn-request-for-quotation').on('click', function () {
+ shopping_cart.request_quotation(this);
+ });
+ },
+
+ bind_change_qty: function () {
+ // bind update button
+ $(".cart-items").on("change", ".cart-qty", function () {
+ var item_code = $(this).attr("data-item-code");
+ var newVal = $(this).val();
+ shopping_cart.shopping_cart_update({ item_code, qty: newVal });
+ });
+
+ $(".cart-items").on('click', '.number-spinner button', function () {
+ var btn = $(this),
+ input = btn.closest('.number-spinner').find('input'),
+ oldValue = input.val().trim(),
+ newVal = 0;
+
+ if (btn.attr('data-dir') == 'up') {
+ newVal = parseInt(oldValue) + 1;
+ } else {
+ if (oldValue > 1) {
+ newVal = parseInt(oldValue) - 1;
+ }
+ }
+ input.val(newVal);
+
+ let notes = input.closest("td").siblings().find(".notes").text().trim();
+ var item_code = input.attr("data-item-code");
+ shopping_cart.shopping_cart_update({
+ item_code,
+ qty: newVal,
+ additional_notes: notes
+ });
+ });
+ },
+
+ bind_change_notes: function () {
+ $('.cart-items').on('change', 'textarea', function () {
+ const $textarea = $(this);
+ const item_code = $textarea.attr('data-item-code');
+ const qty = $textarea.closest('tr').find('.cart-qty').val();
+ const notes = $textarea.val();
+ shopping_cart.shopping_cart_update({
+ item_code,
+ qty,
+ additional_notes: notes
+ });
+ });
+ },
+
+ bind_remove_cart_item: function () {
+ $(".cart-items").on("click", ".remove-cart-item", (e) => {
+ const $remove_cart_item_btn = $(e.currentTarget);
+ var item_code = $remove_cart_item_btn.data("item-code");
+
+ shopping_cart.shopping_cart_update({
+ item_code: item_code,
+ qty: 0
+ });
+ });
+ },
+
+ render_tax_row: function ($cart_taxes, doc, shipping_rules) {
+ var shipping_selector;
+ if (shipping_rules) {
+ shipping_selector = '';
+ }
+
+ var $tax_row = $(repl('\
+ \
+ \
+ ' +
+ (shipping_selector || '%(description)s
') +
+ '\
+ \
+ \
+ \
+ %(formatted_tax_amount)s
\
+ \
+ ', doc)).appendTo($cart_taxes);
+
+ if (shipping_selector) {
+ $tax_row.find('select option').each(function (i, opt) {
+ if ($(opt).html() == doc.description) {
+ $(opt).attr("selected", "selected");
+ }
+ });
+ $tax_row.find('select').on("change", function () {
+ shopping_cart.apply_shipping_rule($(this).val(), this);
+ });
+ }
+ },
+
+ apply_shipping_rule: function (rule, btn) {
+ return frappe.call({
+ btn: btn,
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.apply_shipping_rule",
+ args: { shipping_rule: rule },
+ callback: function (r) {
+ if (!r.exc) {
+ shopping_cart.render(r.message);
+ }
+ }
+ });
+ },
+
+ place_order: function (btn) {
+ shopping_cart.freeze();
+
+ let guest_details = {};
+ if (frappe.session.user === "Guest") {
+ guest_details = {
+ email: $(".guest-email").val(),
+ fullname: $(".guest-fullname").val(),
+ phone: $(".guest-phone").val(),
+ address: $(".guest-address").val(),
+ state: $(".guest-state").val(),
+ country: $(".guest-country").val(),
+ };
+
+ if (!guest_details.email || !guest_details.fullname || !guest_details.address) {
+ shopping_cart.unfreeze();
+ frappe.msgprint(__("Please fill in all mandatory guest details."));
+ return;
+ }
+ }
+
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.place_order",
+ btn: btn,
+ args: {
+ guest_details: guest_details
+ },
+ callback: function (r) {
+ if (r.exc) {
+ shopping_cart.unfreeze();
+ var msg = "";
+ if (r._server_messages) {
+ msg = JSON.parse(r._server_messages || []).join("
");
+ }
+
+ $("#cart-error")
+ .empty()
+ .html(msg || frappe._("Something went wrong!"))
+ .toggle(true);
+ } else {
+ $(btn).hide();
+ window.location.href = '/upi_payment?order=' + encodeURIComponent(r.message) + '&t=' + Date.now();
+ }
+ }
+ });
+ },
+
+ request_quotation: function (btn) {
+ shopping_cart.freeze();
+
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.request_for_quotation",
+ btn: btn,
+ callback: function (r) {
+ if (r.exc) {
+ shopping_cart.unfreeze();
+ var msg = "";
+ if (r._server_messages) {
+ msg = JSON.parse(r._server_messages || []).join("
");
+ }
+
+ $("#cart-error")
+ .empty()
+ .html(msg || frappe._("Something went wrong!"))
+ .toggle(true);
+ } else {
+ $(btn).hide();
+ window.location.href = '/quotations/' + encodeURIComponent(r.message);
+ }
+ }
+ });
+ },
+
+ bind_coupon_code: function () {
+ $(".bt-coupon").on("click", function () {
+ shopping_cart.apply_coupon_code(this);
+ });
+ },
+
+ apply_coupon_code: function (btn) {
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.apply_coupon_code",
+ btn: btn,
+ args: {
+ applied_code: $('.txtcoupon').val(),
+ applied_referral_sales_partner: $('.txtreferral_sales_partner').val()
+ },
+ callback: function (r) {
+ if (r && r.message) {
+ location.reload();
+ }
+ }
+ });
+ },
+
+ bind_remove_coupon_code: function () {
+ $(".bt-remove-coupon-code").on("click", function () {
+ shopping_cart.remove_coupon_code(this);
+ });
+ },
+ remove_coupon_code: function (btn) {
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.remove_coupon_code",
+ btn: btn,
+ callback: function (r) {
+ if (r && r.message) {
+ location.reload();
+ }
+ }
+ });
+ },
+
+ bind_guest_country_change: function () {
+ $(".guest-country").on("change", function () {
+ var country = $(this).val();
+ if (country) {
+ // Populate states
+ frappe.call({
+ method: "frappe.geo.utils.get_states",
+ args: { country: country },
+ callback: function (r) {
+ var $state = $(".guest-state");
+ $state.empty().append('');
+ if (r.message) {
+ r.message.forEach(function (state) {
+ $state.append('');
+ });
+ }
+ }
+ });
+ shopping_cart.update_guest_country(country);
+ }
+ });
+ },
+
+ update_guest_country: function (country) {
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.update_guest_country",
+ args: { country: country },
+ callback: function (r) {
+ if (r.message) {
+ location.reload();
+ }
+ }
+ });
+ },
+
+ bind_guest_state_change: function () {
+ $(".guest-state").on("change", function () {
+ var state = $(this).val();
+ if (state) {
+ shopping_cart.update_guest_state(state);
+ }
+ });
+ },
+
+ update_guest_state: function (state) {
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.update_guest_state",
+ args: { state: state },
+ callback: function (r) {
+ if (r.message) {
+ location.reload();
+ }
+ }
+ });
+ },
+
+ bind_shipping_rule_change: function () {
+ $(".shipping-rule-selector").on("change", function () {
+ var shipping_rule = $(this).val();
+ if (shipping_rule) {
+ shopping_cart.apply_shipping_rule(shipping_rule);
+ }
+ });
+ },
+
+ apply_shipping_rule: function (shipping_rule) {
+ return frappe.call({
+ type: "POST",
+ method: "shop.shop.shopping_cart.cart.apply_shipping_rule",
+ args: { shipping_rule: shipping_rule },
+ callback: function (r) {
+ if (r.message) {
+ location.reload();
+ }
+ }
+ });
+ }
+});
+
+frappe.ready(function () {
+ if (window.location.pathname === "/cart") {
+ $(".cart-icon").hide();
+ }
+ shopping_cart.parent = $(".cart-container");
+ shopping_cart.bind_events();
+});
+
+function show_terms() {
+ var html = $(".cart-terms").html();
+ frappe.msgprint(html);
+}
diff --git a/webshop/templates/pages/cart.py b/shop/templates/pages/cart.py
similarity index 78%
rename from webshop/templates/pages/cart.py
rename to shop/templates/pages/cart.py
index ef8a6475e9..287eb689c7 100644
--- a/webshop/templates/pages/cart.py
+++ b/shop/templates/pages/cart.py
@@ -3,7 +3,7 @@
no_cache = 1
-from webshop.webshop.shopping_cart.cart import get_cart_quotation
+from shop.shop.shopping_cart.cart import get_cart_quotation
def get_context(context):
diff --git a/webshop/templates/pages/customer_reviews.html b/shop/templates/pages/customer_reviews.html
similarity index 95%
rename from webshop/templates/pages/customer_reviews.html
rename to shop/templates/pages/customer_reviews.html
index d95911e5f1..29145890a2 100644
--- a/webshop/templates/pages/customer_reviews.html
+++ b/shop/templates/pages/customer_reviews.html
@@ -1,5 +1,5 @@
{% extends "templates/web.html" %}
-{% from "webshop/templates/includes/macros.html" import user_review, ratings_summary %}
+{% from "shop/templates/includes/macros.html" import user_review, ratings_summary %}
{% block title %} {{ _("Customer Reviews") }} {% endblock %}
diff --git a/webshop/templates/pages/customer_reviews.py b/shop/templates/pages/customer_reviews.py
similarity index 73%
rename from webshop/templates/pages/customer_reviews.py
rename to shop/templates/pages/customer_reviews.py
index 657a0d44f7..576a2b1376 100644
--- a/webshop/templates/pages/customer_reviews.py
+++ b/shop/templates/pages/customer_reviews.py
@@ -2,11 +2,11 @@
# License: GNU General Public License v3. See license.txt
import frappe
-from webshop.webshop.doctype.webshop_settings.webshop_settings import (
+from shop.shop.doctype.shop_settings.shop_settings import (
get_shopping_cart_settings,
)
-from webshop.webshop.doctype.item_review.item_review import get_item_reviews
-from webshop.webshop.doctype.website_item.website_item import check_if_user_is_customer
+from shop.shop.doctype.item_review.item_review import get_item_reviews
+from shop.shop.doctype.website_item.website_item import check_if_user_is_customer
def get_context(context):
diff --git a/webshop/templates/pages/order.html b/shop/templates/pages/order.html
similarity index 97%
rename from webshop/templates/pages/order.html
rename to shop/templates/pages/order.html
index 2e11784b91..37f8afe507 100644
--- a/webshop/templates/pages/order.html
+++ b/shop/templates/pages/order.html
@@ -1,5 +1,5 @@
{% extends "templates/web.html" %}
-{% from "webshop/templates/includes/order/order_macros.html" import item_name_and_description %}
+{% from "shop/templates/includes/order/order_macros.html" import item_name_and_description %}
{% block breadcrumbs %}
{% include "templates/includes/breadcrumbs.html" %}
@@ -125,7 +125,7 @@ {{ doc.name }}
- {% include "webshop/templates/includes/order/order_taxes.html" %}
+ {% include "shop/templates/includes/order/order_taxes.html" %}
| {{ _('Item') }} | +{{ _('Quantity') }} | + {% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %} +{{ _('Subtotal') }} | + {% endif %} ++ |
|---|
{{ _("Terms and Conditions") }}
+{{ _("Save your details?") }}
+{{ _("Sign up with your mobile number to track orders and save your + address.") }}
+ + {{ _("Signup with Mobile Number") }} + +{{ _("Alternatively, Checkout as Guest") }}
+
+ ' + + title + '
' + text + '
%(description)s
') + + '%(formatted_tax_amount)s
\ +"); + } + + $("#cart-error") + .empty() + .html(msg || frappe._("Something went wrong!")) + .toggle(true); + } else { + $(btn).hide(); + window.location.href = '/upi_payment?order=' + encodeURIComponent(r.message) + '&t=' + Date.now(); + } + } + }); + }, + + request_quotation: function (btn) { + shopping_cart.freeze(); + + return frappe.call({ + type: "POST", + method: "shop.shop.shopping_cart.cart.request_for_quotation", + btn: btn, + callback: function (r) { + if (r.exc) { + shopping_cart.unfreeze(); + var msg = ""; + if (r._server_messages) { + msg = JSON.parse(r._server_messages || []).join("
"); + } + + $("#cart-error") + .empty() + .html(msg || frappe._("Something went wrong!")) + .toggle(true); + } else { + $(btn).hide(); + window.location.href = '/quotations/' + encodeURIComponent(r.message); + } + } + }); + }, + + bind_coupon_code: function () { + $(".bt-coupon").on("click", function () { + shopping_cart.apply_coupon_code(this); + }); + }, + + apply_coupon_code: function (btn) { + return frappe.call({ + type: "POST", + method: "shop.shop.shopping_cart.cart.apply_coupon_code", + btn: btn, + args: { + applied_code: $('.txtcoupon').val(), + applied_referral_sales_partner: $('.txtreferral_sales_partner').val() + }, + callback: function (r) { + if (r && r.message) { + location.reload(); + } + } + }); + }, + + bind_remove_coupon_code: function () { + $(".bt-remove-coupon-code").on("click", function () { + shopping_cart.remove_coupon_code(this); + }); + }, + remove_coupon_code: function (btn) { + return frappe.call({ + type: "POST", + method: "shop.shop.shopping_cart.cart.remove_coupon_code", + btn: btn, + callback: function (r) { + if (r && r.message) { + location.reload(); + } + } + }); + }, + + bind_guest_country_change: function () { + $(".guest-country").on("change", function () { + var country = $(this).val(); + if (country) { + // Populate states + frappe.call({ + method: "frappe.geo.utils.get_states", + args: { country: country }, + callback: function (r) { + var $state = $(".guest-state"); + $state.empty().append(''); + if (r.message) { + r.message.forEach(function (state) { + $state.append(''); + }); + } + } + }); + shopping_cart.update_guest_country(country); + } + }); + }, + + update_guest_country: function (country) { + return frappe.call({ + type: "POST", + method: "shop.shop.shopping_cart.cart.update_guest_country", + args: { country: country }, + callback: function (r) { + if (r.message) { + location.reload(); + } + } + }); + }, + + bind_guest_state_change: function () { + $(".guest-state").on("change", function () { + var state = $(this).val(); + if (state) { + shopping_cart.update_guest_state(state); + } + }); + }, + + update_guest_state: function (state) { + return frappe.call({ + type: "POST", + method: "shop.shop.shopping_cart.cart.update_guest_state", + args: { state: state }, + callback: function (r) { + if (r.message) { + location.reload(); + } + } + }); + }, + + bind_shipping_rule_change: function () { + $(".shipping-rule-selector").on("change", function () { + var shipping_rule = $(this).val(); + if (shipping_rule) { + shopping_cart.apply_shipping_rule(shipping_rule); + } + }); + }, + + apply_shipping_rule: function (shipping_rule) { + return frappe.call({ + type: "POST", + method: "shop.shop.shopping_cart.cart.apply_shipping_rule", + args: { shipping_rule: shipping_rule }, + callback: function (r) { + if (r.message) { + location.reload(); + } + } + }); + } +}); + +frappe.ready(function () { + if (window.location.pathname === "/cart") { + $(".cart-icon").hide(); + } + shopping_cart.parent = $(".cart-container"); + shopping_cart.bind_events(); +}); + +function show_terms() { + var html = $(".cart-terms").html(); + frappe.msgprint(html); +} diff --git a/webshop/templates/pages/cart.py b/shop/templates/pages/cart.py similarity index 78% rename from webshop/templates/pages/cart.py rename to shop/templates/pages/cart.py index ef8a6475e9..287eb689c7 100644 --- a/webshop/templates/pages/cart.py +++ b/shop/templates/pages/cart.py @@ -3,7 +3,7 @@ no_cache = 1 -from webshop.webshop.shopping_cart.cart import get_cart_quotation +from shop.shop.shopping_cart.cart import get_cart_quotation def get_context(context): diff --git a/webshop/templates/pages/customer_reviews.html b/shop/templates/pages/customer_reviews.html similarity index 95% rename from webshop/templates/pages/customer_reviews.html rename to shop/templates/pages/customer_reviews.html index d95911e5f1..29145890a2 100644 --- a/webshop/templates/pages/customer_reviews.html +++ b/shop/templates/pages/customer_reviews.html @@ -1,5 +1,5 @@ {% extends "templates/web.html" %} -{% from "webshop/templates/includes/macros.html" import user_review, ratings_summary %} +{% from "shop/templates/includes/macros.html" import user_review, ratings_summary %} {% block title %} {{ _("Customer Reviews") }} {% endblock %} diff --git a/webshop/templates/pages/customer_reviews.py b/shop/templates/pages/customer_reviews.py similarity index 73% rename from webshop/templates/pages/customer_reviews.py rename to shop/templates/pages/customer_reviews.py index 657a0d44f7..576a2b1376 100644 --- a/webshop/templates/pages/customer_reviews.py +++ b/shop/templates/pages/customer_reviews.py @@ -2,11 +2,11 @@ # License: GNU General Public License v3. See license.txt import frappe -from webshop.webshop.doctype.webshop_settings.webshop_settings import ( +from shop.shop.doctype.shop_settings.shop_settings import ( get_shopping_cart_settings, ) -from webshop.webshop.doctype.item_review.item_review import get_item_reviews -from webshop.webshop.doctype.website_item.website_item import check_if_user_is_customer +from shop.shop.doctype.item_review.item_review import get_item_reviews +from shop.shop.doctype.website_item.website_item import check_if_user_is_customer def get_context(context): diff --git a/webshop/templates/pages/order.html b/shop/templates/pages/order.html similarity index 97% rename from webshop/templates/pages/order.html rename to shop/templates/pages/order.html index 2e11784b91..37f8afe507 100644 --- a/webshop/templates/pages/order.html +++ b/shop/templates/pages/order.html @@ -1,5 +1,5 @@ {% extends "templates/web.html" %} -{% from "webshop/templates/includes/order/order_macros.html" import item_name_and_description %} +{% from "shop/templates/includes/order/order_macros.html" import item_name_and_description %} {% block breadcrumbs %} {% include "templates/includes/breadcrumbs.html" %} @@ -125,7 +125,7 @@
{{ doc.name }}
+
{{ _("Create Account") }}
+{{ _("Sign up with your mobile number to continue") }}
++ {{ _("Already have an account?") }} + {{ _("Login here") }} +
+Scan & Pay via UPI
+Loading order details...
+Order: —
+—
+Scan the QR code using any UPI app
++ +
✅ Payment Recorded!
+Ref:
+Redirecting to your order...
+-
- {{ _(offer.offer_title) }}: - {{ _(offer.offer_subtitle) if offer.offer_subtitle else '' }} - - {{ _("More") }} - -
-{{ _("Shipping Address") }}
- {% for address in shipping_addresses %} - {% if doc.shipping_address_name == address.name %} -
{{ _("Billing Address") }}
- {% for address in billing_addresses %} - {% if doc.customer_address == address.name %} -
{{ _("Shopping Cart") }}{% endblock %}
-
-{% block header_actions %}
-{% endblock %}
-
-{% block page_content %}
-
-{% from "templates/includes/macros.html" import item_name_and_description %}
-
-{% if doc.items %}
-
-
-
-
-
-
-
- {{ _('Items') }}
-
-
-
-
- {{ _('Item') }}
- {{ _('Quantity') }}
- {% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
- {{ _('Subtotal') }}
- {% endif %}
-
-
-
-
- {% include "templates/includes/cart/cart_items.html" %}
-
-
- {% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
-
- {% include "templates/includes/cart/cart_items_total.html" %}
-
- {% endif %}
-
-
-
-
- {% if cart_settings.enable_checkout %}
-
- {{ _('Past Orders') }}
-
- {% else %}
-
- {{ _('Past Quotes') }}
-
- {% endif %}
-
-
- {% if doc.items %}
-
- {% endif %}
-
-
-
-
-
- {% if doc.items %}
- {% if doc.terms %}
-
- {{ _("Terms and Conditions") }}
-
- {{ doc.terms }}
-
-
- {% endif %}
-
-
-
-
-
-
- {% set show_coupon_code = cart_settings.show_apply_coupon_code_in_website and cart_settings.enable_checkout %}
- {% set coupon_code = doc.coupon_code if doc.coupon_code else "" %}
-
- {% if show_coupon_code == 1%}
- {% if coupon_code %}
- {% include "templates/includes/cart/coupon_code.html" %}
- {% else %}
-
-
-
-
-
-
-
- {% endif %}
- {% endif %}
-
-
-
- {% include "templates/includes/cart/cart_payment_summary.html" %}
-
-
-
- {% include "templates/includes/cart/place_order.html" %}
-
-
-
- {% include "templates/includes/cart/cart_address.html" %}
-
-
- {% endif %}
-
-
-{% else %}
-
-
-
-
- {{ _('Your cart is Empty') }}
- {% if cart_settings.enable_checkout %}
-
- {{ _('See past orders') }}
-
- {% else %}
-
- {{ _('See past quotations') }}
-
- {% endif %}
-
-{% endif %}
-
-{% endblock %}
-
-{% block base_scripts %}
-
-{{ include_script("frappe-web.bundle.js") }}
-{{ include_script("controls.bundle.js") }}
-{{ include_script("dialog.bundle.js") }}
-{% endblock %}
diff --git a/webshop/templates/pages/cart.js b/webshop/templates/pages/cart.js
deleted file mode 100644
index dd03f3d1c7..0000000000
--- a/webshop/templates/pages/cart.js
+++ /dev/null
@@ -1,249 +0,0 @@
-// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-// JS exclusive to /cart page
-frappe.provide("webshop.webshop.shopping_cart");
-var shopping_cart = webshop.webshop.shopping_cart;
-
-$.extend(shopping_cart, {
- show_error: function(title, text) {
- $("#cart-container").html('' +
- title + '
' + text + '
');
- },
-
- bind_events: function() {
- shopping_cart.bind_place_order();
- shopping_cart.bind_request_quotation();
- shopping_cart.bind_change_qty();
- shopping_cart.bind_remove_cart_item();
- shopping_cart.bind_change_notes();
- shopping_cart.bind_coupon_code();
- shopping_cart.bind_remove_coupon_code();
- },
-
- bind_place_order: function() {
- $(".btn-place-order").on("click", function() {
- shopping_cart.place_order(this);
- });
- },
-
- bind_request_quotation: function() {
- $('.btn-request-for-quotation').on('click', function() {
- shopping_cart.request_quotation(this);
- });
- },
-
- bind_change_qty: function() {
- // bind update button
- $(".cart-items").on("change", ".cart-qty", function() {
- var item_code = $(this).attr("data-item-code");
- var newVal = $(this).val();
- shopping_cart.shopping_cart_update({item_code, qty: newVal});
- });
-
- $(".cart-items").on('click', '.number-spinner button', function () {
- var btn = $(this),
- input = btn.closest('.number-spinner').find('input'),
- oldValue = input.val().trim(),
- newVal = 0;
-
- if (btn.attr('data-dir') == 'up') {
- newVal = parseInt(oldValue) + 1;
- } else {
- if (oldValue > 1) {
- newVal = parseInt(oldValue) - 1;
- }
- }
- input.val(newVal);
-
- let notes = input.closest("td").siblings().find(".notes").text().trim();
- var item_code = input.attr("data-item-code");
- shopping_cart.shopping_cart_update({
- item_code,
- qty: newVal,
- additional_notes: notes
- });
- });
- },
-
- bind_change_notes: function() {
- $('.cart-items').on('change', 'textarea', function() {
- const $textarea = $(this);
- const item_code = $textarea.attr('data-item-code');
- const qty = $textarea.closest('tr').find('.cart-qty').val();
- const notes = $textarea.val();
- shopping_cart.shopping_cart_update({
- item_code,
- qty,
- additional_notes: notes
- });
- });
- },
-
- bind_remove_cart_item: function() {
- $(".cart-items").on("click", ".remove-cart-item", (e) => {
- const $remove_cart_item_btn = $(e.currentTarget);
- var item_code = $remove_cart_item_btn.data("item-code");
-
- shopping_cart.shopping_cart_update({
- item_code: item_code,
- qty: 0
- });
- });
- },
-
- render_tax_row: function($cart_taxes, doc, shipping_rules) {
- var shipping_selector;
- if(shipping_rules) {
- shipping_selector = '';
- }
-
- var $tax_row = $(repl('\
- \
- \
- ' +
- (shipping_selector || '%(description)s
') +
- '\
- \
- \
- \
- %(formatted_tax_amount)s
\
- \
- ', doc)).appendTo($cart_taxes);
-
- if(shipping_selector) {
- $tax_row.find('select option').each(function(i, opt) {
- if($(opt).html() == doc.description) {
- $(opt).attr("selected", "selected");
- }
- });
- $tax_row.find('select').on("change", function() {
- shopping_cart.apply_shipping_rule($(this).val(), this);
- });
- }
- },
-
- apply_shipping_rule: function(rule, btn) {
- return frappe.call({
- btn: btn,
- type: "POST",
- method: "webshop.webshop.shopping_cart.cart.apply_shipping_rule",
- args: { shipping_rule: rule },
- callback: function(r) {
- if(!r.exc) {
- shopping_cart.render(r.message);
- }
- }
- });
- },
-
- place_order: function(btn) {
- shopping_cart.freeze();
-
- return frappe.call({
- type: "POST",
- method: "webshop.webshop.shopping_cart.cart.place_order",
- btn: btn,
- callback: function(r) {
- if(r.exc) {
- shopping_cart.unfreeze();
- var msg = "";
- if(r._server_messages) {
- msg = JSON.parse(r._server_messages || []).join("
");
- }
-
- $("#cart-error")
- .empty()
- .html(msg || frappe._("Something went wrong!"))
- .toggle(true);
- } else {
- $(btn).hide();
- window.location.href = '/orders/' + encodeURIComponent(r.message);
- }
- }
- });
- },
-
- request_quotation: function(btn) {
- shopping_cart.freeze();
-
- return frappe.call({
- type: "POST",
- method: "webshop.webshop.shopping_cart.cart.request_for_quotation",
- btn: btn,
- callback: function(r) {
- if(r.exc) {
- shopping_cart.unfreeze();
- var msg = "";
- if(r._server_messages) {
- msg = JSON.parse(r._server_messages || []).join("
");
- }
-
- $("#cart-error")
- .empty()
- .html(msg || frappe._("Something went wrong!"))
- .toggle(true);
- } else {
- $(btn).hide();
- window.location.href = '/quotations/' + encodeURIComponent(r.message);
- }
- }
- });
- },
-
- bind_coupon_code: function() {
- $(".bt-coupon").on("click", function() {
- shopping_cart.apply_coupon_code(this);
- });
- },
-
- apply_coupon_code: function(btn) {
- return frappe.call({
- type: "POST",
- method: "webshop.webshop.shopping_cart.cart.apply_coupon_code",
- btn: btn,
- args : {
- applied_code : $('.txtcoupon').val(),
- applied_referral_sales_partner: $('.txtreferral_sales_partner').val()
- },
- callback: function(r) {
- if (r && r.message){
- location.reload();
- }
- }
- });
- },
-
- bind_remove_coupon_code: function() {
- $(".bt-remove-coupon-code").on("click", function() {
- shopping_cart.remove_coupon_code(this);
- });
- },
- remove_coupon_code: function(btn) {
- return frappe.call({
- type: "POST",
- method: "webshop.webshop.shopping_cart.cart.remove_coupon_code",
- btn: btn,
- callback: function(r) {
- if (r && r.message){
- location.reload();
- }
- }
- });
- },
-});
-
-frappe.ready(function() {
- if (window.location.pathname === "/cart") {
- $(".cart-icon").hide();
- }
- shopping_cart.parent = $(".cart-container");
- shopping_cart.bind_events();
-});
-
-function show_terms() {
- var html = $(".cart-terms").html();
- frappe.msgprint(html);
-}
diff --git a/webshop/webshop/api.py b/webshop/webshop/api.py
deleted file mode 100644
index 82650d868d..0000000000
--- a/webshop/webshop/api.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-
-import json
-
-import frappe
-from frappe.utils import cint
-
-from webshop.webshop.product_data_engine.filters import ProductFiltersBuilder
-from webshop.webshop.product_data_engine.query import ProductQuery
-from webshop.webshop.doctype.override_doctype.item_group import get_child_groups_for_website
-
-
-@frappe.whitelist(allow_guest=True)
-def get_product_filter_data(query_args=None):
- """
- Returns filtered products and discount filters.
-
- Args:
- query_args (dict): contains filters to get products list
-
- Query Args filters:
- search (str): Search Term.
- field_filters (dict): Keys include item_group, brand, etc.
- attribute_filters(dict): Keys include Color, Size, etc.
- start (int): Offset items by
- item_group (str): Valid Item Group
- from_filters (bool): Set as True to jump to page 1
- """
- if isinstance(query_args, str):
- query_args = json.loads(query_args)
-
- query_args = frappe._dict(query_args or {})
-
- if query_args:
- search = query_args.get("search")
- field_filters = query_args.get("field_filters", {})
- attribute_filters = query_args.get("attribute_filters", {})
- start = cint(query_args.start) if query_args.get("start") else 0
- item_group = query_args.get("item_group")
- from_filters = query_args.get("from_filters")
- else:
- search, attribute_filters, item_group, from_filters = None, None, None, None
- field_filters = {}
- start = 0
-
- # if new filter is checked, reset start to show filtered items from page 1
- if from_filters:
- start = 0
-
- sub_categories = []
- if item_group:
- sub_categories = get_child_groups_for_website(item_group, immediate=True)
-
- engine = ProductQuery()
-
- try:
- result = engine.query(
- attribute_filters,
- field_filters,
- search_term=search,
- start=start,
- item_group=item_group,
- )
- except Exception:
- frappe.log_error("Product query with filter failed")
- return {"exc": "Something went wrong!"}
-
- # discount filter data
- filters = {}
- discounts = result["discounts"]
-
- if discounts:
- filter_engine = ProductFiltersBuilder()
- filters["discount_filters"] = filter_engine.get_discount_filters(discounts)
-
- return {
- "items": result["items"] or [],
- "filters": filters,
- "settings": engine.settings,
- "sub_categories": sub_categories,
- "items_count": result["items_count"],
- }
-
-
-@frappe.whitelist(allow_guest=True)
-def get_guest_redirect_on_action():
- return frappe.db.get_single_value("Webshop Settings", "redirect_on_action")
diff --git a/webshop/webshop/doctype/webshop_settings/webshop_settings.json b/webshop/webshop/doctype/webshop_settings/webshop_settings.json
deleted file mode 100644
index 024ec2efd3..0000000000
--- a/webshop/webshop/doctype/webshop_settings/webshop_settings.json
+++ /dev/null
@@ -1,415 +0,0 @@
-{
- "actions": [],
- "creation": "2021-02-10 17:13:39.139103",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "products_per_page",
- "filter_categories_section",
- "enable_field_filters",
- "filter_fields",
- "enable_attribute_filters",
- "filter_attributes",
- "display_settings_section",
- "hide_variants",
- "enable_variants",
- "show_price",
- "column_break_9",
- "login_required_to_view_products",
- "show_stock_availability",
- "show_quantity_in_website",
- "allow_items_not_in_stock",
- "column_break_13",
- "show_apply_coupon_code_in_website",
- "show_contact_us_button",
- "show_attachments",
- "section_break_18",
- "company",
- "price_list",
- "enabled",
- "store_page_docs",
- "column_break_21",
- "default_customer_group",
- "quotation_series",
- "allow_non_website_items_in_cart_quotation",
- "checkout_settings_section",
- "enable_checkout",
- "show_price_in_quotation",
- "column_break_27",
- "save_quotations_as_draft",
- "payment_gateway_account",
- "payment_success_url",
- "add_ons_section",
- "enable_wishlist",
- "column_break_22",
- "enable_reviews",
- "column_break_23",
- "enable_recommendations",
- "item_search_settings_section",
- "redisearch_warning",
- "search_index_fields",
- "is_redisearch_enabled",
- "is_redisearch_loaded",
- "shop_by_category_section",
- "slideshow",
- "guest_display_settings_section",
- "hide_price_for_guest",
- "redirect_on_action"
- ],
- "fields": [
- {
- "default": "6",
- "fieldname": "products_per_page",
- "fieldtype": "Int",
- "label": "Products per Page"
- },
- {
- "collapsible": 1,
- "fieldname": "filter_categories_section",
- "fieldtype": "Section Break",
- "label": "Filters and Categories"
- },
- {
- "default": "0",
- "fieldname": "hide_variants",
- "fieldtype": "Check",
- "label": "Hide Variants"
- },
- {
- "default": "0",
- "description": "The field filters will also work as categories in the Shop by Category page.",
- "fieldname": "enable_field_filters",
- "fieldtype": "Check",
- "label": "Enable Field Filters (Categories)"
- },
- {
- "default": "0",
- "fieldname": "enable_attribute_filters",
- "fieldtype": "Check",
- "label": "Enable Attribute Filters"
- },
- {
- "depends_on": "enable_field_filters",
- "fieldname": "filter_fields",
- "fieldtype": "Table",
- "label": "Website Item Fields",
- "options": "Website Filter Field"
- },
- {
- "depends_on": "enable_attribute_filters",
- "fieldname": "filter_attributes",
- "fieldtype": "Table",
- "label": "Attributes",
- "options": "Website Attribute"
- },
- {
- "default": "0",
- "fieldname": "enabled",
- "fieldtype": "Check",
- "in_list_view": 1,
- "label": "Enable Shopping Cart"
- },
- {
- "depends_on": "doc.enabled",
- "fieldname": "store_page_docs",
- "fieldtype": "HTML"
- },
- {
- "fieldname": "display_settings_section",
- "fieldtype": "Section Break",
- "label": "Display Settings"
- },
- {
- "default": "0",
- "fieldname": "show_attachments",
- "fieldtype": "Check",
- "label": "Show Public Attachments"
- },
- {
- "default": "0",
- "fieldname": "show_price",
- "fieldtype": "Check",
- "label": "Show Price"
- },
- {
- "default": "0",
- "fieldname": "show_stock_availability",
- "fieldtype": "Check",
- "label": "Show Stock Availability"
- },
- {
- "default": "0",
- "fieldname": "enable_variants",
- "fieldtype": "Check",
- "label": "Enable Variant Selection"
- },
- {
- "fieldname": "column_break_13",
- "fieldtype": "Column Break"
- },
- {
- "default": "0",
- "fieldname": "show_contact_us_button",
- "fieldtype": "Check",
- "label": "Show Contact Us Button"
- },
- {
- "default": "0",
- "depends_on": "show_stock_availability",
- "fieldname": "show_quantity_in_website",
- "fieldtype": "Check",
- "label": "Show Stock Quantity"
- },
- {
- "default": "0",
- "fieldname": "show_apply_coupon_code_in_website",
- "fieldtype": "Check",
- "label": "Show Apply Coupon Code"
- },
- {
- "default": "0",
- "fieldname": "allow_items_not_in_stock",
- "fieldtype": "Check",
- "label": "Allow items not in stock to be added to cart"
- },
- {
- "fieldname": "section_break_18",
- "fieldtype": "Section Break",
- "label": "Shopping Cart"
- },
- {
- "depends_on": "enabled",
- "fieldname": "company",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Company",
- "mandatory_depends_on": "eval: doc.enabled === 1",
- "options": "Company",
- "remember_last_selected_value": 1
- },
- {
- "depends_on": "enabled",
- "description": "Prices will not be shown if Price List is not set",
- "fieldname": "price_list",
- "fieldtype": "Link",
- "label": "Price List",
- "mandatory_depends_on": "eval: doc.enabled === 1",
- "options": "Price List"
- },
- {
- "fieldname": "column_break_21",
- "fieldtype": "Column Break"
- },
- {
- "depends_on": "enabled",
- "fieldname": "default_customer_group",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Customer Group",
- "mandatory_depends_on": "eval: doc.enabled === 1",
- "options": "Customer Group"
- },
- {
- "depends_on": "enabled",
- "fieldname": "quotation_series",
- "fieldtype": "Select",
- "label": "Quotation Series",
- "mandatory_depends_on": "eval: doc.enabled === 1"
- },
- {
- "collapsible": 1,
- "collapsible_depends_on": "eval:doc.enable_checkout",
- "depends_on": "enabled",
- "fieldname": "checkout_settings_section",
- "fieldtype": "Section Break",
- "label": "Checkout Settings"
- },
- {
- "default": "0",
- "fieldname": "enable_checkout",
- "fieldtype": "Check",
- "label": "Enable Checkout"
- },
- {
- "default": "Orders",
- "depends_on": "enable_checkout",
- "description": "After payment completion redirect user to selected page.",
- "fieldname": "payment_success_url",
- "fieldtype": "Select",
- "label": "Payment Success Url",
- "mandatory_depends_on": "enable_checkout",
- "options": "\nOrders\nInvoices\nMy Account"
- },
- {
- "fieldname": "column_break_27",
- "fieldtype": "Column Break"
- },
- {
- "default": "0",
- "depends_on": "eval: doc.enable_checkout == 0",
- "fieldname": "save_quotations_as_draft",
- "fieldtype": "Check",
- "label": "Save Quotations as Draft"
- },
- {
- "depends_on": "enable_checkout",
- "fieldname": "payment_gateway_account",
- "fieldtype": "Link",
- "label": "Payment Gateway Account",
- "mandatory_depends_on": "enable_checkout",
- "options": "Payment Gateway Account"
- },
- {
- "collapsible": 1,
- "depends_on": "enable_field_filters",
- "fieldname": "shop_by_category_section",
- "fieldtype": "Section Break",
- "label": "Shop by Category"
- },
- {
- "fieldname": "slideshow",
- "fieldtype": "Link",
- "label": "Slideshow",
- "options": "Website Slideshow"
- },
- {
- "collapsible": 1,
- "fieldname": "add_ons_section",
- "fieldtype": "Section Break",
- "label": "Add-ons"
- },
- {
- "default": "0",
- "fieldname": "enable_wishlist",
- "fieldtype": "Check",
- "label": "Enable Wishlist"
- },
- {
- "default": "0",
- "fieldname": "enable_reviews",
- "fieldtype": "Check",
- "label": "Enable Reviews and Ratings"
- },
- {
- "fieldname": "search_index_fields",
- "fieldtype": "Small Text",
- "label": "Search Index Fields",
- "mandatory_depends_on": "is_redisearch_enabled",
- "read_only_depends_on": "eval:!doc.is_redisearch_loaded"
- },
- {
- "collapsible": 1,
- "fieldname": "item_search_settings_section",
- "fieldtype": "Section Break",
- "label": "Item Search Settings"
- },
- {
- "default": "0",
- "fieldname": "is_redisearch_loaded",
- "fieldtype": "Check",
- "hidden": 1,
- "label": "Is Redisearch Loaded"
- },
- {
- "depends_on": "eval:!doc.is_redisearch_loaded",
- "fieldname": "redisearch_warning",
- "fieldtype": "HTML",
- "label": "Redisearch Warning",
- "options": "Redisearch is not loaded. If you want to use the advanced product search feature, refer here.
"
- },
- {
- "default": "0",
- "depends_on": "eval:doc.show_price",
- "fieldname": "hide_price_for_guest",
- "fieldtype": "Check",
- "label": "Hide Price for Guest"
- },
- {
- "fieldname": "column_break_9",
- "fieldtype": "Column Break"
- },
- {
- "collapsible": 1,
- "fieldname": "guest_display_settings_section",
- "fieldtype": "Section Break",
- "label": "Guest Display Settings"
- },
- {
- "description": "Link to redirect Guest on actions that need login such as add to cart, wishlist, etc. E.g.: /login",
- "fieldname": "redirect_on_action",
- "fieldtype": "Data",
- "label": "Redirect on Action"
- },
- {
- "fieldname": "column_break_22",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "column_break_23",
- "fieldtype": "Column Break"
- },
- {
- "default": "0",
- "fieldname": "enable_recommendations",
- "fieldtype": "Check",
- "label": "Enable Recommendations"
- },
- {
- "default": "0",
- "depends_on": "eval: doc.enable_checkout == 0",
- "fieldname": "show_price_in_quotation",
- "fieldtype": "Check",
- "label": "Show Price in Quotation"
- },
- {
- "default": "0",
- "fieldname": "is_redisearch_enabled",
- "fieldtype": "Check",
- "label": "Enable Redisearch",
- "read_only_depends_on": "eval:!doc.is_redisearch_loaded"
- },
- {
- "default": "0",
- "fieldname": "login_required_to_view_products",
- "fieldtype": "Check",
- "label": "Login Required to View Products"
- },
- {
- "default": "0",
- "depends_on": "enabled",
- "fieldname": "allow_non_website_items_in_cart_quotation",
- "fieldtype": "Check",
- "in_list_view": 1,
- "label": "Allow Non Website Items in Cart Quotation"
- }
- ],
- "index_web_pages_for_search": 1,
- "issingle": 1,
- "links": [],
- "modified": "2025-03-22 13:01:51.906319",
- "modified_by": "Administrator",
- "module": "Webshop",
- "name": "Webshop Settings",
- "owner": "Administrator",
- "permissions": [
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "print": 1,
- "read": 1,
- "role": "System Manager",
- "share": 1,
- "write": 1
- },
- {
- "read": 1,
- "role": "All"
- }
- ],
- "sort_field": "modified",
- "sort_order": "DESC",
- "states": [],
- "track_changes": 1
-}
\ No newline at end of file
| {{ _('Item') }} | -{{ _('Quantity') }} | - {% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %} -{{ _('Subtotal') }} | - {% endif %} -- |
|---|
{{ _("Terms and Conditions") }}
-
- ' + - title + '
' + text + '
%(description)s
') + - '%(formatted_tax_amount)s
\ -"); - } - - $("#cart-error") - .empty() - .html(msg || frappe._("Something went wrong!")) - .toggle(true); - } else { - $(btn).hide(); - window.location.href = '/orders/' + encodeURIComponent(r.message); - } - } - }); - }, - - request_quotation: function(btn) { - shopping_cart.freeze(); - - return frappe.call({ - type: "POST", - method: "webshop.webshop.shopping_cart.cart.request_for_quotation", - btn: btn, - callback: function(r) { - if(r.exc) { - shopping_cart.unfreeze(); - var msg = ""; - if(r._server_messages) { - msg = JSON.parse(r._server_messages || []).join("
"); - } - - $("#cart-error") - .empty() - .html(msg || frappe._("Something went wrong!")) - .toggle(true); - } else { - $(btn).hide(); - window.location.href = '/quotations/' + encodeURIComponent(r.message); - } - } - }); - }, - - bind_coupon_code: function() { - $(".bt-coupon").on("click", function() { - shopping_cart.apply_coupon_code(this); - }); - }, - - apply_coupon_code: function(btn) { - return frappe.call({ - type: "POST", - method: "webshop.webshop.shopping_cart.cart.apply_coupon_code", - btn: btn, - args : { - applied_code : $('.txtcoupon').val(), - applied_referral_sales_partner: $('.txtreferral_sales_partner').val() - }, - callback: function(r) { - if (r && r.message){ - location.reload(); - } - } - }); - }, - - bind_remove_coupon_code: function() { - $(".bt-remove-coupon-code").on("click", function() { - shopping_cart.remove_coupon_code(this); - }); - }, - remove_coupon_code: function(btn) { - return frappe.call({ - type: "POST", - method: "webshop.webshop.shopping_cart.cart.remove_coupon_code", - btn: btn, - callback: function(r) { - if (r && r.message){ - location.reload(); - } - } - }); - }, -}); - -frappe.ready(function() { - if (window.location.pathname === "/cart") { - $(".cart-icon").hide(); - } - shopping_cart.parent = $(".cart-container"); - shopping_cart.bind_events(); -}); - -function show_terms() { - var html = $(".cart-terms").html(); - frappe.msgprint(html); -} diff --git a/webshop/webshop/api.py b/webshop/webshop/api.py deleted file mode 100644 index 82650d868d..0000000000 --- a/webshop/webshop/api.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors -# For license information, please see license.txt - -import json - -import frappe -from frappe.utils import cint - -from webshop.webshop.product_data_engine.filters import ProductFiltersBuilder -from webshop.webshop.product_data_engine.query import ProductQuery -from webshop.webshop.doctype.override_doctype.item_group import get_child_groups_for_website - - -@frappe.whitelist(allow_guest=True) -def get_product_filter_data(query_args=None): - """ - Returns filtered products and discount filters. - - Args: - query_args (dict): contains filters to get products list - - Query Args filters: - search (str): Search Term. - field_filters (dict): Keys include item_group, brand, etc. - attribute_filters(dict): Keys include Color, Size, etc. - start (int): Offset items by - item_group (str): Valid Item Group - from_filters (bool): Set as True to jump to page 1 - """ - if isinstance(query_args, str): - query_args = json.loads(query_args) - - query_args = frappe._dict(query_args or {}) - - if query_args: - search = query_args.get("search") - field_filters = query_args.get("field_filters", {}) - attribute_filters = query_args.get("attribute_filters", {}) - start = cint(query_args.start) if query_args.get("start") else 0 - item_group = query_args.get("item_group") - from_filters = query_args.get("from_filters") - else: - search, attribute_filters, item_group, from_filters = None, None, None, None - field_filters = {} - start = 0 - - # if new filter is checked, reset start to show filtered items from page 1 - if from_filters: - start = 0 - - sub_categories = [] - if item_group: - sub_categories = get_child_groups_for_website(item_group, immediate=True) - - engine = ProductQuery() - - try: - result = engine.query( - attribute_filters, - field_filters, - search_term=search, - start=start, - item_group=item_group, - ) - except Exception: - frappe.log_error("Product query with filter failed") - return {"exc": "Something went wrong!"} - - # discount filter data - filters = {} - discounts = result["discounts"] - - if discounts: - filter_engine = ProductFiltersBuilder() - filters["discount_filters"] = filter_engine.get_discount_filters(discounts) - - return { - "items": result["items"] or [], - "filters": filters, - "settings": engine.settings, - "sub_categories": sub_categories, - "items_count": result["items_count"], - } - - -@frappe.whitelist(allow_guest=True) -def get_guest_redirect_on_action(): - return frappe.db.get_single_value("Webshop Settings", "redirect_on_action") diff --git a/webshop/webshop/doctype/webshop_settings/webshop_settings.json b/webshop/webshop/doctype/webshop_settings/webshop_settings.json deleted file mode 100644 index 024ec2efd3..0000000000 --- a/webshop/webshop/doctype/webshop_settings/webshop_settings.json +++ /dev/null @@ -1,415 +0,0 @@ -{ - "actions": [], - "creation": "2021-02-10 17:13:39.139103", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "products_per_page", - "filter_categories_section", - "enable_field_filters", - "filter_fields", - "enable_attribute_filters", - "filter_attributes", - "display_settings_section", - "hide_variants", - "enable_variants", - "show_price", - "column_break_9", - "login_required_to_view_products", - "show_stock_availability", - "show_quantity_in_website", - "allow_items_not_in_stock", - "column_break_13", - "show_apply_coupon_code_in_website", - "show_contact_us_button", - "show_attachments", - "section_break_18", - "company", - "price_list", - "enabled", - "store_page_docs", - "column_break_21", - "default_customer_group", - "quotation_series", - "allow_non_website_items_in_cart_quotation", - "checkout_settings_section", - "enable_checkout", - "show_price_in_quotation", - "column_break_27", - "save_quotations_as_draft", - "payment_gateway_account", - "payment_success_url", - "add_ons_section", - "enable_wishlist", - "column_break_22", - "enable_reviews", - "column_break_23", - "enable_recommendations", - "item_search_settings_section", - "redisearch_warning", - "search_index_fields", - "is_redisearch_enabled", - "is_redisearch_loaded", - "shop_by_category_section", - "slideshow", - "guest_display_settings_section", - "hide_price_for_guest", - "redirect_on_action" - ], - "fields": [ - { - "default": "6", - "fieldname": "products_per_page", - "fieldtype": "Int", - "label": "Products per Page" - }, - { - "collapsible": 1, - "fieldname": "filter_categories_section", - "fieldtype": "Section Break", - "label": "Filters and Categories" - }, - { - "default": "0", - "fieldname": "hide_variants", - "fieldtype": "Check", - "label": "Hide Variants" - }, - { - "default": "0", - "description": "The field filters will also work as categories in the Shop by Category page.", - "fieldname": "enable_field_filters", - "fieldtype": "Check", - "label": "Enable Field Filters (Categories)" - }, - { - "default": "0", - "fieldname": "enable_attribute_filters", - "fieldtype": "Check", - "label": "Enable Attribute Filters" - }, - { - "depends_on": "enable_field_filters", - "fieldname": "filter_fields", - "fieldtype": "Table", - "label": "Website Item Fields", - "options": "Website Filter Field" - }, - { - "depends_on": "enable_attribute_filters", - "fieldname": "filter_attributes", - "fieldtype": "Table", - "label": "Attributes", - "options": "Website Attribute" - }, - { - "default": "0", - "fieldname": "enabled", - "fieldtype": "Check", - "in_list_view": 1, - "label": "Enable Shopping Cart" - }, - { - "depends_on": "doc.enabled", - "fieldname": "store_page_docs", - "fieldtype": "HTML" - }, - { - "fieldname": "display_settings_section", - "fieldtype": "Section Break", - "label": "Display Settings" - }, - { - "default": "0", - "fieldname": "show_attachments", - "fieldtype": "Check", - "label": "Show Public Attachments" - }, - { - "default": "0", - "fieldname": "show_price", - "fieldtype": "Check", - "label": "Show Price" - }, - { - "default": "0", - "fieldname": "show_stock_availability", - "fieldtype": "Check", - "label": "Show Stock Availability" - }, - { - "default": "0", - "fieldname": "enable_variants", - "fieldtype": "Check", - "label": "Enable Variant Selection" - }, - { - "fieldname": "column_break_13", - "fieldtype": "Column Break" - }, - { - "default": "0", - "fieldname": "show_contact_us_button", - "fieldtype": "Check", - "label": "Show Contact Us Button" - }, - { - "default": "0", - "depends_on": "show_stock_availability", - "fieldname": "show_quantity_in_website", - "fieldtype": "Check", - "label": "Show Stock Quantity" - }, - { - "default": "0", - "fieldname": "show_apply_coupon_code_in_website", - "fieldtype": "Check", - "label": "Show Apply Coupon Code" - }, - { - "default": "0", - "fieldname": "allow_items_not_in_stock", - "fieldtype": "Check", - "label": "Allow items not in stock to be added to cart" - }, - { - "fieldname": "section_break_18", - "fieldtype": "Section Break", - "label": "Shopping Cart" - }, - { - "depends_on": "enabled", - "fieldname": "company", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Company", - "mandatory_depends_on": "eval: doc.enabled === 1", - "options": "Company", - "remember_last_selected_value": 1 - }, - { - "depends_on": "enabled", - "description": "Prices will not be shown if Price List is not set", - "fieldname": "price_list", - "fieldtype": "Link", - "label": "Price List", - "mandatory_depends_on": "eval: doc.enabled === 1", - "options": "Price List" - }, - { - "fieldname": "column_break_21", - "fieldtype": "Column Break" - }, - { - "depends_on": "enabled", - "fieldname": "default_customer_group", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Customer Group", - "mandatory_depends_on": "eval: doc.enabled === 1", - "options": "Customer Group" - }, - { - "depends_on": "enabled", - "fieldname": "quotation_series", - "fieldtype": "Select", - "label": "Quotation Series", - "mandatory_depends_on": "eval: doc.enabled === 1" - }, - { - "collapsible": 1, - "collapsible_depends_on": "eval:doc.enable_checkout", - "depends_on": "enabled", - "fieldname": "checkout_settings_section", - "fieldtype": "Section Break", - "label": "Checkout Settings" - }, - { - "default": "0", - "fieldname": "enable_checkout", - "fieldtype": "Check", - "label": "Enable Checkout" - }, - { - "default": "Orders", - "depends_on": "enable_checkout", - "description": "After payment completion redirect user to selected page.", - "fieldname": "payment_success_url", - "fieldtype": "Select", - "label": "Payment Success Url", - "mandatory_depends_on": "enable_checkout", - "options": "\nOrders\nInvoices\nMy Account" - }, - { - "fieldname": "column_break_27", - "fieldtype": "Column Break" - }, - { - "default": "0", - "depends_on": "eval: doc.enable_checkout == 0", - "fieldname": "save_quotations_as_draft", - "fieldtype": "Check", - "label": "Save Quotations as Draft" - }, - { - "depends_on": "enable_checkout", - "fieldname": "payment_gateway_account", - "fieldtype": "Link", - "label": "Payment Gateway Account", - "mandatory_depends_on": "enable_checkout", - "options": "Payment Gateway Account" - }, - { - "collapsible": 1, - "depends_on": "enable_field_filters", - "fieldname": "shop_by_category_section", - "fieldtype": "Section Break", - "label": "Shop by Category" - }, - { - "fieldname": "slideshow", - "fieldtype": "Link", - "label": "Slideshow", - "options": "Website Slideshow" - }, - { - "collapsible": 1, - "fieldname": "add_ons_section", - "fieldtype": "Section Break", - "label": "Add-ons" - }, - { - "default": "0", - "fieldname": "enable_wishlist", - "fieldtype": "Check", - "label": "Enable Wishlist" - }, - { - "default": "0", - "fieldname": "enable_reviews", - "fieldtype": "Check", - "label": "Enable Reviews and Ratings" - }, - { - "fieldname": "search_index_fields", - "fieldtype": "Small Text", - "label": "Search Index Fields", - "mandatory_depends_on": "is_redisearch_enabled", - "read_only_depends_on": "eval:!doc.is_redisearch_loaded" - }, - { - "collapsible": 1, - "fieldname": "item_search_settings_section", - "fieldtype": "Section Break", - "label": "Item Search Settings" - }, - { - "default": "0", - "fieldname": "is_redisearch_loaded", - "fieldtype": "Check", - "hidden": 1, - "label": "Is Redisearch Loaded" - }, - { - "depends_on": "eval:!doc.is_redisearch_loaded", - "fieldname": "redisearch_warning", - "fieldtype": "HTML", - "label": "Redisearch Warning", - "options": "
Redisearch is not loaded. If you want to use the advanced product search feature, refer here.
" - }, - { - "default": "0", - "depends_on": "eval:doc.show_price", - "fieldname": "hide_price_for_guest", - "fieldtype": "Check", - "label": "Hide Price for Guest" - }, - { - "fieldname": "column_break_9", - "fieldtype": "Column Break" - }, - { - "collapsible": 1, - "fieldname": "guest_display_settings_section", - "fieldtype": "Section Break", - "label": "Guest Display Settings" - }, - { - "description": "Link to redirect Guest on actions that need login such as add to cart, wishlist, etc. E.g.: /login", - "fieldname": "redirect_on_action", - "fieldtype": "Data", - "label": "Redirect on Action" - }, - { - "fieldname": "column_break_22", - "fieldtype": "Column Break" - }, - { - "fieldname": "column_break_23", - "fieldtype": "Column Break" - }, - { - "default": "0", - "fieldname": "enable_recommendations", - "fieldtype": "Check", - "label": "Enable Recommendations" - }, - { - "default": "0", - "depends_on": "eval: doc.enable_checkout == 0", - "fieldname": "show_price_in_quotation", - "fieldtype": "Check", - "label": "Show Price in Quotation" - }, - { - "default": "0", - "fieldname": "is_redisearch_enabled", - "fieldtype": "Check", - "label": "Enable Redisearch", - "read_only_depends_on": "eval:!doc.is_redisearch_loaded" - }, - { - "default": "0", - "fieldname": "login_required_to_view_products", - "fieldtype": "Check", - "label": "Login Required to View Products" - }, - { - "default": "0", - "depends_on": "enabled", - "fieldname": "allow_non_website_items_in_cart_quotation", - "fieldtype": "Check", - "in_list_view": 1, - "label": "Allow Non Website Items in Cart Quotation" - } - ], - "index_web_pages_for_search": 1, - "issingle": 1, - "links": [], - "modified": "2025-03-22 13:01:51.906319", - "modified_by": "Administrator", - "module": "Webshop", - "name": "Webshop Settings", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "print": 1, - "read": 1, - "role": "System Manager", - "share": 1, - "write": 1 - }, - { - "read": 1, - "role": "All" - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "states": [], - "track_changes": 1 -} \ No newline at end of file