feat: cart detail leads to order creation
This commit is contained in:
+19
-1
@@ -4,7 +4,14 @@ from django.shortcuts import get_object_or_404, render
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from shop.filters import ProductFilter
|
||||
from shop.models import CartItem, Product, ProductPrice, WishlistedProduct
|
||||
from shop.models import (
|
||||
CartItem,
|
||||
Product,
|
||||
ProductPrice,
|
||||
WishlistedProduct,
|
||||
CustomerAddress,
|
||||
ShippingMethod,
|
||||
)
|
||||
from web.mixins import FilteredQuerysetMixin, PaginatedQuerysetMixin
|
||||
from web.settings import ANONYMOUS_CART_ID_COOKIE_NAME
|
||||
from web.utils import get_or_create_cart
|
||||
@@ -84,6 +91,14 @@ def cart(request, *args, **kwargs):
|
||||
|
||||
total = base_total + tax_total
|
||||
|
||||
billing_addresses = CustomerAddress.objects.filter(
|
||||
user=request.user, address_type=CustomerAddress.Types.BILLING
|
||||
)
|
||||
shipping_addresses = CustomerAddress.objects.filter(
|
||||
user=request.user, address_type=CustomerAddress.Types.SHIPPING
|
||||
)
|
||||
shipping_methods = ShippingMethod.objects.all()
|
||||
|
||||
response = render(
|
||||
request,
|
||||
"components/cart/cart.html",
|
||||
@@ -93,6 +108,9 @@ def cart(request, *args, **kwargs):
|
||||
"total": total,
|
||||
"base_total": base_total,
|
||||
"tax_total": tax_total,
|
||||
"billing_addresses": billing_addresses,
|
||||
"shipping_addresses": shipping_addresses,
|
||||
"shipping_methods": shipping_methods,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user