added free shipping for order over 150 usd

This commit is contained in:
franknstayn
2022-01-06 19:05:10 +08:00
parent 9917f8b33e
commit e49bff8c5f
3 changed files with 418 additions and 366 deletions

View File

@@ -298,6 +298,11 @@ class PaypalController extends Controller
$items = $m->myCart($cartKey); // item from cart_tmp
$getSubtotal = $m->getSubtotal($cartKey);
// var_dump($getSubtotal);
if($getSubtotal[0]->Subtotal >= 150) {
return $shippingFee = 0;
}
$getSmallItemQty = 0;
$getBulkyItemQty = 0;
$getMaskItemQty = 0;
@@ -363,6 +368,8 @@ class PaypalController extends Controller
$shippingFee = $CAShippingfee;
}
return $shippingFee;
}

View File

@@ -748,7 +748,7 @@ class TeamStoreController extends Controller
if ($getSubtotal[0]->Subtotal <= $getVoucher[0]->VoucherValue) {
return response()->json(array(
'success' => false,
'message' => 'Please add more item to redeem this voucher.',
'message' => 'Please add another item to redeem this voucher.',
));
}
}

View File

@@ -12,6 +12,7 @@
.cart-store-logo {
border: 1px solid #e2e2e2;
}
</style>
<div class="wrapper pb-5">
@@ -25,7 +26,8 @@
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
@if (isset($store_array[0]->StoreUrl))
<li class="breadcrumb-item"><a href="{{ url('store') . '/' . $store_array[0]->StoreUrl }}">{{ $store_array[0]->StoreName }}</a>
<li class="breadcrumb-item"><a
href="{{ url('store') . '/' . $store_array[0]->StoreUrl }}">{{ $store_array[0]->StoreName }}</a>
</li>
@else
<li class="breadcrumb-item"><a href="{{ url('/') }}">Home</a></li>
@@ -49,7 +51,8 @@
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<strong>Almost there.</strong> {!! Session::get('cartkeyError') !!}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
<button type="button" class="btn-close" data-bs-dismiss="alert"
aria-label="Close"></button>
</div>
@endif
</div>
@@ -59,7 +62,8 @@
<div class="row">
<div class="col-md-8 col-md-pull-4">
<div style="border: 1px solid #e2e2e2; padding: 10px;">
<h6><img height="30px" class="cart-store-logo" src="{{ config('site_config.uploads') . 'teamstore/' . $store_array[0]->ImageFolder . '/' . $store_array[0]->StoreLogo }}">
<h6><img height="30px" class="cart-store-logo"
src="{{ config('site_config.uploads') . 'teamstore/' . $store_array[0]->ImageFolder . '/' . $store_array[0]->StoreLogo }}">
{{ $store_array[0]->StoreName }}
</h6>
</div>
@@ -71,14 +75,16 @@
<div class="text-center">
@foreach ($img_thumb as $img)
@if ($img->ProductId == $item->ProductId)
<img class="previewImage" src="{{ config('site_config.images_url') }}/{{ $img->Image }}">
<img class="previewImage"
src="{{ config('site_config.images_url') }}/{{ $img->Image }}">
@endif
@endforeach
</div>
</div>
<div class="col-md-9">
<h4>
<a href="{{ url('store') . '/' . $item->StoreURL . '/' . 'product/' . $item->ProductURL }}">{{ $item->ProductName }}</a>
<a
href="{{ url('store') . '/' . $item->StoreURL . '/' . 'product/' . $item->ProductURL }}">{{ $item->ProductName }}</a>
</h4>
<p>Total Price:
{{ $item->total_price . ' ' . $store_array[0]->StoreCurrency }}
@@ -189,7 +195,9 @@
<td>{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}
</td>
<td>{{ $sub_item->Quantity }}</td>
<td><a class="btn btn-xs btn-link pull-right" href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i class="fa fa-times"></i></a></td>
<td><a class="btn btn-xs btn-link pull-right"
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
class="fa fa-times"></i></a></td>
</tr>
@elseif($item->FormUsed=="tshirt-form")
<tr>
@@ -197,14 +205,18 @@
<td>{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}
</td>
<td>{{ $sub_item->Quantity }}</td>
<td><a class="btn btn-xs btn-link pull-right" href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i class="fa fa-times"></i></a></td>
<td><a class="btn btn-xs btn-link pull-right"
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
class="fa fa-times"></i></a></td>
</tr>
@elseif($item->FormUsed=="quantity-form")
<tr>
<td>{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}
</td>
<td>{{ $sub_item->Quantity }}</td>
<td><a class="btn btn-xs btn-link pull-right" href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i class="fa fa-times"></i></a></td>
<td><a class="btn btn-xs btn-link pull-right"
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
class="fa fa-times"></i></a></td>
</tr>
@elseif($item->FormUsed=="name-number-form")
<tr>
@@ -213,7 +225,9 @@
<td>{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}
</td>
<td>{{ $sub_item->Quantity }}</td>
<td><a class="btn btn-xs btn-link pull-right" href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i class="fa fa-times"></i></a></td>
<td><a class="btn btn-xs btn-link pull-right"
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
class="fa fa-times"></i></a></td>
</tr>
@elseif($item->FormUsed=="name-number-size-form")
<tr>
@@ -223,7 +237,9 @@
<td>{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}
</td>
<td>{{ $sub_item->Quantity }}</td>
<td><a class="btn btn-xs btn-link pull-right" href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i class="fa fa-times"></i></a></td>
<td><a class="btn btn-xs btn-link pull-right"
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
class="fa fa-times"></i></a></td>
</tr>
@elseif($item->FormUsed=="number-form")
<tr>
@@ -231,7 +247,9 @@
<td>{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}
</td>
<td>{{ $sub_item->Quantity }}</td>
<td><a class="btn btn-xs btn-link pull-right" href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i class="fa fa-times"></i></a></td>
<td><a class="btn btn-xs btn-link pull-right"
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
class="fa fa-times"></i></a></td>
</tr>
@elseif($item->FormUsed=="name-name2-size-form")
<tr>
@@ -241,7 +259,9 @@
<td>{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}
</td>
<td>{{ $sub_item->Quantity }}</td>
<td><a class="btn btn-xs btn-link pull-right" href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i class="fa fa-times"></i></a></td>
<td><a class="btn btn-xs btn-link pull-right"
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
class="fa fa-times"></i></a></td>
</tr>
@elseif($item->FormUsed=="name-size-form")
<tr>
@@ -250,7 +270,9 @@
<td>{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}
</td>
<td>{{ $sub_item->Quantity }}</td>
<td><a class="btn btn-xs btn-link pull-right" href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i class="fa fa-times"></i></a></td>
<td><a class="btn btn-xs btn-link pull-right"
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
class="fa fa-times"></i></a></td>
</tr>
@elseif($item->FormUsed=="jersey-and-shorts-quantity-form")
<tr>
@@ -259,7 +281,9 @@
<td>{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}
</td>
<td>{{ $sub_item->Quantity }}</td>
<td><a class="btn btn-xs btn-link pull-right" href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i class="fa fa-times"></i></a></td>
<td><a class="btn btn-xs btn-link pull-right"
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
class="fa fa-times"></i></a></td>
</tr>
@elseif($item->FormUsed=="number-jersey-shorts-form")
<tr>
@@ -269,7 +293,9 @@
<td>{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}
</td>
<td>{{ $sub_item->Quantity }}</td>
<td><a class="btn btn-xs btn-link pull-right" href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i class="fa fa-times"></i></a></td>
<td><a class="btn btn-xs btn-link pull-right"
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
class="fa fa-times"></i></a></td>
</tr>
@else
@@ -290,7 +316,8 @@
<div style="border: 1px solid #e2e2e2; padding: 10px; border-bottom: none;">
@if (Session::has('msg'))
<div class="alert alert-warning alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<button type="button" class="close" data-dismiss="alert"
aria-hidden="true">×</button>
<h4><i class="fa fa-exclamation-triangle"></i> Warning:</h4>
{!! Session::get('msg') !!}
</div>
@@ -310,7 +337,8 @@
<div>{{ $address_book[0]->ContactNumber }}</div>
<div>
{{ $address_book[0]->Address . ' ' . $address_book[0]->Address2 . ', ' . $address_book[0]->State . ', ' . $address_book[0]->City . ', ' . $address_book[0]->Country . ', ' . $address_book[0]->CountryCode . ' ' . $address_book[0]->ZipCode }}
<a href="{{ url('user/address-book/edit/'.$address_book[0]->Id) }}">[ Edit ]</a>
<a href="{{ url('user/address-book/edit/' . $address_book[0]->Id) }}">[ Edit
]</a>
</div>
@endif
@@ -327,10 +355,17 @@
<small>{{ number_format($tax['tax'], 2) . ' ' . $store_array[0]->StoreCurrency }}</small>
</h5>
<hr>
<h3>Total: <span id="my_subtotal">{{ number_format($getSubtotal + $shipping_fee + $tax['tax'], 2) }}</span>
<h3>Total: <span
id="my_subtotal">{{ number_format($getSubtotal + $shipping_fee + $tax['tax'], 2) }}</span>
<small>{{ $store_array[0]->StoreCurrency }}</small>
</h3>
@if ($getSubtotal >= 100)
<div class="border rounded-2 p-2 mt-2">
If you order $150 worth of product you get free shipping (pre tax)
</div>
@endif
{{-- {{ var_dump($tax) }}
{{ var_dump($shipping_fee) }} --}}
<hr>
@@ -339,14 +374,17 @@
@if ($item->VoucherId != null)
<div class="btn-group mb-2">
@if ($item->VoucherType == 'Percentage')
<button type="button" class="btn btn-black btn-sm dropdown-toggle" data-bs-toggle="dropdown">{{ $item->VoucherCode . ' ' . $item->VoucherValue . '%' }}
<button type="button" class="btn btn-black btn-sm dropdown-toggle"
data-bs-toggle="dropdown">{{ $item->VoucherCode . ' ' . $item->VoucherValue . '%' }}
OFF</button>
@else
<button type="button" class="btn btn-black btn-sm dropdown-toggle" data-bs-toggle="dropdown">{{ $item->VoucherCode . ' ' . $item->VoucherValue . ' ' . $store_array[0]->StoreCurrency }}
<button type="button" class="btn btn-black btn-sm dropdown-toggle"
data-bs-toggle="dropdown">{{ $item->VoucherCode . ' ' . $item->VoucherValue . ' ' . $store_array[0]->StoreCurrency }}
OFF</button>
@endif
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="{{ url('removeitem') . '/' . $item->Id }}">Remove</a>
<li><a class="dropdown-item"
href="{{ url('removeitem') . '/' . $item->Id }}">Remove</a>
</li>
</ul>
</div>
@@ -356,9 +394,11 @@
</div>
<form id="frm_voucher">
<div class="input-group">
<input type="text" class="form-control" name="voucher" data-error="#error_voucher" placeholder="Enter Voucher Code">
<input type="text" class="form-control" name="voucher" data-error="#error_voucher"
placeholder="Enter Voucher Code">
<span class="input-group-btn">
<button class="btn btn-default" id="btn_apply_voucher" type="submit">Apply</button>
<button class="btn btn-default" id="btn_apply_voucher"
type="submit">Apply</button>
</span>
</div>
<span id="error_voucher" style="color: #dd4b39"></span>
@@ -367,21 +407,26 @@
</div>
<div style="border: 1px solid #e2e2e2; padding: 10px;">
<a @if ($getSubtotal <=0) disabled @endif href="{{ url('getCheckout') }}" class="btn w-100" style="background-color: #ffc300; border-color: #e2ad00; text-align: -webkit-center;">Checkout</a><br>
<a @if ($getSubtotal <= 0) disabled @endif href="{{ url('getCheckout') }}" class="btn w-100"
style="background-color: #ffc300; border-color: #e2ad00; text-align: -webkit-center;">Checkout</a><br>
<!-- <div class="my-2">
<button class="btn btn-lg btn-info w-100">Checkout with Voucher</button>
</div> -->
<div class="border rounded-2 p-2 mt-2">
Payments made on Merchbay will show up as Crewsportswear on your order confirmations and receipt.
Payments made on Merchbay will show up as Crewsportswear on your order confirmations and
receipt.
</div>
<div class="border rounded-2 p-2 mt-2">
Store payments are processed through PayPal. A PayPal account is not required to make a purchase. If you do not have a PayPal account click on “Pay with Debit or Credit Card” on the PayPal check out page
Store payments are processed through PayPal. A PayPal account is not required to make a
purchase. If you do not have a PayPal account click on “Pay with Debit or Credit Card”
on the PayPal check out page
</div>
</div>
<div class="py-4">
<a href="{{ url('store') . '/' . $store_array[0]->StoreUrl }}" class="btn btn-black w-100" type="submit">Continue Shopping</a>
<a href="{{ url('store') . '/' . $store_array[0]->StoreUrl }}"
class="btn btn-black w-100" type="submit">Continue Shopping</a>
</div>
</div>