def cart_summary_table (self): # Returns table innards smry = self.cart_summary() totqty = smry ['totqty'] grandtot = smry ['grandtot'] totweight = smry ['totweight'] return tags.tbody ( tags.tr (tags.th ('Items') + tags.td (totqty)) + tags.tr (tags.th ('Total') + tags.td ('$%.2f' % grandtot)) + tags.tr (tags.th ('Shipping Weight') + tags.td ('%s lbs' % totweight)) + tags.tr (tags.th ('Subtotal (pre-tax)') + tags.td ('$%.2f' % (grandtot+totweight))) + tags.tr (tags.th ('Tax') + tags.td ('TBD')) )
def cart_details (self): totqty, grandtot = self.cart_totals() session = self.session cart = session.get ('cart', None) if not cart: return None table = tags.table ( tags.thead (tags.tr (tags.th ('Line', 'Sku', 'Summary','Notes','Qty','New qty', 'Price', 'Ext'))) + #tags.thead (tags.tr (tags.th ('Line', 'Sku', 'Summary','Qty','New qty', 'Price', 'Ext'))) + tags.treo ( [tags.td (num + 1, line['sku'], line.get ('summary',''), line.get ('notes',''), line['qty'], tags.input (name="updqty", size=3, width=3), # + tags.input (name="ordlin", type='hidden', value=num), '$%.2f' % line['totprice'], '$%.2f' % (line['qty']*line['totprice'])) for num, line in enumerate (cart)] ) + #tags.tfoot (tags.tr (tags.th ('Total for %s items:' % totqty, colspan=7) + tags.th ('$%.2f' % grandtot))), tags.tfoot (tags.tr (tags.th ('Total for %s items:' % totqty, colspan=6) + tags.th ('$%.2f' % grandtot))), d='cart', width='100%') return table