Added Method
This commit is contained in:
parent
7f7dc2169a
commit
dff0466971
|
|
@ -350,4 +350,21 @@ class OnepageController extends Controller
|
|||
], 422);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for minimum order.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function checkMinimumOrder()
|
||||
{
|
||||
$minimumOrderAmount = (float) core()->getConfigData('sales.orderSettings.minimum-order.minimum_order_amount') ?? 0;
|
||||
|
||||
$status = Cart::checkMinimumOrder();
|
||||
|
||||
return response()->json([
|
||||
'status' => ! $status ? false : true,
|
||||
'message' => ! $status ? trans('shop::app.checkout.cart.minimum-order-message', ['amount' => core()->currency($minimumOrderAmount)]) : 'Success',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -76,6 +76,9 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
|
|||
//Checkout Save Payment Method Form
|
||||
Route::post('/checkout/save-payment', 'Webkul\Shop\Http\Controllers\OnepageController@savePayment')->name('shop.checkout.save-payment');
|
||||
|
||||
/* check minimum order */
|
||||
Route::post('/checkout/check-minimum-order', 'Webkul\Shop\Http\Controllers\OnepageController@checkMinimumOrder')->name('shop.checkout.check-minimum-order');
|
||||
|
||||
//Checkout Save Order
|
||||
Route::post('/checkout/save-order', 'Webkul\Shop\Http\Controllers\OnepageController@saveOrder')->name('shop.checkout.save-order');
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
v-if="cartItems.length > 0"
|
||||
class="modal-content sensitive-modal cart-modal-content hide">
|
||||
|
||||
<!--Body-->
|
||||
<div class="mini-cart-container">
|
||||
<div class="row small-card-container" :key="index" v-for="(item, index) in cartItems">
|
||||
<div class="col-3 product-image-container mr15">
|
||||
|
|
@ -40,7 +39,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!--Footer-->
|
||||
<div class="modal-footer">
|
||||
<h2 class="col-6 text-left fw6">
|
||||
{{ subtotalText }}
|
||||
|
|
@ -74,8 +72,7 @@
|
|||
'checkoutUrl',
|
||||
'checkoutText',
|
||||
'subtotalText',
|
||||
'isMinimumOrderCompleted',
|
||||
'minimumOrderMessage'
|
||||
'checkMinimumOrderUrl'
|
||||
],
|
||||
|
||||
data: function () {
|
||||
|
|
@ -123,10 +120,16 @@
|
|||
},
|
||||
|
||||
checkMinimumOrder: function (e) {
|
||||
if (! Boolean(this.isMinimumOrderCompleted)) {
|
||||
e.preventDefault();
|
||||
window.showAlert(`alert-warning`, 'Warning', this.minimumOrderMessage);
|
||||
}
|
||||
e.preventDefault();
|
||||
|
||||
this.$http.post(this.checkMinimumOrderUrl)
|
||||
.then(({ data }) => {
|
||||
if (! data.status) {
|
||||
window.showAlert(`alert-warning`, 'Warning', data.message);
|
||||
} else {
|
||||
window.location.href = this.checkoutUrl;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
<div class="mini-cart-container pull-right">
|
||||
@php
|
||||
$minimumOrderAmount = (int) core()->getConfigData('sales.orderSettings.minimum-order.minimum_order_amount') ?? 0;
|
||||
@endphp
|
||||
|
||||
<mini-cart
|
||||
view-cart="{{ route('shop.checkout.cart.index') }}"
|
||||
cart-text="{{ __('shop::app.minicart.view-cart') }}"
|
||||
checkout-text="{{ __('shop::app.minicart.checkout') }}"
|
||||
checkout-url="{{ route('shop.checkout.onepage.index') }}"
|
||||
subtotal-text="{{ __('shop::app.checkout.cart.cart-subtotal') }}"
|
||||
is-minimum-order-completed="{{ (bool) Cart::checkMinimumOrder() }}"
|
||||
minimum-order-message="{{ __('shop::app.checkout.cart.minimum-order-message', ['amount' => core()->currency($minimumOrderAmount)]) }}">
|
||||
check-minimum-order-url="{{ route('shop.checkout.check-minimum-order') }}">
|
||||
</mini-cart>
|
||||
</div>
|
||||
Loading…
Reference in New Issue