A really good lesson on creating shopping carts is found in Ben Forta's book ColdFusion Web Application Construction Kit (better known as CFWACK) or at least it was in the last edition I read. I'm assuming he still has it in there.
It covers the basics of creating a shopping cart, how to do the manipulations you're going to want to do - add an item, change quantities, delete an item, checkout etc. And also some other things you might want to add to your shopping cart to make it better for your application. Since reading that a few years ago, I've been quite confident in custom building shopping carts for a number of sites, knowing I have all the principles covered and including some nice enhancements that suited the particular sites I was building for. You can pay $300 upwards for a ready-made shopping cart, but for less than that, and a few hours learning, you can get Ben's book, read up on shopping carts, and be equipped to make your own any time it's needed. The actual shopping carts are pretty much the same. The differences between one commercial shopping cart and another are largely in the backend admin - managing orders, fulfilling orders and creating invoices, doing reports, that kind of thing. The actual process of letting users navigate around your site and pop goods into their cart is fairly straightforward and nearly always the same from one site to another. Cheers Mike Kear Windsor, NSW, Australia Adobe Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion 9 Enterprise, PHP, ASP, ASP.NET hosting from AUD$15/month On Wed, Jun 23, 2010 at 5:35 PM, Steve Onnis <st...@cfcentral.com.au> wrote: > Claude > > > > 1) ArrayNew() takes 1 argument being the dimension of the array so > you need to say ArrayNew(1) > > 2) You are setting session.cart to the string of “arrayNew()” so you > cant append the cart item because arrayNew(0 is a string, not an array so > you need > > <cfparam name=”session.cart”, default=”#Arraynew(1)# /> > > 3) If your cart item keys are the same as your form fields you can > just do > <cfset arrayAppend(session.cart, duplicate(FORM)) /> > > Just saves on code but if you have lots of fields in your form you don’t > need then maybe setting them manually as you have done may be better. > > > > > > Steve > > > > *From:* rai...@ozemail.com.au [mailto:rai...@ozemail.com.au] > *Sent:* Monday, 21 June 2010 11:40 PM > > *To:* cfaussie@googlegroups.com; coldfusion-ho...@yahoogroups.com > *Subject:* [cfaussie] Trying To Create A Basic Shopping Cart > > > > Hi > > > > I am trying my hand at a basic shopping cart > > > > I have found an example online that uses the following code > > > > <cfparam name="session.cart" default="arrayNew()"> > > <cfset session.cart = arrayAppend( session.cart, structNew() )> > > <cfset thisCartItem = arraylen( session.cart )> > > <cfset session.cart[thisCartItem].itemID = form.itemID> > > <cfset session.cart[thisCartItem].quantity = form.quantity> > > <cfset session.cart[thisCartItem].itemName = form.itemName> > > > > > > However the code generates the following error message: > > > > *Object of type class java.lang.String cannot be used as an array * > > > > > > If someone would like to advise where the above code is causing the error > message I would be grateful > > Regards > > Claude Raiola (B.Econ Acc; B.Hot. Mngt) > Samaris Software > Email: i...@samaris.net <i...@trackingcentral.om.au> > Website: www.SAMARIS.net <http://www.TrackingCentral.com.au> > Mobile: 0414 228 948 > > > > -- > You received this message because you are subscribed to the Google Groups > "cfaussie" group. > To post to this group, send email to cfaus...@googlegroups.com. > To unsubscribe from this group, send email to > cfaussie+unsubscr...@googlegroups.com<cfaussie%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/cfaussie?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "cfaussie" group. > To post to this group, send email to cfaus...@googlegroups.com. > To unsubscribe from this group, send email to > cfaussie+unsubscr...@googlegroups.com<cfaussie%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/cfaussie?hl=en. > -- -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaus...@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.