diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..ad86d41dc --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +MIT License + +Copyright 2010-2018, Webkul Software + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/Webkul/Checkout/src/Cart.php b/packages/Webkul/Checkout/src/Cart.php index c4014baad..449922e40 100644 --- a/packages/Webkul/Checkout/src/Cart.php +++ b/packages/Webkul/Checkout/src/Cart.php @@ -229,6 +229,10 @@ class Cart { $product = $this->product->findOneByField('id', $id); if($product->type == 'configurable') { + if(!isset($data['selected_configurable_option'])) { + return false; + } + $parentProduct = $this->product->findOneByField('id', $data['selected_configurable_option']); $canAdd = $parentProduct->haveSufficientQuantity($data['quantity']); @@ -537,16 +541,24 @@ class Cart { { $cart = null; - if(auth()->guard('customer')->check()) { + if (auth()->guard('customer')->check()) { $cart = $this->cart->findOneWhere([ - 'customer_id' => auth()->guard('customer')->user()->id, - 'is_active' => 1 - ]); + 'customer_id' => auth()->guard('customer')->user()->id, + 'is_active' => 1 + ]); - } elseif(session()->has('cart')) { + } elseif (session()->has('cart')) { $cart = $this->cart->find(session()->get('cart')->id); } + // if($cart != null) { + // if($cart->items->count() == 0) { + // $this->cart->delete($cart->id); + + // return false; + // } + // } + return $cart && $cart->is_active ? $cart : null; } diff --git a/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php b/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php index 0726fb51b..947be1eaa 100644 --- a/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php @@ -58,7 +58,7 @@ class RegistrationController extends Controller 'last_name' => 'string|required', 'email' => 'email|required|unique:customers,email', 'password' => 'confirmed|min:6|required', - 'agreement' => 'required' + // 'agreement' => 'required' ]); $data = request()->input(); diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php index 8df77e20d..c904e9108 100644 --- a/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php @@ -9,7 +9,7 @@