From 131c73ce04fd56a63b627c7874c805a4900a120a Mon Sep 17 00:00:00 2001 From: Prashant Singh Date: Wed, 29 May 2019 18:00:44 +0530 Subject: [PATCH] some bug fixes --- packages/Webkul/Checkout/src/Cart.php | 2 +- .../Webkul/Discount/src/Helpers/Discount.php | 28 ++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/packages/Webkul/Checkout/src/Cart.php b/packages/Webkul/Checkout/src/Cart.php index 1660d8f01..608482c00 100755 --- a/packages/Webkul/Checkout/src/Cart.php +++ b/packages/Webkul/Checkout/src/Cart.php @@ -1242,7 +1242,7 @@ class Cart { public function applyNonCoupon() { - $result = $this->discount->nonCouponCheck(); + $result = $this->discount->nonRuleCheck(); return $result; } diff --git a/packages/Webkul/Discount/src/Helpers/Discount.php b/packages/Webkul/Discount/src/Helpers/Discount.php index 18ce94505..62a1d1a7d 100644 --- a/packages/Webkul/Discount/src/Helpers/Discount.php +++ b/packages/Webkul/Discount/src/Helpers/Discount.php @@ -23,6 +23,10 @@ class Discount $this->endRuleActive = false; } + /** + * Gets the end rules applicable for guests + * autocheck for customer group and channels + */ public function getGuestEndRules() { $rules = $this->cartRule->findWhere(['status' => 1, 'end_other_rules' => 1, 'is_guest' => 1]); @@ -57,6 +61,11 @@ class Discount return $guestRules; } + /** + * Get the non ending rules for the guest + * and completed auto check for guests and + * channels + */ public function getGuestBestRules() { $rules = $this->cartRule->findWhere(['status' => 1, 'end_other_rules' => 0, 'is_guest' => 1]); @@ -74,6 +83,10 @@ class Discount return $guestRules; } + + /** + * Gets the best rules for auth customers + */ public function getBestRules() { $rules = $this->cartRule->findWhere(['status' => 1, 'end_other_rules' => 0]); @@ -97,6 +110,9 @@ class Discount return $suitableRules; } + /** + * Gets the end rules for the auth customers + */ public function getEndRules() { $rules = $this->cartRule->findWhere(['status' => 1, 'end_other_rules' => 1]); @@ -137,6 +153,10 @@ class Discount return $suitableRules; } + /** + * Get the rules to applied automatically + * depending on user state + */ public function toApply() { if (auth()->guard('customer')->check()) { @@ -182,6 +202,9 @@ class Discount } } + /** + * To apply the coupon code based rules + */ public function applyCouponAble() { $rules = $this->toApply(); @@ -231,6 +254,9 @@ class Discount } } + /** + * To apply the non coupon based rules + */ public function applyNonCouponAble() { $rules = $this->toApply(); @@ -285,7 +311,7 @@ class Discount } } - public function nonCouponCheck() + public function nonRuleCheck() { $result = $this->applyNonCouponAble(); $cart = \Cart::getCart();