Hey Jim, Did you figure it out? I was a bit suspicious that you might be having a problem with the way structures copy by reference. In some cases, they copy the reference or pointer of the object instead of the actual object. If you dont know what I'm talking about, halhelms.com has a good tutorial on it. If you do and have it covered, then disregard. Goodluck. DRE
-----Original Message----- From: Jim McAtee [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 26, 2001 6:22 PM To: CF-Talk Subject: Re: Pulling My Hair Out (a shopping cart question) ----- Original Message ----- From: "Owens, Howard" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Wednesday, December 26, 2001 5:36 PM Subject: Pulling My Hair Out (a shopping cart question) > <cflock timeout="#createtimespan(0,0,30,0)#" > name="#session.sessionID#" > type="EXCLUSIVE"> A cflock timeout value is specified in seconds. Using CreateTimeSpan() with 30 minutes gives you a CF date/time object of 1/48th, or 0.625. Just specify a whole number of seconds. I've never really seen a guide to determining intelligent cflock timeout values, so I just use something like 5 or 10 seconds. > session.cart = ArrayNew(1); > session.item = StructNew(); > session.item.PRODUCT_ID = 0; > session.item.NAME = "#FindItem.SONG_TITLE#"; > session.item.DESCRIPTION = "#FindItem.ARTIST_FIRST_NAME# > #FindItem.ARTIST_LAST_NAME#"; > session.item.QUANTITY = 1; > session.item.PRICE = "#request.songprice#"; > session.item.ITEMTOTAL = "3"; > session.item.SONG_ID = "#FindItem.SONG_ID#"; In this block of code, session.item is just used as a temporary variable, so create it in the variables (or the request) scope. As a rule, you should minimize the amount of code encapsulated by a cflock, so this would help toward that goal, since you can create and define the struct outside of the lock. > > session.CartItems = ArrayAppend(session.cart, session.item); > Could this be the source of the problems you're having? Did you mean to do this, or do you mean: session.cart = ArrayAppend(session.cart, session.item); Simplified, the code becomes something like: <cfscript> item = StructNew(); item.PRODUCT_ID = 0; item.NAME = "#FindItem.SONG_TITLE#"; item.DESCRIPTION = "#FindItem.ARTIST_FIRST_NAME# #FindItem.ARTIST_LAST_NAME#"; item.QUANTITY = 1; item.PRICE = "#request.songprice#"; item.ITEMTOTAL = "3"; item.SONG_ID = "#FindItem.SONG_ID#"; </cfscript> <cflock name="#session.sessionID#" type="EXCLUSIVE" timeout="5"> <!--- If no shopping cart exists, create one ---> <cfparam name="session.newcart" default="no"> <cfif session.newcart is "no"> <cfset session.cart = ArrayNew(1)> <cfset session.newcart = "yes"> </cfif> <!--- Add item to the cart ---> <cfset session.cart = ArrayAppend(session.cart, item)> </cflock> Jim ______________________________________________________________________ Why Share? Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation � $99/Month � Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

