def createLineItem(self, data): parent = self.aq_parent utility = getUtility( IShoppingCartUtility ) cart = utility.get(parent, create=True) intids = getUtility(IIntIds) iid = intids.queryId(parent) if iid is None: iid = intids.register(parent) nitem = PayableLineItem() nitem.item_id = parent.UID() # archetypes uid nitem.uid = iid # copy over information regarding the item nitem.name = "Supplemental Pharmacy Application" nitem.description = "Supplemental Pharmacy Application 2011" nitem.cost = float(self.price) nitem.quantity = 1 nitem.product_code = nitem.item_id nitem.data = data # add to cart if nitem.item_id not in cart.keys(): cart[nitem.item_id] = nitem cart.last_item = nitem.item_id
def createLineItem(self, data): parent = self.aq_parent utility = getUtility( IShoppingCartUtility ) cart = utility.get(parent, create=True) intids = getUtility(IIntIds) iid = intids.queryId(parent) if iid is None: iid = intids.register(parent) nitem = PayableLineItem() nitem.item_id = parent.UID() # archetypes uid nitem.uid = iid # copy over information regarding the item nitem.name = self.title nitem.description = self.description nitem.cost = float(self.price) nitem.quantity = 1 try: nitem.quantity = int(data['quantity']) except: nitem.quantity = 1 nitem.product_code = nitem.item_id nitem.data = data #pdb.set_trace() # add to cart if nitem.item_id not in cart.keys(): cart[nitem.item_id] = nitem cart.last_item = nitem.item_id