Added For Default Theme As Well

This commit is contained in:
devansh bawari 2020-11-09 19:44:41 +05:30
parent 19e04369f6
commit d27bbd7027
2 changed files with 48 additions and 2 deletions

View File

@ -6,6 +6,11 @@
@section('content-wrapper')
@inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage')
@php
$minimumOrderAmount = (int) core()->getConfigData('sales.orderSettings.minimum-order.minimum_order_amount') ?? 0;
@endphp
<section class="cart">
@if ($cart)
<div class="title">
@ -129,7 +134,7 @@
@endif
@if (! cart()->hasError())
<a href="{{ route('shop.checkout.onepage.index') }}" class="btn btn-lg btn-primary">
<a href="{{ route('shop.checkout.onepage.index') }}" class="btn btn-lg btn-primary" id="proceed-to-checkout">
{{ __('shop::app.checkout.cart.proceed-to-checkout') }}
</a>
@endif
@ -262,4 +267,22 @@
event.preventDefault();
}
</script>
<script>
$(document).ready(() => {
/*
didn't found any component so added here
will improve once get clarity
*/
$('#proceed-to-checkout').on('click', (e) => {
let cartDetails = @json($cart);
let minimumOrderAmount = '{{ $minimumOrderAmount }}';
if (! (cartDetails.base_sub_total > minimumOrderAmount)) {
e.preventDefault();
window.alert('{{ __('shop::app.checkout.cart.minimum-order-message', ['amount' => $minimumOrderAmount]) }}');
}
});
});
</script>
@endpush

View File

@ -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')
@ -123,8 +131,15 @@
Vue.component('checkout', {
template: '#checkout-template',
inject: ['$validator'],
props: [
'cartDetails',
'minimumOrderAmount',
'minimumOrderMessage'
],
data: function() {
return {
step_numbers: {
@ -177,6 +192,10 @@
created: function() {
this.getOrderSummary();
if (! (this.getCartDetails().base_sub_total > this.minimumOrderAmount)) {
window.flashMessages = [{'type': 'alert-error', 'message': this.minimumOrderMessage }];
}
if(! customerAddress) {
this.new_shipping_address = true;
this.new_billing_address = true;
@ -433,6 +452,10 @@
backToSavedShippingAddress: function() {
this.new_shipping_address = false;
},
getCartDetails: function () {
return JSON.parse(this.cartDetails);
}
}
})