updated voucher modules

This commit is contained in:
franknstayn
2022-01-17 19:30:14 +08:00
parent 48a272e21d
commit 0b550e1aba
3 changed files with 18 additions and 3 deletions

View File

@@ -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) {

View File

@@ -362,7 +362,7 @@
@if ($getSubtotal >= 1 && $getSubtotal <= 150)
<div class="border rounded-2 p-2 mt-2">
If you order $150 worth of product you get free shipping (pre tax). You are <strong>{{ 150 - $getSubtotal }} {{ $store_array[0]->StoreCurrency }}</strong> away.
If you order $150 worth of product you get free shipping (pre tax). You are <strong>{{ number_format(150 - $getSubtotal, 2) }} {{ $store_array[0]->StoreCurrency }}</strong> away.
</div>
@endif

View File

@@ -2,7 +2,7 @@
<div class="container">
<div class="row h-100">
<div class="col-lg-7 align-self-center">
<div class="copyright">Copyright &copy; 2021, <b>MERCHBAY</b>. All right reserved.</div>
<div class="copyright">Copyright &copy; {{ date('Y') }}, <b>MERCHBAY</b>. All right reserved.</div>
<ul class="footer-menu">
{{-- <li class="footer-menu-item">
<a href="#">About Us</a>