Example #1
0
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')
Example #2
0
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})
Example #3
0
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})