diff --git a/app.js b/app.js index 71f2cb3..f8813d4 100644 --- a/app.js +++ b/app.js @@ -290,6 +290,18 @@ handlebars = handlebars.create({ return value.replace(/^\w/, (chr) => { return chr.toUpperCase(); }); + }, + math: (lvalue, operator, rvalue, options) => { + lvalue = parseFloat(lvalue); + rvalue = parseFloat(rvalue); + + return{ + '+': lvalue + rvalue, + '-': lvalue - rvalue, + '*': lvalue * rvalue, + '/': lvalue / rvalue, + '%': lvalue % rvalue + }[operator]; } } }); diff --git a/locales/en.json b/locales/en.json index 337c6d4..8fa7a56 100644 --- a/locales/en.json +++ b/locales/en.json @@ -170,5 +170,7 @@ "Return to information": "Return to information", "Search shop": "Search shop", "Dashboard": "Dashboard", - "Create order": "Create order" + "Create order": "Create order", + "Order shipping amount": "Order shipping amount", + "Order net amount": "Order net amount" } \ No newline at end of file diff --git a/views/order.hbs b/views/order.hbs index 0f8c0de..75fe87a 100644 --- a/views/order.hbs +++ b/views/order.hbs @@ -31,6 +31,8 @@ {{#if result.orderPaymentMessage}}
  • {{ @root.__ "Payment Message" }}: {{result.orderPaymentMessage}}
  • {{/if}} +
  • {{ @root.__ "Order net amount" }}: {{currencySymbol config.currencySymbol}}{{formatAmount (math result.orderTotal '-' result.orderShipping)}}
  • +
  • {{ @root.__ "Order shipping amount" }}: {{currencySymbol config.currencySymbol}}{{formatAmount result.orderShipping}}
  • {{ @root.__ "Order total amount" }}: {{currencySymbol config.currencySymbol}}{{formatAmount result.orderTotal}}
  • {{ @root.__ "Email address" }}: {{result.orderEmail}}
  • {{ @root.__ "First name" }}: {{result.orderFirstname}}