Beispiel #1
0
 def cart_total(self):
     total = 0.0
     for item in self.cart():
         value = item['price']
         value = value * int(item['quantity'])
         total = total + value
     return format_price(total)
Beispiel #2
0
 def cart(self):
     cart = get_cart()
     data = []
     for item in cart:
         info = {}
         product = uuidToObject(item)
         quantity = cart[item]
         info['uuid'] = item
         info['quantity'] = quantity
         if product:
             info['title'] = product.Title()
             info['description'] = product.Description()
             info['image_tag'] = self.image_tag(product)
             info['url'] = product.absolute_url()
             info['price'] = product.price
             info['shipping'] = product.shipping_price
             info['price_pretty'] = format_price(product.price)
             total = int(quantity) * product.price
             info['price_total'] = format_price(total)
         data.append(info)
     return data