From 3a161a4a88616d7ed099da7d70f5c900a958954c Mon Sep 17 00:00:00 2001 From: Purvesh Date: Wed, 21 Mar 2018 10:55:34 +1300 Subject: [PATCH] fixed some cart & checkout total bug --- themes/avored/default/views/cart/view.blade.php | 3 +++ .../avored/default/views/checkout/index.blade.php | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/themes/avored/default/views/cart/view.blade.php b/themes/avored/default/views/cart/view.blade.php index f1713cbbe..2c592b211 100644 --- a/themes/avored/default/views/cart/view.blade.php +++ b/themes/avored/default/views/cart/view.blade.php @@ -23,6 +23,9 @@ @foreach($cartProducts as $product) + @php + $total += $product->price(); + @endphp @include('cart._single_product', ['product', $product]) @endforeach diff --git a/themes/avored/default/views/checkout/index.blade.php b/themes/avored/default/views/checkout/index.blade.php index 397d67eea..dcdd14ca8 100644 --- a/themes/avored/default/views/checkout/index.blade.php +++ b/themes/avored/default/views/checkout/index.blade.php @@ -756,13 +756,15 @@ class="{{ $errors->has('agree') ? " text-danger" : "" }} agree"> $(function () { function calcualateTotal() { - subTotal = parseFloat(jQuery('.sub-total').attr('data-sub-total')).toFixed(2); - shippingCost = parseFloat(jQuery('.shipping-cost').attr('data-shipping-cost')).toFixed(2); - taxAmount = parseFloat(jQuery('.tax-amount').attr('data-tax-amount')).toFixed(2); - total = parseFloat(subTotal) + parseFloat(taxAmount) + parseFloat(shippingCost); - jQuery('.total').attr('data-total', total.toFixed(2)); - jQuery('.total').html("$" + total.toFixed(2)); + var subTotal = parseFloat(jQuery('.sub-total').attr('data-sub-total')).toFixed(2); + var shippingCost = parseFloat(jQuery('.shipping-cost').attr('data-shipping-cost')).toFixed(2); + var taxAmount = 0.00;//parseFloat(jQuery('.tax-amount').attr('data-tax-amount')).toFixed(2); + + var total = parseFloat(subTotal + taxAmount + shippingCost).toFixed(2); + + jQuery('.total').attr('data-total', total); + jQuery('.total').html("$" + total); }