Yes, I had considered a base coupon class with a subclass for each coupon type. But being new to OOP, I get stuck at implementing the classes. Would I put coupon instances into a coupon struct in the shopping cart and then iterate over them when I call a calcTotal method? If so, how would I then apply the single item coupon to the correct item? I was thinking it might be more appropriate to put the single-item coupon in the corresponding CartItem object, but then I don't think this would work for multiple-item coupons (i.e. buy one, get 2nd at NN% off), or would it? Thanks for the advice. Jim McMullen Devlab, Inc. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Micha Schopman Sent: Wednesday, March 23, 2005 10:10 AM To: [email protected] Subject: RE: [CFCDev] Help with OO Model for Shopping Cart
I'd personally model the coupon as a separate object, and maybe extending a default discount object. The discount object is always calculated on checkout and this enables you to do multiple discount types using inheritance. Not only coupons, but also customer specific discounts. Micha Schopman Project Manager Modern Media, Databankweg 12 M, 3821 AL Amersfoort Tel 033-4535377, Fax 033-4535388 KvK Amersfoort 39081679, Rabo 39.48.05.380 ---------------------------------------------------------------------------- ------------------------------------------------------------------------- Modern Media, Making You Interact Smarter. Onze oplossingen verbeteren de interactie met uw doelgroep. Wilt u meer omzet, lagere kosten of een beter service niveau? Voor meer informatie zie www.modernmedia.nl ---------------------------------------------------------------------------- ------------------------------------------------------------------------- _____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim McMullen Sent: woensdag 23 maart 2005 15:58 To: [email protected] Subject: [CFCDev] Help with OO Model for Shopping Cart I have a typical CFC-based shopping cart (ShoppingCart object holds a struct of CartItem objects). This works well and I have no real problem with it. However, I now need to implement a pretty robust coupon/discount functionality into the app, and I can't seem to figure out how to do it. I need to allow for four types of coupons: (1) Whole order coupon (NN% off entire order) (2) Single item coupon (NN% off this item) (3) Multiple item coupon (buy one (or two), get the 2nd (or third) NN% off) (4) Free item coupon (buy this item, get a free toaster) I think I can figure out how to model a single coupon type, but as I'm an OOP newb, figuring out how to model and implement the whole range has got my head spinning. Can anyone point me in the right direction? Jim McMullen Devlab, Inc. ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
<<attachment: winmail.dat>>
