Ejemplo n.º 1
0
 def add(self, product, quantity=1, update_quantity=False, size=10.0):
     product__id = str(product.pk)
     strsize = str(int(size * 10 + 1000))
     p = product__id + strsize
     t = Product.objects.get(pk=product)
     thumbnail = Product.get_path(t)
     if p not in self.cart:
         self.cart[p] = {
             'quantity': 0,
             'name': product.product_Name,
             'price': str(product.unit_Price),
             'size': str(size),
             'pk': product__id,
             'p': p,
             'thumbnail': thumbnail,
             'description': str(product.product_Description),
         }
     self.cart[p]['quantity'] += 1
     self.save()