Welcome to OpenBD! Some general comments inline below. On Mon, Nov 30, 2009 at 3:06 PM, Scott <[email protected]> wrote:
> I’ve searched Google for tutorials but haven’t really found too many for > shopping carts in ColdFusion, almost none in fact. The ones I do find use > CF5 style of coding, no cfc’s. I’m hoping that someone will be able to > offer some advice. > In general, shopping carts themselves are terribly complicated. There are various ways to approach things but in general if you want to go with an OO approach (which I highly recommend), you'd have a shopping cart object you'd store (most likely) in the session scope and depending on your needs you can either save the cart contents to a database or make it only last for the length of the session. So you'd have a shopping cart object (CFC), and in that object you could have product objects with various attributes representing the items in the cart. > One question I have is it better to build the order as a structure object > with nested structures inside for the item modifiers (add mayo, no lettuce) > or a xml file on the server and add and remove items to it as the order is > built? Any advice on where I can get more info about cart structure and > order manipulation would be very helpful. > Sadly you probably will find more examples of shopping carts written in other languages, so you might study ones you can find written in PHP or Java just to get a handle on the basic concepts. As far as items with attributes, you could do this with CFCs to represent products, or basic structs can be useful as well. Depending on how complex your products are you might wind up with a product CFC that has the basic metadata about a product, and a collection of attributes to define configurable details about the product. I personally wouldn't write things out to a file as you go unless you have a specific need to do that--if you want to persist beyond the length of the session just store things in a database so you can reconstruct the cart when the user comes back. Hope that at least gets you going--this is kind of a big topic but keep asking questions as you need and we'll walk you through things as best we can! Matt -- Matthew Woodward [email protected] http://mpwoodward.posterous.com identi.ca/Twitter: @mpwoodward Please do not send me proprietary file formats such as Word, PowerPoint, etc. as attachments. http://www.gnu.org/philosophy/no-word-attachments.html -- Open BlueDragon Public Mailing List http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon mailing list - http://groups.google.com/group/openbd?hl=en !! save a network - please trim replies before posting !!
