WORepetition and Cart Functionality
WORepetition and Cart Functionality
- Subject: WORepetition and Cart Functionality
- From: Neil MacLennan <email@hidden>
- Date: Fri, 20 Feb 2009 00:27:33 +0000
Hi there,
In what I imagine to be a common scenario, I have a WORepetition
wrapping products in a shopping cart and displaying them.
A user can alter the quantity of a given product including setting
that quantity to zero == delete this product from my cart.
In my component java file, I look out for this zero quantity and send
a remove message to my cart to delete that product from the cart.
The problem is that in takeValuesFromRequest, WORepetition throws an
NSArray ArrayOutOfBounds Exception because I've removed a product from
the cart and (presumably) it keeps iterating through the cart line
items as it processes the request and comes up one short by the end.
I'm currently working around it by setting the quantity to zero from
the component (rather than removing it) and have added a trimCart()
method to my cart to remove products with a zero quantity after the
takeValuesFromRequest phase has completed.
This seems like a common thing to want to do, have I gone about it the
wrong way initially?
.neilmac
OSX 10.5/WO5.4.2/Eclipse/Wonder
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden