thanx for your help Mark. 1) so I'm calling the method wrong? or not invoking the component correctly?
2) >> A shopping cart should only manage the shopping cart. It shouldn't look at if it exists or not. yes good point but I was trying to tie the storage of cart data totally into the CFC. IMHO only the CFC should care how the cart data is stored and not be dependant on other files. The CFC becomes the data store interface. If the chosen storage doesn't exist, create it. a later aim it to be able to replace the session struct with something else (cookie, temp db table, etc) with only mods needed to the CFC - nowhere else needed. barry.b -----Original Message----- From: Mark M [mailto:[EMAIL PROTECTED] Sent: Monday, 29 September 2003 11:18 AM To: CFAussie Mailing List Subject: [cfaussie] Re: CFC error: "Method selection Exception" (was: Shopping carts: Arr ays Vs Structs) Took me a while to look at it - but I got it now. > <cfinvoke component="cart2" method="get" > returnvariable="objCart"></cfinvoke> > > <cfif isDefined("URL.AddToCart")> > <cfset sucess = objCart.AddToCart(URL.idProduct, URL.qty)> > </cfif> If you look at this code - returnVariable 'objCart' is the retun out from createCart - which is just a struct.. and not an instance of the CFC at all. hence when you call the method on objCart - the error occurs. Personally - I would have handled the creation/maintenance of the session.cart instance in the application.cfm, and not had the CFC even look at the session scope. Remember - proper OOA/OOD - good cohesion states that an Object should have a singular task. A shopping cart should only manage the shopping cart. It shouldn't look at if it exists or not. JMHO. Mark ----------------------------------- [EMAIL PROTECTED] ICQ: 3094740 Safe From Bees [www.safefrombees.com] --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/
