From cdb02cba0bfcd6d2283e6e07f1eac4e78e0d225a Mon Sep 17 00:00:00 2001 From: spacenergy Date: Wed, 2 Mar 2016 10:07:42 +0600 Subject: [PATCH] auto --- store/cart.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/store/cart.py b/store/cart.py index f6d35fc..0ec3403 100644 --- a/store/cart.py +++ b/store/cart.py @@ -5,11 +5,11 @@ import uuid class CartItem(object): subtotal = 0 - def __init__(self, item_variant, count, id=None): + def __init__(self, item_variant, count, id=None, request=None): self.item = item_variant - self.price = int(item_variant.get_price()) + self.price = int(item_variant.get_price(request.user)) self.count = int(count) - self.subtotal = self.get_price() * self.count + self.subtotal = self.get_price(request.user) * self.count if not id: self.id = str(uuid.uuid4()) @@ -49,7 +49,7 @@ class Cart(object): pass if variation: item = CartItem( - variation, j['count'], j['id']) + variation, j['count'], j['id'], request=self.request) self.items.append(item) self.total += int(item.subtotal) self.weight += variation.weight * j['count'] @@ -97,7 +97,7 @@ class Cart(object): if item.count != request_count: self.total -= item.subtotal item.count = request_count - item.subtotal = item.get_price() * item.count + item.subtotal = item.get_price(self.request) * item.count self.total += item.subtotal self.serialize_items()