Hallo,
Aaron Held hat gesagt: // Aaron Held wrote:
> An easy way is to make the cart a list.
>
> def AddItem(item)
> cart = self.session().value('cart',[])
> cart.append(item)
> self.session.setValue('cart',cart)
>
> def DelItem(item)
> cart = self.session().value('cart',[])
> try:
> cart.remove(item)
> except ValueError:
> print "Item Removed"
> self.session.setValue('cart',cart)
This is fine except that I found a dictonary more appropriate for a
shopping cart. The reason is, that a customer might want to buy more
than one of an item. So I just keep a dictonary with item IDs as keys,
and the item's count as value. So when it comes to the checkout, the
customer can easily change how many of one item he wants.
ciao
--
Frank Barknecht _ ______footils.org__
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss