diff --git a/packages/Webkul/Checkout/src/Cart.php b/packages/Webkul/Checkout/src/Cart.php index fca6888a6..eb4924901 100644 --- a/packages/Webkul/Checkout/src/Cart.php +++ b/packages/Webkul/Checkout/src/Cart.php @@ -154,8 +154,6 @@ class Cart { 'base_total_weight' => $product->weight * $data['quantity'], ]; - // dd(['parent' => $parentData, 'child' => null]); - return ['parent' => $parentData, 'child' => null]; } } @@ -447,6 +445,7 @@ class Cart { */ public function removeItem($itemId) { + dd($itemId); if(session()->has('cart')) { $cart = session()->get('cart'); @@ -486,11 +485,13 @@ class Cart { } if ($result) { - session()->flash('sucess', 'Item Successfully Removed From Cart'); + session()->flash('sucess', trans('shop::app.checkout.cart.remove.success')); } else { - session()->flash('error', 'Item Cannot Be Removed From Cart'); + session()->flash('error', trans('shop::app.checkout.cart.remove.error')); } } + session()->flash('warning', trans('shop::app.checkout.cart.remove.cannot')); + return redirect()->back(); } diff --git a/packages/Webkul/Shop/src/Http/Controllers/CartController.php b/packages/Webkul/Shop/src/Http/Controllers/CartController.php index 537f8d112..4ee3c1194 100644 --- a/packages/Webkul/Shop/src/Http/Controllers/CartController.php +++ b/packages/Webkul/Shop/src/Http/Controllers/CartController.php @@ -76,16 +76,11 @@ class CartController extends Controller } /** - * Method to populate - * the cart page which - * will be populated - * before the checkout - * process. + * Method to populate the cart page which will be populated before the checkout process. * * @return Mixed */ public function index() { - // dd(Cart::getCart()); return view($this->_config['view'])->with('cart', Cart::getCart()); } @@ -126,6 +121,14 @@ class CartController extends Controller public function updateBeforeCheckout() { $data = request()->except('_token'); + foreach($data['qty'] as $id => $quantity) { + // dd($id, $quantity); + if($quantity <= 0) { + session()->flash('warning', trans('shop::app.checkout.cart.quantity.illegal')); + + return redirect()->back(); + } + } Cart::update($data); return redirect()->back(); diff --git a/packages/Webkul/Shop/src/Http/routes.php b/packages/Webkul/Shop/src/Http/routes.php index 3700b5a3e..dff2ea127 100644 --- a/packages/Webkul/Shop/src/Http/routes.php +++ b/packages/Webkul/Shop/src/Http/routes.php @@ -41,11 +41,6 @@ Route::group(['middleware' => ['web']], function () { 'view' => 'shop::products.view' ])->name('shop.products.index'); - // //Routes for product cart - // Route::get('/checkout/cart', 'Webkul\Shop\Http\Controllers\CartController@index')->defaults('_config', [ - // 'view' => 'shop::checkout.cart.index' - // ])->name('shop.checkout.cart.index'); - Route::post('product/cart/add/{id}', 'Webkul\Shop\Http\Controllers\CartController@add')->name('cart.add'); Route::get('product/cart/remove/{id}', 'Webkul\Shop\Http\Controllers\CartController@remove')->name('cart.remove'); diff --git a/packages/Webkul/Ui/src/Resources/assets/images/icon-cart.svg b/packages/Webkul/Shop/src/Resources/assets/images/icon-cart.svg similarity index 100% rename from packages/Webkul/Ui/src/Resources/assets/images/icon-cart.svg rename to packages/Webkul/Shop/src/Resources/assets/images/icon-cart.svg diff --git a/packages/Webkul/Shop/src/Resources/assets/sass/app.scss b/packages/Webkul/Shop/src/Resources/assets/sass/app.scss index 98536621d..71227fb36 100644 --- a/packages/Webkul/Shop/src/Resources/assets/sass/app.scss +++ b/packages/Webkul/Shop/src/Resources/assets/sass/app.scss @@ -974,7 +974,7 @@ section.product-detail { width: 100%; div.product-image-group { - margin-right: 36px; + margin-right: 30px; div { display: flex; @@ -985,7 +985,7 @@ section.product-detail { flex-direction: column; margin-right: 4px; height: 480px; - width: 120px; + min-width: 120px; overflow: hidden; position: relative; justify-content: flex-start; @@ -993,8 +993,7 @@ section.product-detail { .thumb-frame { border: 2px solid transparent; background: #F2F2F2; - max-width: 120px; - width: auto; + width: 120px; height: 120px; &.active { @@ -1002,8 +1001,8 @@ section.product-detail { } img { - width: 100%; height: 100%; + width: 100%; } } @@ -1077,8 +1076,9 @@ section.product-detail { } } - .cart-fav-seg { - display: block; + .add-to-buttons { + display: flex; + flex-direction: row; margin-top: 10px; .addtocart { diff --git a/packages/Webkul/Shop/src/Resources/assets/sass/components.scss b/packages/Webkul/Shop/src/Resources/assets/sass/components.scss index 939075c42..78a22e599 100644 --- a/packages/Webkul/Shop/src/Resources/assets/sass/components.scss +++ b/packages/Webkul/Shop/src/Resources/assets/sass/components.scss @@ -83,16 +83,25 @@ .cart-fav-seg { display: inline-flex; - width: 100%; + align-items: center; .addtocart { margin-right: 10px; text-transform: uppercase; white-space: nowrap; } + + .product-card.wishlist-icon { + cursor: pointer; + } } } +//wishlist-icon-hover +.product-card.wishlist-icon:hover { + background-image: url('../images/wishadd.svg'); +} + //product page price styles .product-price { margin-bottom: 14px; diff --git a/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss b/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss index 468ec6158..dea756ecb 100644 --- a/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss +++ b/packages/Webkul/Shop/src/Resources/assets/sass/icons.scss @@ -71,4 +71,16 @@ background-image: url('../images/payment.svg'); width: 32px; height: 32px; +} + +.cart-icon { + background-image: url("../images/icon-cart.svg"); + width: 24px; + height: 24px; +} + +.wishlist-icon { + background-image: url('../images/wishlist.svg'); + width: 32px; + height: 32px; } \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/lang/en/app.php b/packages/Webkul/Shop/src/Resources/lang/en/app.php index 11dd753fc..2c47d91ba 100644 --- a/packages/Webkul/Shop/src/Resources/lang/en/app.php +++ b/packages/Webkul/Shop/src/Resources/lang/en/app.php @@ -70,7 +70,16 @@ return [ 'proceed-to-checkout' => 'Proceed To Checkout', 'quantity' => 'Quantity', 'remove' => 'Remove', - 'move-to-wishlist' => 'Move to Wishlist' + 'move-to-wishlist' => 'Move to Wishlist', + 'quantity' => [ + 'quantity' => 'Quantity', + 'illegal' => 'Quantity cannot be lesser than one.' + ], + 'remove' => [ + 'cannot' => 'No items to remove from the cart', + 'success' => 'Item successfully removed from the cart', + 'error' => 'Cannot remove item from cart' + ] ], 'onepage' => [ diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php index aa1404486..7052e7d71 100644 --- a/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php @@ -48,21 +48,28 @@ @if ($product->type == 'configurable')