• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WORepetition and Cart Functionality
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WORepetition and Cart Functionality


  • Subject: Re: WORepetition and Cart Functionality
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 19 Feb 2009 17:28:38 -0800


On Feb 19, 2009, at 4:27 PM, Neil MacLennan wrote:

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?


That is a pretty common problem as WO maintains page state on the server. There are several ways of handling this, most based on delaying the action until after takeValues. Chapter 7 of Practical WebObjects covers this problem and how to deal with it.

Chuck

--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







_______________________________________________ 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
  • Follow-Ups:
    • Re: WORepetition and Cart Functionality
      • From: Neil MacLennan <email@hidden>
References: 
 >WORepetition and Cart Functionality (From: Neil MacLennan <email@hidden>)

  • Prev by Date: Re: WO/Wonder and Java 6 as a deployment environment?
  • Next by Date: WO5.4.3 + Axis1.4 problem on deployment
  • Previous by thread: WORepetition and Cart Functionality
  • Next by thread: Re: WORepetition and Cart Functionality
  • Index(es):
    • Date
    • Thread