upated shipping fee and using voucher code
This commit is contained in:
@@ -315,6 +315,7 @@ class PaypalController extends Controller
|
||||
$voucher = $m->selectVoucherWhereIn($voucherIds);
|
||||
$item_id = $item->Id;
|
||||
$totalValue = $voucher[0]->VoucherValue;
|
||||
|
||||
if ($voucher[0]->VoucherType == "Percentage") {
|
||||
$getPercentageValue = $totalValue / 100;
|
||||
$getDiscountValue = ($getSubtotal[0]->Subtotal * $getPercentageValue);
|
||||
@@ -323,7 +324,7 @@ class PaypalController extends Controller
|
||||
);
|
||||
|
||||
$m->updateVoucherValueInCart($data, $item_id);
|
||||
} else if ($voucher[0]->VoucherType == "Percentage") {
|
||||
} else if ($voucher[0]->VoucherType == "Flat") {
|
||||
$data = array(
|
||||
'Price' => round($totalValue * -1, 2)
|
||||
);
|
||||
@@ -336,6 +337,9 @@ class PaypalController extends Controller
|
||||
} else if ($voucher[0]->VoucherType == "Shipping") {
|
||||
return $shippingFee = 0;
|
||||
}
|
||||
} else {
|
||||
$getSmallItemQty += $item->Quantity;
|
||||
$CAShippingfee += $item->Quantity; // for canada
|
||||
}
|
||||
// var_dump($item->ShippingCostId);
|
||||
// if ($item->ShippingCostId == 1) {
|
||||
@@ -347,8 +351,7 @@ class PaypalController extends Controller
|
||||
// } else if ($item->ShippingCostId == 4) {
|
||||
// $getDGSItemQty += $item->Quantity;
|
||||
// }
|
||||
$getSmallItemQty += $item->Quantity;
|
||||
$CAShippingfee += $item->Quantity; // for canada
|
||||
|
||||
}
|
||||
|
||||
$array_address_book = $UserModel->selectAddresBook('UserId', $userId);
|
||||
|
||||
@@ -650,6 +650,7 @@ class TeamStoreController extends Controller
|
||||
|
||||
$cartKey = $request->session()->get('cartkey');
|
||||
$items = $m->myCart($cartKey);
|
||||
// var_dump($items);
|
||||
$getSubtotal = $m->getSubtotal($cartKey);
|
||||
$items_group = $m->myCartGroup($cartKey);
|
||||
//var_dump($items_group);
|
||||
@@ -674,6 +675,8 @@ class TeamStoreController extends Controller
|
||||
$vouchers = $m->selectVoucherWhereIn($voucherIds);
|
||||
}
|
||||
|
||||
// var_dump($vouchers);
|
||||
|
||||
$totalValue = 0;
|
||||
if (!empty($vouchers)) {
|
||||
foreach ($vouchers as $voucher) {
|
||||
@@ -693,6 +696,11 @@ class TeamStoreController extends Controller
|
||||
|
||||
if ($voucherData['type'] == "Percentage") {
|
||||
$getPercentageValue = $voucherData['totalValue'] / 100;
|
||||
|
||||
// var_dump($getPercentageValue);
|
||||
// var_dump($getSubtotal[0]->Subtotal);
|
||||
// var_dump($getSubtotal[0]->Subtotal * $getPercentageValue);
|
||||
|
||||
$getDiscountValue = ($getSubtotal[0]->Subtotal * $getPercentageValue);
|
||||
$finalSubTotal = $getSubtotal[0]->Subtotal - $getDiscountValue;
|
||||
} else {
|
||||
@@ -712,6 +720,7 @@ class TeamStoreController extends Controller
|
||||
$tax = [];
|
||||
}
|
||||
|
||||
// var_dump($finalSubTotal);
|
||||
|
||||
return view('merchbay.cart')
|
||||
->with('item_group', $items_group)
|
||||
@@ -910,15 +919,17 @@ class TeamStoreController extends Controller
|
||||
}
|
||||
|
||||
if ($getVoucher[0]->VoucherType == "Percentage") {
|
||||
$offData = $getVoucher[0]->VoucherValue . '%';
|
||||
} else {
|
||||
$offData = $getVoucher[0]->VoucherValue . ' ' . $store_array[0]->StoreCurrency;
|
||||
$offData = $getVoucher[0]->VoucherValue . '%' . ' OFF';
|
||||
} else if ($voucherData['type'] == "Flat") {
|
||||
$offData = $getVoucher[0]->VoucherValue . ' ' . $store_array[0]->StoreCurrency . ' OFF';
|
||||
} else if ($voucherData['type'] == "Shipping") {
|
||||
$offData = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$message = '<div class="btn-group mb-2">
|
||||
<button type="button" class="btn btn-black btn-sm dropdown-toggle" data-bs-toggle="dropdown">' . $getVoucher[0]->VoucherCode . ' ' . $offData . ' OFF</button>
|
||||
<button type="button" class="btn btn-black btn-sm dropdown-toggle" data-bs-toggle="dropdown">' . $getVoucher[0]->VoucherCode . ' ' . $offData . '</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="' . $removeItemURL . '">Remove</a></li>
|
||||
</ul>
|
||||
@@ -929,7 +940,9 @@ class TeamStoreController extends Controller
|
||||
'success' => true,
|
||||
'message' => $message,
|
||||
'shippingFee' => number_format($shippingFee, 2),
|
||||
'subtotal' => number_format($finalSubTotal + $shippingFee + $tax["tax"], 2)
|
||||
'total' => number_format($finalSubTotal + $shippingFee + $tax["tax"], 2),
|
||||
'subtotal' => number_format($finalSubTotal, 2),
|
||||
'remaining_shippingfee' => number_format(99 - $finalSubTotal, 2)
|
||||
));
|
||||
} else {
|
||||
|
||||
|
||||
@@ -184,6 +184,7 @@ class TeamStoreModel extends Model
|
||||
|
||||
$i = DB::table('cart_tmp')->select(DB::raw('SUM(Quantity * Price) AS Subtotal'))
|
||||
->where('CartKey', '=', $cartKey)
|
||||
->where('VoucherId', '=', null)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<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 }}">
|
||||
src="{{ config('site_config.uploads') .'teamstore/' .$store_array[0]->ImageFolder .'/' .$store_array[0]->StoreLogo }}">
|
||||
{{ $store_array[0]->StoreName }}
|
||||
</h6>
|
||||
</div>
|
||||
@@ -110,15 +110,12 @@
|
||||
<th>Quantity</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@elseif($item->FormUsed == 'quantity-form')
|
||||
<tr>
|
||||
<th>Price</th>
|
||||
<th>Quantity</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
|
||||
@elseif($item->FormUsed == 'name-number-form')
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
@@ -127,8 +124,7 @@
|
||||
<th>Quantity</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@elseif($item->FormUsed == 'name-number-size-form' || $item->FormUsed == "roster-name-number-size-form")
|
||||
@elseif($item->FormUsed == 'name-number-size-form' || $item->FormUsed == 'roster-name-number-size-form')
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Number</th>
|
||||
@@ -137,7 +133,6 @@
|
||||
<th>Quantity</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@elseif($item->FormUsed == 'number-form')
|
||||
<tr>
|
||||
<th>Number</th>
|
||||
@@ -180,15 +175,19 @@
|
||||
<th></th>
|
||||
</tr>
|
||||
@else
|
||||
|
||||
@endif
|
||||
|
||||
@foreach ($row as $sub_item)
|
||||
@if ($sub_item->ProductId == $item->ProductId)
|
||||
|
||||
@if ($item->FormUsed == 'jersey-and-shorts-form')
|
||||
<tr>
|
||||
<td> @if ($sub_item->Name != '') {{ $sub_item->Name }} @else -- @endif </td>
|
||||
<td>
|
||||
@if ($sub_item->Name != '')
|
||||
{{ $sub_item->Name }}
|
||||
@else
|
||||
--
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $sub_item->Number }}</td>
|
||||
<td>{{ $sub_item->JerseySize }}</td>
|
||||
<td>{{ $sub_item->ShortsSize }}</td>
|
||||
@@ -229,7 +228,7 @@
|
||||
href="{{ url('removeitem') }}/{{ $sub_item->Id }}"><i
|
||||
class="fa fa-times"></i></a></td>
|
||||
</tr>
|
||||
@elseif($item->FormUsed == 'name-number-size-form' || $item->FormUsed == "roster-name-number-size-form")
|
||||
@elseif($item->FormUsed == 'name-number-size-form' || $item->FormUsed == 'roster-name-number-size-form')
|
||||
<tr>
|
||||
<td>{{ $sub_item->Name }}</td>
|
||||
<td>{{ $sub_item->Number }}</td>
|
||||
@@ -298,9 +297,7 @@
|
||||
class="fa fa-times"></i></a></td>
|
||||
</tr>
|
||||
@else
|
||||
|
||||
@endif
|
||||
|
||||
@endif
|
||||
@endforeach
|
||||
</table>
|
||||
@@ -325,7 +322,6 @@
|
||||
<h3>Order Summary</h3>
|
||||
</div>
|
||||
@if (!Auth::guest())
|
||||
|
||||
<div style="border: 1px solid #e2e2e2; padding: 10px; border-bottom: none;">
|
||||
|
||||
<p><strong>Ship to:</strong></p>
|
||||
@@ -336,7 +332,7 @@
|
||||
<div>{{ $address_book[0]->Fullname }}</div>
|
||||
<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 }}
|
||||
{{ $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>
|
||||
</div>
|
||||
@@ -346,17 +342,19 @@
|
||||
@endif
|
||||
<div style="border: 1px solid #e2e2e2; padding: 10px; border-bottom: none;">
|
||||
<h5>Subtotal:
|
||||
<small>{{ number_format($tax['order_grandtotal'], 2) . ' ' . $store_array[0]->StoreCurrency }}</small>
|
||||
<small><span id="my_subtotal">{{ number_format($getSubtotal, 2) }}</span>
|
||||
{{ $store_array[0]->StoreCurrency }}</small>
|
||||
</h5>
|
||||
<h5>Shipping Fee:
|
||||
<small> <span id="shippingFee">{{ number_format($shipping_fee, 2) }}</span> {{ $store_array[0]->StoreCurrency }}</small>
|
||||
<small> <span id="shippingFee">{{ number_format($shipping_fee, 2) }}</span>
|
||||
{{ $store_array[0]->StoreCurrency }}</small>
|
||||
</h5>
|
||||
<h5>Tax:
|
||||
<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>
|
||||
id="my_total">{{ number_format($getSubtotal + $shipping_fee + $tax['tax'], 2) }}</span>
|
||||
<small>{{ $store_array[0]->StoreCurrency }}</small>
|
||||
</h3>
|
||||
|
||||
@@ -364,7 +362,9 @@
|
||||
@if ($getSubtotal >= 1 && $getSubtotal <= 98)
|
||||
<div class="border rounded-2 p-2 mt-2">
|
||||
If you order $99 worth of product you get free shipping (pre tax). You are
|
||||
<strong>{{ number_format(99 - $getSubtotal, 2) }}
|
||||
<strong>
|
||||
<span
|
||||
id="remaining_shippingfee">{{ number_format(99 - $getSubtotal, 2) }}</span>
|
||||
{{ $store_array[0]->StoreCurrency }}</strong> away.
|
||||
</div>
|
||||
@endif
|
||||
@@ -387,10 +387,14 @@
|
||||
<button type="button" class="btn btn-black btn-sm dropdown-toggle"
|
||||
data-bs-toggle="dropdown">{{ $item->VoucherCode . ' ' . $item->VoucherValue . '%' }}
|
||||
OFF</button>
|
||||
@else
|
||||
@elseif ($item->VoucherType == 'Flat')
|
||||
<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>
|
||||
@else
|
||||
{{-- Shipping Voucher --}}
|
||||
<button type="button" class="btn btn-black btn-sm dropdown-toggle"
|
||||
data-bs-toggle="dropdown">{{ $item->VoucherCode }}</button>
|
||||
@endif
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item"
|
||||
@@ -417,7 +421,8 @@
|
||||
</div>
|
||||
|
||||
<div style="border: 1px solid #e2e2e2; padding: 10px;">
|
||||
<a @if ($getSubtotal <= 0) disabled @endif href="{{ url('getCheckout') }}" class="btn w-100"
|
||||
<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>
|
||||
|
||||
@@ -478,8 +478,11 @@
|
||||
$("#voucher_list").append(response.message);
|
||||
form.validate().resetForm();
|
||||
form[0].reset();
|
||||
$('#my_total').text(response.total);
|
||||
$('#my_subtotal').text(response.subtotal);
|
||||
$('#shippingFee').text(response.shippingFee);
|
||||
$('#remaining_shippingfee').text(response.remaining_shippingfee);
|
||||
|
||||
|
||||
} else {
|
||||
$("#error_voucher").html(response.message).fadeIn().delay(5000).fadeOut('slow',
|
||||
|
||||
@@ -270,7 +270,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<div class="store-banner border-top">
|
||||
<img src="{{ config('site_config.uploads') . 'teamstore/' . $store_array[0]->ImageFolder . '/' . $store_array[0]->StoreBanner }}"
|
||||
<img src="{{ config('site_config.uploads') .'teamstore/' .$store_array[0]->ImageFolder .'/' .$store_array[0]->StoreBanner }}"
|
||||
id="storeBanner" class="shadow-sm img-fluid w-100" alt="..." />
|
||||
</div>
|
||||
</div>
|
||||
@@ -361,7 +361,9 @@
|
||||
</div>
|
||||
<form id="frm-order-list">
|
||||
<input type="hidden" value="{{ md5($product_array[0]->Id) }}" name="p_id" id="p_id" />
|
||||
@include('teamstore-sublayouts.forms.'.$product_array[0]->ProductForm)
|
||||
@include(
|
||||
'teamstore-sublayouts.forms.' . $product_array[0]->ProductForm
|
||||
)
|
||||
|
||||
@if ($product_array[0]->ProductPrice > 0)
|
||||
{{-- @if ($available_qty !== null) --}}
|
||||
@@ -372,7 +374,6 @@
|
||||
</div>
|
||||
@endif
|
||||
{{-- @endif --}}
|
||||
|
||||
@endif
|
||||
</form>
|
||||
<hr>
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
@foreach ($stores_array as $store)
|
||||
<div class="col-lg-2 col-md-3 col-sm-4">
|
||||
<div class="p-3 store">
|
||||
{{--
|
||||
@if($store->Password != null )
|
||||
{{-- @if ($store->Password != null)
|
||||
<a class="thumbnail password-protected" href="#" data-store-id="{{ $store->Id }}" data-store-url="{{ $store->StoreUrl }}">
|
||||
<img class="store-logo" src="{{ config('site_config.uploads') . 'teamstore/'. $store->ImageFolder . '/' . $store->StoreLogo }}">
|
||||
</a>
|
||||
@@ -14,28 +13,24 @@
|
||||
</a>
|
||||
<h4 style="border-top: 1px solid #dddddd; padding: 10px; font-size: 16px; font-weight: bold; text-transform: uppercase;" class="text-center">{{ $store->StoreName }}</h4>
|
||||
@endif --}}
|
||||
@if($store->Password != null )
|
||||
@if ($store->Password != null)
|
||||
<a href="#">
|
||||
<div class="store-logo password-protected" data-store-id="{{ $store->Id }}" data-store-url="{{ $store->StoreUrl }}">
|
||||
<img
|
||||
src="{{ config('site_config.uploads') . 'teamstore/' . $store->ImageFolder . '/' . $store->StoreLogo }}"
|
||||
class="d-block"
|
||||
alt="{{ $store->StoreName }}"
|
||||
/>
|
||||
<div class="store-logo password-protected" data-store-id="{{ $store->Id }}"
|
||||
data-store-url="{{ $store->StoreUrl }}">
|
||||
<img src="{{ config('site_config.uploads') . 'teamstore/' . $store->ImageFolder . '/' . $store->StoreLogo }}"
|
||||
class="d-block" alt="{{ $store->StoreName }}" />
|
||||
<div class="store-locked">
|
||||
<i class="fa fa-lock"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="store-name">{{ $store->StoreName }} <i class="fa fa-lock" title="This store is password protected."></i></div>
|
||||
<div class="store-name">{{ $store->StoreName }} <i class="fa fa-lock"
|
||||
title="This store is password protected."></i></div>
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ url('store') . '/' . $store->StoreUrl }}">
|
||||
<div class="store-logo">
|
||||
<img
|
||||
src="{{ config('site_config.uploads') . 'teamstore/' . $store->ImageFolder . '/' . $store->StoreLogo }}"
|
||||
class="d-block"
|
||||
alt="{{ $store->StoreName }}"
|
||||
/>
|
||||
<img src="{{ config('site_config.uploads') . 'teamstore/' . $store->ImageFolder . '/' . $store->StoreLogo }}"
|
||||
class="d-block" alt="{{ $store->StoreName }}" />
|
||||
</div>
|
||||
<div class="store-name">{{ $store->StoreName }}</div>
|
||||
</a>
|
||||
@@ -100,7 +95,8 @@
|
||||
</div> --}}
|
||||
|
||||
{{-- <div id="team-store-login" class="modal fade" role="dialog"> --}}
|
||||
<div class="modal fade" id="team-store-login" tabindex="-1" aria-labelledby="storeLoginLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
|
||||
<div class="modal fade" id="team-store-login" tabindex="-1" aria-labelledby="storeLoginLabel" aria-hidden="true"
|
||||
data-bs-backdrop="static" data-bs-keyboard="false">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form class="form-horizontal" role="form" method="POST" action="{{ url('store/checkpassword') }}">
|
||||
@@ -112,7 +108,8 @@
|
||||
@if (\Session::has('errors'))
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<strong>Whoops!</strong> {!! \Session::get('errors') !!}.
|
||||
<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
|
||||
|
||||
@@ -120,8 +117,10 @@
|
||||
<input type="hidden" class="form-control" id="_teamstore_id" name="store_id">
|
||||
<label class="col-md-4 control-label">Store Password</label>
|
||||
<div class="input-group mb-3">
|
||||
<input type="password" class="form-control pwd" name="password" placeholder="Store Password" aria-label="Store Password" aria-describedby="button-addon2" required>
|
||||
<button class="btn btn-outline-secondary reveal-password" type="button" id="button-addon2"><i class="fa fa-eye"></i></button>
|
||||
<input type="password" class="form-control pwd" name="password" placeholder="Store Password"
|
||||
aria-label="Store Password" aria-describedby="button-addon2" required>
|
||||
<button class="btn btn-outline-secondary reveal-password" type="button" id="button-addon2"><i
|
||||
class="fa fa-eye"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@@ -131,4 +130,4 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user