Problem with a shopping cart application using Stripes
posted 8 years ago
I'm trying to implement a simple shopping cart for an e-commerce site I'm building for my wife using Stripes (great framework, by the way), and everything is working fine so far, except for one thing: I can't update the quantity of a particular item once it's been added to the shopping cart.
I can hit the "Add to cart" link again and it will update the quantity, but I also want to be able to type in the exact quantity directly in the quantity field.
The form is populated by iterating thru the items in the cart. I have no problem removing a single item from the cart, but I have no idea how to reference a particular item in the cart (which I suppose is mandatory in order to be able to update said item). Anyone know how to achieve that?
By the way, I'm using a ShoppingCart class that implements a singleton pattern, so the shopping cart can be accessed from any action bean. I added this class as an extension to Stripes.