Fixed display of shipping amount in cart & populate through to order

master
Mark Moffat 2020-01-03 22:39:51 +10:30
parent eaed663311
commit 445c4f62ff
10 changed files with 10 additions and 7 deletions

View File

@ -378,10 +378,6 @@ const updateConfig = (fields) => {
settingsFile.emailPort = parseInt(fields.emailPort);
}
if(fields.flatShipping){
settingsFile.flatShipping = parseInt(fields.flatShipping);
}
if(fields.productsPerRow){
settingsFile.productsPerRow = parseInt(fields.productsPerRow);
}

View File

@ -123,6 +123,7 @@ router.post('/admin/order/create', async (req, res, next) => {
orderPaymentGateway: 'Instore',
orderPaymentMessage: 'Your payment was successfully completed',
orderTotal: req.session.totalCartAmount,
orderShipping: req.session.totalCartShipping,
orderItemCount: req.session.totalCartItems,
orderProductCount: req.session.totalCartProducts,
orderEmail: req.body.email || req.session.customerEmail,

View File

@ -77,6 +77,7 @@ router.post('/checkout_action', async (req, res, next) => {
orderPaymentGateway: 'Adyen',
orderPaymentMessage: response.refusalReason,
orderTotal: req.session.totalCartAmount,
orderShipping: req.session.totalCartShipping,
orderItemCount: req.session.totalCartItems,
orderProductCount: req.session.totalCartProducts,
orderEmail: req.session.customerEmail,

View File

@ -60,6 +60,7 @@ router.post('/checkout_action', (req, res, next) => {
orderPaymentGateway: 'AuthorizeNet',
orderPaymentMessage: 'Your payment was successfully completed',
orderTotal: req.session.totalCartAmount,
orderShipping: req.session.totalCartShipping,
orderItemCount: req.session.totalCartItems,
orderProductCount: req.session.totalCartProducts,
orderEmail: req.session.customerEmail,

View File

@ -14,6 +14,7 @@ router.post('/checkout_action', async (req, res, next) => {
orderPaymentGateway: 'Instore',
orderPaymentMessage: 'Your payment was successfully completed',
orderTotal: req.session.totalCartAmount,
orderShipping: 0,
orderItemCount: req.session.totalCartItems,
orderProductCount: req.session.totalCartProducts,
orderEmail: req.session.customerEmail,

View File

@ -162,6 +162,7 @@ router.post('/checkout_action', (req, res, next) => {
orderPaymentId: payment.id,
orderPaymentGateway: 'Paypal',
orderTotal: req.session.totalCartAmount,
orderShipping: req.session.totalCartShipping,
orderItemCount: req.session.totalCartItems,
orderProductCount: req.session.totalCartProducts,
orderEmail: req.session.customerEmail,

View File

@ -53,6 +53,7 @@ router.post('/checkout_action', (req, res, next) => {
orderPaymentGateway: 'Stripe',
orderPaymentMessage: charge.outcome.seller_message,
orderTotal: req.session.totalCartAmount,
orderShipping: req.session.totalCartShipping,
orderItemCount: req.session.totalCartItems,
orderProductCount: req.session.totalCartProducts,
orderEmail: req.session.customerEmail,
@ -229,6 +230,7 @@ router.post('/checkout_action_subscription', async (req, res, next) => {
orderPaymentGateway: 'Stripe',
orderPaymentMessage: subscription.collection_method,
orderTotal: req.session.totalCartAmount,
orderShipping: req.session.totalCartShipping,
orderItemCount: req.session.totalCartItems,
orderProductCount: req.session.totalCartProducts,
orderEmail: req.session.customerEmail,

View File

@ -56,7 +56,7 @@
{{#ifCond @root.session.shippingCostApplied '===' true}}
<div class="text-right">
{{ @root.__ "Shipping" }}
<strong>{{currencySymbol @root.config.currencySymbol}}{{formatAmount @root.config.flatShipping}}</strong>
<strong>{{currencySymbol @root.config.currencySymbol}}{{formatAmount @root.session.totalCartShipping}}</strong>
</div>
{{else}}
<div class="text-right">

View File

@ -30,7 +30,7 @@
Standard shipping
</div>
<div class="col-md-6">
<span><strong>{{currencySymbol @root.config.currencySymbol}}{{formatAmount @root.config.flatShipping}}</strong></span>
<span><strong>{{currencySymbol @root.config.currencySymbol}}{{formatAmount @root.session.totalCartShipping}}</strong></span>
<span class="float-right"><a href="/checkout/shipping">Change</a></span>
</div>
</div>

View File

@ -15,7 +15,7 @@
{{#unless @root.session.shippingOptions}}
<ul class="list-group">
{{#if @root.session.shippingCostApplied}}
<li class="list-group-item">Standard shipping <span class="float-right"><strong>{{currencySymbol @root.config.currencySymbol}}{{formatAmount @root.config.flatShipping}}</strong></span></li>
<li class="list-group-item">Standard shipping <span class="float-right"><strong>{{currencySymbol @root.config.currencySymbol}}{{formatAmount @root.session.totalCartShipping}}</strong></span></li>
{{else}}
<li class="list-group-item">FREE shipping <span class="float-right"></li>
{{/if}}