def cart(request,list_id): cp.setSize(Cart.SMALL) cart = Cart.objects.filter(user=request.session['username'],product=Product.objects.get(pk=list_id),cartAvilable=Cart.Avilable) if cart: if cart.get().SIZE == cp.userDict["size"]: #if we have this product in the same size cart.update(qty = cart.get().qty+1) else: c = Cart(user=request.session['username'], product=Product.objects.get(pk=list_id)) c.save() else: user = Person.objects.get(pk=request.session['username']) c = Cart(user=user, product=Product.objects.get(pk=list_id)) c.save() return redirect('showCart')
def xtralargeSize(request,list_id): cp.setSize(Cart.XTRALARGE) item=Product.objects.get(pk=list_id) price =priceAfterSale(list_id)["price"] return render(request , "productQuickView.html", {'item': item , 'price':price})
def mediumSize(request,list_id): cp.setSize(Cart.MEDIUM ) item=Product.objects.get(pk=list_id) price =priceAfterSale(list_id)["price"] return render(request , "productQuickView.html", {'item': item , 'price':price})