From f0e049c180b4cffd9127eb21f3c844528b3085ea Mon Sep 17 00:00:00 2001
From: Kaloyan Nikolov
Date: Mon, 19 Dec 2022 16:25:29 +0200
Subject: [PATCH 1/2] Proceed to Checkout is disabled if there is no billing or
shipping information attached to that user
---
app/Http/Controllers/CartController.php | 4 +++-
resources/css/app.css | 4 ++++
resources/views/cart/index.blade.php | 22 +++++++++++++++++-----
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/app/Http/Controllers/CartController.php b/app/Http/Controllers/CartController.php
index 7a30651..2476354 100644
--- a/app/Http/Controllers/CartController.php
+++ b/app/Http/Controllers/CartController.php
@@ -19,7 +19,9 @@ public function index()
$total += $product->price * $cartItems[$product->id]['quantity'];
}
- return view('cart.index', compact('cartItems', 'products', 'total'));
+ $user = auth()->user();
+
+ return view('cart.index', compact('cartItems', 'products', 'total', 'user'));
}
public function add(Request $request, Product $product)
diff --git a/resources/css/app.css b/resources/css/app.css
index d88f19f..140b8e5 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -32,6 +32,10 @@
.btn-primary {
@apply text-white bg-purple-600 py-2 px-4 rounded shadow-md hover:bg-purple-700 active:bg-purple-800 transition-colors;
}
+
+ .btn-primary:disabled {
+ @apply bg-gray-400 hover:bg-gray-300;
+ }
}
body {
diff --git a/resources/views/cart/index.blade.php b/resources/views/cart/index.blade.php
index d4b76ef..09b55c8 100644
--- a/resources/views/cart/index.blade.php
+++ b/resources/views/cart/index.blade.php
@@ -66,7 +66,6 @@ class="text-purple-600 hover:text-purple-500"
-
Subtotal
@@ -76,12 +75,25 @@ class="text-purple-600 hover:text-purple-500"
Shipping and taxes calculated at checkout.
-
+ @endif
+
From 0795e5525c142f6344cbb099e9e3454f7cc7392d Mon Sep 17 00:00:00 2001
From: Kaloyan Nikolov
Date: Mon, 19 Dec 2022 17:24:52 +0200
Subject: [PATCH 2/2] We need to show enable Proceed to Checkout for non logged
users so they can be redirected to login page !
---
resources/views/cart/index.blade.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/views/cart/index.blade.php b/resources/views/cart/index.blade.php
index 09b55c8..5afc1fb 100644
--- a/resources/views/cart/index.blade.php
+++ b/resources/views/cart/index.blade.php
@@ -75,7 +75,7 @@ class="text-purple-600 hover:text-purple-500"
Shipping and taxes calculated at checkout.