diff --git a/webshop/templates/pages/order.html b/webshop/templates/pages/order.html index 2e11784b91..6af149d54d 100644 --- a/webshop/templates/pages/order.html +++ b/webshop/templates/pages/order.html @@ -36,14 +36,18 @@

{{ doc.name }}

-

- {% if enabled_checkout and (doc.doctype != "Sales Invoice" or doc.outstanding_amount > 0) %} - - {{ _("Pay") }} {{doc.get_formatted("grand_total") }} - - {% endif %} -

+ {% if enabled_checkout and show_pay_button %} +
+ + + + + + +
+ {% endif %}
diff --git a/webshop/templates/pages/order.py b/webshop/templates/pages/order.py index c97f3eaa62..7da78c4cf4 100644 --- a/webshop/templates/pages/order.py +++ b/webshop/templates/pages/order.py @@ -2,7 +2,9 @@ # License: GNU General Public License v3. See license.txt import frappe +from erpnext.templates.pages.order import get_payment_details from frappe import _ +from frappe.sessions import get_csrf_token from webshop.webshop.doctype.webshop_settings.webshop_settings import show_attachments @@ -38,6 +40,10 @@ def get_context(context): if not frappe.has_website_permission(context.doc): frappe.throw(_("Not Permitted"), frappe.PermissionError) + context.show_pay_button, context.pay_amount = get_payment_details(context.doc) + if context.enabled_checkout and context.show_pay_button: + context.csrf_token = get_csrf_token() + if context.doc.get("customer"): # check for the loyalty program of the customer customer_loyalty_program = frappe.db.get_value("Customer", context.doc.customer, "loyalty_program")