diff --git a/padelclub_backend/settings.py b/padelclub_backend/settings.py index 7f19c3f..24c7028 100644 --- a/padelclub_backend/settings.py +++ b/padelclub_backend/settings.py @@ -155,6 +155,7 @@ AUTHENTICATION_BACKENDS = [ ] CSRF_COOKIE_SECURE = True # if using HTTPS +SESSION_COOKIE_SECURE = True # Si vous utilisez HTTPS # Stripe Settings STRIPE_PUBLISHABLE_KEY = 'pk_test_51R4LrTPEZkECCx484C2KbmRpcO2ZkZb0NoNi8QJB4X3E5JFu3bvLk4JZQmz9grKbk6O40z3xI8DawHrGyUY0fOT600VEKC9ran' # Replace with your actual key diff --git a/shop/cart.py b/shop/cart.py index 154bc61..76dcec6 100644 --- a/shop/cart.py +++ b/shop/cart.py @@ -16,15 +16,21 @@ def add_to_cart(request, product_id, quantity=1, color_id=None, size_id=None): product = Product.objects.get(id=product_id) cart_id = get_or_create_cart_id(request) + color = Color.objects.get(id=color_id) if color_id else None + size = Size.objects.get(id=size_id) if size_id else None + try: - # Try to get existing cart item - cart_item = CartItem.objects.get(product=product, session_id=cart_id) + # Try to get existing cart item with the same product, color, and size + cart_item = CartItem.objects.get( + product=product, + session_id=cart_id, + color=color, + size=size + ) cart_item.quantity += quantity cart_item.save() except CartItem.DoesNotExist: # Create new cart item - color = Color.objects.get(id=color_id) if color_id else None - size = Size.objects.get(id=size_id) if size_id else None cart_item = CartItem.objects.create( product=product, quantity=quantity, diff --git a/shop/static/shop/css/shop.css b/shop/static/shop/css/shop.css index 09fe917..7d49698 100644 --- a/shop/static/shop/css/shop.css +++ b/shop/static/shop/css/shop.css @@ -131,7 +131,6 @@ /* Cart Table */ .cart-table { width: 100%; - border-collapse: collapse; } .cart-table th, @@ -329,3 +328,28 @@ .color-sample:hover { transform: scale(1.1); } + +.color-display { + display: flex; + align-items: center; + gap: 8px; +} + +.color-sample-cart { + width: 28px; + height: 28px; + border-radius: 50%; + border: 1px solid #ddd; + display: inline-block; +} + +/* Fix for white + sign */ +.quantity-btn { + color: #333; /* Darker text color to ensure visibility */ +} + +.quantity-btn:hover:not([disabled]) { + background-color: #f39200; + color: white; + border-color: #f39200; +} diff --git a/shop/templates/shop/cart.html b/shop/templates/shop/cart.html index 8034405..92aa4ee 100644 --- a/shop/templates/shop/cart.html +++ b/shop/templates/shop/cart.html @@ -5,6 +5,123 @@ {% block second_title %}Plein de goodies !{% endblock %} {% block content %} +
| {{ item.product.title }} | -{{ item.color.name }} | -{{ item.size.name }} | -+ | {{ item.product.title }} | +
+
+
+ {{ item.color.name }} | {{ item.size.name }}
+
+ |
+
|
- {{ item.get_total_price }} € | -+ | {{ item.get_total_price }} € | +|
| Total: | -{{ total_quantity }} | -{{ total }} € | -+ | {{ total_quantity }} produit(s) | ++ | + | {{ total }} € | +|||
Connectez-vous pour un paiement plus rapide.
- Se connecter -Connectez-vous pour un paiement plus rapide.
+ Se connecter +Votre panier est vide.
diff --git a/shop/templates/shop/product_item.html b/shop/templates/shop/product_item.html index db7d7c6..07568c5 100644 --- a/shop/templates/shop/product_item.html +++ b/shop/templates/shop/product_item.html @@ -1,4 +1,4 @@ -