Warning Message Added In Place Order As Well
This commit is contained in:
parent
a3a858a459
commit
e47662e6a5
|
|
@ -228,6 +228,12 @@ class OnepageController extends Controller
|
|||
{
|
||||
$cart = Cart::getCart();
|
||||
|
||||
$minimumOrderAmount = (int) core()->getConfigData('sales.orderSettings.minimum-order.minimum_order_amount') ?? 0;
|
||||
|
||||
if (! ($cart->base_sub_total > $minimumOrderAmount)) {
|
||||
throw new \Exception(trans('shop::app.checkout.cart.minimum-order-message', ['amount' => $minimumOrderAmount]));
|
||||
}
|
||||
|
||||
if ($cart->haveStockableItems() && ! $cart->shipping_address) {
|
||||
throw new \Exception(trans('Please check shipping address.'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,10 +303,10 @@
|
|||
],
|
||||
|
||||
mounted: function () {
|
||||
let cartDetails = JSON.parse(this.cartDetails);
|
||||
let cartDetails = this.getCartDetails();
|
||||
|
||||
$('#proceed-to-checkout').on('click', (e) => {
|
||||
if (! (cartDetails.base_grand_total > this.minimumOrderAmount)) {
|
||||
if (! (cartDetails.base_sub_total > this.minimumOrderAmount)) {
|
||||
e.preventDefault();
|
||||
window.showAlert(`alert-warning`, 'Warning', this.minimumOrderMessage);
|
||||
}
|
||||
|
|
@ -323,6 +323,10 @@
|
|||
removeLink(message) {
|
||||
if (! confirm(message))
|
||||
event.preventDefault();
|
||||
},
|
||||
|
||||
getCartDetails: function () {
|
||||
return JSON.parse(this.cartDetails);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -5,7 +5,15 @@
|
|||
@stop
|
||||
|
||||
@section('content-wrapper')
|
||||
<checkout></checkout>
|
||||
@php
|
||||
$minimumOrderAmount = (int) core()->getConfigData('sales.orderSettings.minimum-order.minimum_order_amount') ?? 0;
|
||||
@endphp
|
||||
|
||||
<checkout
|
||||
cart-details="{{ $cart }}"
|
||||
minimum-order-amount="{{ $minimumOrderAmount }}"
|
||||
minimum-order-message="{{ __('shop::app.checkout.cart.minimum-order-message', ['amount' => $minimumOrderAmount]) }}">
|
||||
</checkout>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
|
|
@ -112,8 +120,15 @@
|
|||
|
||||
Vue.component('checkout', {
|
||||
template: '#checkout-template',
|
||||
|
||||
inject: ['$validator'],
|
||||
|
||||
props: [
|
||||
'cartDetails',
|
||||
'minimumOrderAmount',
|
||||
'minimumOrderMessage'
|
||||
],
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
allAddress: {},
|
||||
|
|
@ -159,6 +174,10 @@
|
|||
created: function () {
|
||||
this.getOrderSummary();
|
||||
|
||||
if (! (this.getCartDetails().base_sub_total > this.minimumOrderAmount)) {
|
||||
window.showAlert(`alert-warning`, 'Warning', this.minimumOrderMessage);
|
||||
}
|
||||
|
||||
if (! customerAddress) {
|
||||
this.new_shipping_address = true;
|
||||
this.new_billing_address = true;
|
||||
|
|
@ -544,6 +563,10 @@
|
|||
setTimeout(() => {
|
||||
this.validateForm('address-form');
|
||||
}, 0);
|
||||
},
|
||||
|
||||
getCartDetails: function () {
|
||||
return JSON.parse(this.cartDetails);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue