added checks
This commit is contained in:
parent
b6d64b251b
commit
cd1ea82d12
|
|
@ -1288,14 +1288,14 @@ class Cart {
|
|||
|
||||
public function applyCoupon($code)
|
||||
{
|
||||
$result = $this->discount->ruleCheck($code);
|
||||
$result = $this->discount->applyCouponAbleRule($code);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function applyNonCoupon()
|
||||
{
|
||||
$result = $this->discount->nonRuleCheck();
|
||||
$result = $this->discount->applyNonCouponAbleRule();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ return [
|
|||
'percent_of_product' => 'Percentage of product',
|
||||
'fixed_amount' => 'Apply as fixed amount',
|
||||
'buy_a_get_b' => 'Get B amount back',
|
||||
// 'fixed_amount_cart' => 'Fixed amount for whole cart'
|
||||
],
|
||||
|
||||
'validation' => [
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -9,6 +9,7 @@ use Webkul\Checkout\Repositories\CartItemRepository;
|
|||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
use Webkul\Customer\Repositories\WishlistRepository;
|
||||
use Webkul\Discount\Repositories\CartRuleCartRepository as CartRuleCart;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Cart;
|
||||
|
||||
|
|
@ -37,6 +38,7 @@ class CartController extends Controller
|
|||
protected $cartItem;
|
||||
protected $customer;
|
||||
protected $product;
|
||||
protected $cartRuleCart;
|
||||
protected $suppressFlash = false;
|
||||
|
||||
/**
|
||||
|
|
@ -51,7 +53,8 @@ class CartController extends Controller
|
|||
CartItemRepository $cartItem,
|
||||
CustomerRepository $customer,
|
||||
ProductRepository $product,
|
||||
WishlistRepository $wishlist
|
||||
WishlistRepository $wishlist,
|
||||
CartRuleCart $cartRuleCart
|
||||
)
|
||||
{
|
||||
|
||||
|
|
@ -67,6 +70,8 @@ class CartController extends Controller
|
|||
|
||||
$this->wishlist = $wishlist;
|
||||
|
||||
$this->cartRuleCart = $cartRuleCart;
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
|
|
@ -260,6 +265,17 @@ class CartController extends Controller
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the non couponable rule
|
||||
*/
|
||||
public function getNonCouponAbleRule()
|
||||
{
|
||||
$cart = Cart::getCart();
|
||||
$nonCouponAbleRules = Cart::applyNonCoupon();
|
||||
|
||||
return $nonCouponAbleRules;
|
||||
}
|
||||
|
||||
/**
|
||||
* To remove the currently active
|
||||
* couponable rule
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
|
|||
|
||||
Route::post('checkout/check/coupons', 'Webkul\Shop\Http\Controllers\CartController@applyCoupon')->name('shop.checkout.check.coupons');
|
||||
|
||||
Route::post('checkout/fetch/noncoupon', 'Webkul\Shop\Http\Controllers\CartController@getNonCouponAbleRule')->name('shop.checkout.fetch.non-coupon');
|
||||
|
||||
Route::post('checkout/remove/coupon', 'Webkul\Shop\Http\Controllers\CartController@removeCoupon')->name('shop.checkout.remove.coupon');
|
||||
|
||||
//Cart Items Add
|
||||
|
|
|
|||
|
|
@ -284,22 +284,22 @@
|
|||
this.disable_button = true;
|
||||
|
||||
this.$http.post("{{ route('shop.checkout.save-payment') }}", {'payment': this.selected_payment_method})
|
||||
.then(function(response) {
|
||||
this_this.disable_button = false;
|
||||
.then(function(response) {
|
||||
this_this.disable_button = false;
|
||||
|
||||
if (response.data.jump_to_section == 'review') {
|
||||
reviewHtml = Vue.compile(response.data.html)
|
||||
this_this.completedStep = 3;
|
||||
this_this.currentStep = 4;
|
||||
if (response.data.jump_to_section == 'review') {
|
||||
reviewHtml = Vue.compile(response.data.html)
|
||||
this_this.completedStep = 3;
|
||||
this_this.currentStep = 4;
|
||||
|
||||
this_this.getOrderSummary();
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
this_this.disable_button = false;
|
||||
this_this.getOrderSummary();
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
this_this.disable_button = false;
|
||||
|
||||
this_this.handleErrorResponse(error.response, 'payment-form')
|
||||
})
|
||||
this_this.handleErrorResponse(error.response, 'payment-form')
|
||||
});
|
||||
},
|
||||
|
||||
placeOrder: function() {
|
||||
|
|
@ -511,6 +511,8 @@
|
|||
},
|
||||
|
||||
mounted: function() {
|
||||
// shop.checkout.fetch.non-coupon
|
||||
this.checkNonCouponAble();
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
@ -530,6 +532,16 @@
|
|||
});
|
||||
},
|
||||
|
||||
checkNonCouponAble: function () {
|
||||
var this_this = this;
|
||||
|
||||
axios.post('{{ route('shop.checkout.fetch.non-coupon') }}').then(function(response) {
|
||||
console.log(response.data);
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
|
||||
codeChange: function() {
|
||||
if (this.code.length == 0 || this.code.length == 1)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue