diff --git a/commerce/interfaces.py b/commerce/interfaces.py index 8ced6c9..802b071 100644 --- a/commerce/interfaces.py +++ b/commerce/interfaces.py @@ -1,6 +1,6 @@ #-*- coding: UTF-8 -*- # -# Copyright (c) 2012 Helmut Merz helmutm@cy55.de +# Copyright (c) 2015 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -408,12 +408,13 @@ class IOrderItem(ITrack): shop = Attribute(u'The shop from which the product is ordered.') order = Attribute(u'The order this order item belongs to.') unitPrice = Attribute(u'The basic unit price for one of the product ' - u'items ordered.') + u'ites ordered.') fullPrice = Attribute(u'The full price for the quantity ordered.') quantityShipped = Attribute(u'The total quantity that has been shipped ' u'already.') shippingInfo = Attribute(u'A list of mappings, with fields like: ' u'shippingId, shippingDate, quantity, packageId') + options = Attribute(u'Product options associated with this order item.') def remove(): """ Remove the order item from the order or cart. diff --git a/commerce/order.py b/commerce/order.py index 66732e7..1c66618 100644 --- a/commerce/order.py +++ b/commerce/order.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Helmut Merz helmutm@cy55.de +# Copyright (c) 2015 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,8 +18,6 @@ """ Order and order item classes. - -$Id$ """ from zope.app.intid.interfaces import IIntIds @@ -118,7 +116,10 @@ class OrderItems(object): def add(self, product, party, shop, order='???', run=0, **kw): kw['shop'] = self.getUid(shop) + options = kw.get('options', []) existing = self.getCart(party, order, shop, run, product=product) + existing = [item for item in existing + if (item.data.get('options') or []) == options] if existing: track = existing[-1] track.modify(track.quantity + kw.get('quantity', 1))