From 79922f2c93504c3737790c4ed4ce868fa1347a4f Mon Sep 17 00:00:00 2001 From: Matt April Date: Fri, 15 May 2020 11:10:41 -0400 Subject: [PATCH 01/90] Hide $0 bundle option price in cart --- packages/Webkul/Product/src/Type/Bundle.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/Webkul/Product/src/Type/Bundle.php b/packages/Webkul/Product/src/Type/Bundle.php index c61db3e80..5c9461d1c 100644 --- a/packages/Webkul/Product/src/Type/Bundle.php +++ b/packages/Webkul/Product/src/Type/Bundle.php @@ -560,7 +560,14 @@ class Bundle extends AbstractType $bundleOptionQuantities[$optionId] = $qty; } - $labels[] = $qty . ' x ' . $optionProduct->product->name . ' ' . core()->currency($optionProduct->product->getTypeInstance()->getMinimalPrice()); + $label = $qty . ' x ' . $optionProduct->product->name; + + $price = $optionProduct->product->getTypeInstance()->getMinimalPrice(); + if($price != 0){ + $label .= ' ' . core()->currency($price); + } + + $labels[] = $label; } if (count($labels)) { From e189a4fa80182c437ab6814dde2534631e2fd44c Mon Sep 17 00:00:00 2001 From: Matt April Date: Fri, 29 May 2020 12:26:13 -0400 Subject: [PATCH 02/90] Added haveSufficientQuantity() method for Bundle - checks that all required options have at least one product in stock. --- packages/Webkul/Product/src/Type/Bundle.php | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/Webkul/Product/src/Type/Bundle.php b/packages/Webkul/Product/src/Type/Bundle.php index 6f797494d..119b792eb 100644 --- a/packages/Webkul/Product/src/Type/Bundle.php +++ b/packages/Webkul/Product/src/Type/Bundle.php @@ -652,4 +652,27 @@ class Bundle extends AbstractType return $options; } + + /** + * @param int $qty + * @return bool + */ + public function haveSufficientQuantity($qty) + { + # to consider a bundle in stock we need to check that at least one product from each required group is available for the given quantity + foreach ($this->product->bundle_options as $option) { + if($option->is_required) { + foreach ($option->bundle_option_products as $bundleOptionProduct) { + # as long as at least one product in the required group is available we can continue checking other groups + if($bundleOptionProduct->product->haveSufficientQuantity($bundleOptionProduct->qty * $qty)) { + continue 2; + } + } + # if any required option does not have any in-stock product option we will get here. + return false; + } + } + + return true; + } } \ No newline at end of file From 7cf6cdb9f008035978a6122162f823e800beb83b Mon Sep 17 00:00:00 2001 From: Matt April Date: Fri, 29 May 2020 12:30:32 -0400 Subject: [PATCH 03/90] Added product inventory levels to BundleOption - can be used to display out of stock bundle items in front end --- packages/Webkul/Product/src/Helpers/BundleOption.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/Webkul/Product/src/Helpers/BundleOption.php b/packages/Webkul/Product/src/Helpers/BundleOption.php index fcfca3148..b8a94a66d 100644 --- a/packages/Webkul/Product/src/Helpers/BundleOption.php +++ b/packages/Webkul/Product/src/Helpers/BundleOption.php @@ -35,6 +35,9 @@ class BundleOption extends AbstractProduct { $options = []; + # eager load all inventories for bundle options + $this->product->bundle_options->load('bundle_option_products.product.inventories'); + foreach ($this->product->bundle_options as $option) { $options[$option->id] = $this->getOptionItemData($option); } @@ -87,6 +90,8 @@ class BundleOption extends AbstractProduct 'product_id' => $bundleOptionProduct->product_id, 'is_default' => $bundleOptionProduct->is_default, 'sort_order' => $bundleOptionProduct->sort_order, + 'in_stock' => $bundleOptionProduct->product->inventories->sum('qty') >= $bundleOptionProduct->qty, + 'inventory' => $bundleOptionProduct->product->inventories->sum('qty'), ]; } From 36444145c054f4484f24decfa6d0a408fefa636d Mon Sep 17 00:00:00 2001 From: Matt April Date: Fri, 19 Jun 2020 11:29:03 -0400 Subject: [PATCH 04/90] style. --- packages/Webkul/Product/src/Type/Bundle.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/Webkul/Product/src/Type/Bundle.php b/packages/Webkul/Product/src/Type/Bundle.php index 119b792eb..acfdef3f3 100644 --- a/packages/Webkul/Product/src/Type/Bundle.php +++ b/packages/Webkul/Product/src/Type/Bundle.php @@ -172,7 +172,7 @@ class Bundle extends AbstractType if (count($optionProductsPrices)) { $selectionMinPrice = min($optionProductsPrices); - if($option->is_required) { + if ($option->is_required) { $minPrice += $selectionMinPrice; } elseif (! $haveRequiredOptions) { $minPrices[] = $selectionMinPrice; @@ -206,7 +206,7 @@ class Bundle extends AbstractType if (count($optionProductsPrices)) { $selectionMinPrice = min($optionProductsPrices); - if($option->is_required) { + if ($option->is_required) { $minPrice += $selectionMinPrice; } elseif (! $haveRequiredOptions) { $minPrices[] = $selectionMinPrice; @@ -661,7 +661,7 @@ class Bundle extends AbstractType { # to consider a bundle in stock we need to check that at least one product from each required group is available for the given quantity foreach ($this->product->bundle_options as $option) { - if($option->is_required) { + if ($option->is_required) { foreach ($option->bundle_option_products as $bundleOptionProduct) { # as long as at least one product in the required group is available we can continue checking other groups if($bundleOptionProduct->product->haveSufficientQuantity($bundleOptionProduct->qty * $qty)) { From 12dc7a62a4706585cf62cfb35b30c2df902453f8 Mon Sep 17 00:00:00 2001 From: Matt April Date: Fri, 19 Jun 2020 11:38:56 -0400 Subject: [PATCH 05/90] Addresses required bundle options being removed if all product options are disabled. #3160 --- packages/Webkul/Product/src/Helpers/BundleOption.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/Webkul/Product/src/Helpers/BundleOption.php b/packages/Webkul/Product/src/Helpers/BundleOption.php index 406a12d63..e33dfdc94 100644 --- a/packages/Webkul/Product/src/Helpers/BundleOption.php +++ b/packages/Webkul/Product/src/Helpers/BundleOption.php @@ -38,7 +38,7 @@ class BundleOption extends AbstractProduct foreach ($this->product->bundle_options as $option) { $data = $this->getOptionItemData($option); - if (! count($data['products'])) { + if (! $option->is_required && ! count($data['products'])) { continue; } From 171ea1114b995183313aa2f43fb4113df641bee1 Mon Sep 17 00:00:00 2001 From: rahulshukla-home Date: Thu, 2 Jul 2020 13:02:46 +0530 Subject: [PATCH 06/90] Issue #3395 and #3396 fixed --- .../src/Repositories/CustomerSocialAccountRepository.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/Webkul/SocialLogin/src/Repositories/CustomerSocialAccountRepository.php b/packages/Webkul/SocialLogin/src/Repositories/CustomerSocialAccountRepository.php index a5d28f16d..6934c2ef8 100644 --- a/packages/Webkul/SocialLogin/src/Repositories/CustomerSocialAccountRepository.php +++ b/packages/Webkul/SocialLogin/src/Repositories/CustomerSocialAccountRepository.php @@ -67,11 +67,7 @@ class CustomerSocialAccountRepository extends Repository 'provider_name' => $provider, 'provider_id' => $providerUser->getId(), ]); - - $data['customer_group_id'] = $this->customerGroupRepository->findOneWhere(['code' => 'general'])->id; - - dd($data); - + if ($account) { return $account->customer; } else { From 9dcfaf7d0a6c4c6792b8b5008d256b6bf670b8f1 Mon Sep 17 00:00:00 2001 From: mohammad asif Date: Thu, 2 Jul 2020 13:23:49 +0530 Subject: [PATCH 07/90] fixed issue 3381 city does not allowed hyphen --- .../Resources/views/customers/account/address/edit.blade.php | 2 +- .../views/shop/customers/account/address/edit.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/address/edit.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/address/edit.blade.php index 83a02bacc..3d08ec0ec 100755 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/address/edit.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/address/edit.blade.php @@ -86,7 +86,7 @@
- + @{{ errors.first('city') }}
diff --git a/packages/Webkul/Velocity/src/Resources/views/shop/customers/account/address/edit.blade.php b/packages/Webkul/Velocity/src/Resources/views/shop/customers/account/address/edit.blade.php index dd22f307f..e4c168e26 100644 --- a/packages/Webkul/Velocity/src/Resources/views/shop/customers/account/address/edit.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/shop/customers/account/address/edit.blade.php @@ -79,7 +79,7 @@
- + @{{ errors.first('city') }}
From 00b9f4862cf2db310ada10f22baaa6ac5c37c68a Mon Sep 17 00:00:00 2001 From: mohammad asif Date: Thu, 2 Jul 2020 13:28:02 +0530 Subject: [PATCH 08/90] fixed issue 3311 filter disapear on zero product --- .../Velocity/src/Resources/views/shop/products/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/Webkul/Velocity/src/Resources/views/shop/products/index.blade.php b/packages/Webkul/Velocity/src/Resources/views/shop/products/index.blade.php index d9d7087b7..04e75242d 100755 --- a/packages/Webkul/Velocity/src/Resources/views/shop/products/index.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/shop/products/index.blade.php @@ -91,7 +91,7 @@ @if ($isProductsDisplayMode)
-