diff --git a/app/Http/Controllers/teamstore/TeamStoreController.php b/app/Http/Controllers/teamstore/TeamStoreController.php index 9710db2..804a222 100755 --- a/app/Http/Controllers/teamstore/TeamStoreController.php +++ b/app/Http/Controllers/teamstore/TeamStoreController.php @@ -678,7 +678,6 @@ class TeamStoreController extends Controller public function addVoucher(Request $request) { $cartKey = $request->session()->get('cartkey'); - $userId = Auth::user()->id; if ($cartKey == "") { return false; @@ -713,6 +712,14 @@ class TeamStoreController extends Controller // check if if voucher is already in used; foreach ($items as $item) { + + if( $item->VoucherId) { + return response()->json(array( + 'success' => false, + 'message' => 'You can only apply one voucher per order.' + )); + } + if ($getVoucher[0]->Id == $item->VoucherId) { return response()->json(array( 'success' => false, @@ -736,6 +743,14 @@ class TeamStoreController extends Controller if ($getVoucher[0]->VoucherType === "Flat") { + if (Auth::guest()) { + return response()->json(array( + 'success' => false, + 'message' => 'Log-in first to use this voucher.', + )); + } + + $userId = Auth::user()->id; $isUsed = $TeamStoreModel->checkVoucher($userId, $getVoucher[0]->Id); if (count($isUsed) >= 1) { diff --git a/resources/views/merchbay/cart.blade.php b/resources/views/merchbay/cart.blade.php index 161b697..f3d7dec 100755 --- a/resources/views/merchbay/cart.blade.php +++ b/resources/views/merchbay/cart.blade.php @@ -362,7 +362,7 @@ @if ($getSubtotal >= 1 && $getSubtotal <= 150)
- If you order $150 worth of product you get free shipping (pre tax). You are {{ 150 - $getSubtotal }} {{ $store_array[0]->StoreCurrency }} away. + If you order $150 worth of product you get free shipping (pre tax). You are {{ number_format(150 - $getSubtotal, 2) }} {{ $store_array[0]->StoreCurrency }} away.
@endif diff --git a/resources/views/merchbay/footer.blade.php b/resources/views/merchbay/footer.blade.php index 785f5e3..981ed43 100755 --- a/resources/views/merchbay/footer.blade.php +++ b/resources/views/merchbay/footer.blade.php @@ -2,7 +2,7 @@
- +