That seems like a reasonable idea... ----- Original Message ----- From: "Matthew Walker" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 7:44 PM Subject: RE: Shopping Cart Opinions
> I've found as Jon pointed out that carts get really complex really fast > and the best idea is to lay down a really strong foundation, i.e. a nice > clean data structure for your cart. What can happen is that every time > you need a shopping cart, you start over because you cut corners on the > last one. > > Personally, I have two. One for very a small shop of simple items with > no options, and one for items with multiple options. > > Regards, > Matthew Walker > /* > Cabbage Tree Creative Ltd > Christchurch - New Zealand > > http://www.matthewwalker.net.nz/ > http://www.cabbagetree.co.nz/ > */ > > -----Original Message----- > From: Michael Tangorre [mailto:[EMAIL PROTECTED]] > Sent: Monday, 29 April 2002 11:35 a.m. > To: CF-Talk > Subject: Re: Shopping Cart Opinions > > > Thanks Jon. > > I will look into your suggestion. Right now, the catalog is set > (remember > this is just a test for me... playing aorund with carts) so I guess it > would > be nice to refer the pieces by through the name... > > thanks for that idea. I will keep playing around. > > Mike > > > ----- Original Message ----- > From: "Jon Hall" <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Sunday, April 28, 2002 7:28 PM > Subject: Re: Shopping Cart Opinions > > > > Are you planning on implementing item options in this cart? Let's say > > you are selling a PC that comes with 128MB, 256MB, or 512MB of RAM > which > > affect the price of the PC. What happens if a person orders 2 PC's > with > > differing amounts of RAM? The product id is the same, but the price is > > different. In a case like this, it's not really using lists that is > the > > problem, it is using the item's ID as the key. > > > > Generally though if I am working with a set data that is complex > enough > > that I want to use a structure, I follow it through all the way. I'd > put > > every piece of data in a structure. I guess this would be as close to > > object oriented as we can get in CF currently... So if I wanted item > > 1002's price, qty, or anything else, I can refer to it by name, with > one > > line of code. Don't be concerned about speed as much as the > cleanliness > > of the logic. Macromedia will take care of that for us :) > > > > cart['1002']['price'] > > cart['1002']['qty'] > > > > jon > > Michael Tangorre wrote: > > > Hi everyone. > > > > > > I have just created a simple shopping cart and wanted to get some > thoughts on my approach to it. > > > > > > I create a structure of lists which is stored in the session scope. > > > > > > 1. cart.quantities > > > 2. cart.prices > > > 3. cart.products > > > > > > Basically every time I (add/remove/changeqty) a product, I go > through > and make changes to the three lists: > > > > > > Example: > > > > > > products list (holds product IDs) 1001, 1002, 1003, 1004 > > > price list (hold price for sinlge product) 5.99, 6.45, 2.50, 8.99 > > > quantity (holds quantity of product added) 2, 4, 1, 1 > > > > > > So basically everytime I perform an operation, I use ListFind to get > the > position in the list of the product whose > > > ID is passed into the page. Using that location of the product in > the > > list, I just perform simple insertions, deletions, and updates using > the > > location. > > > > > > Does anyone see any downsides to this method? > > > I build another cart using arrays, and the execution times for the > templates were considerably longer. > > > > > > Hit me back with some pros and cons or comments. > > > > > > > > > ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm 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

