When you add an item to the cart, check to see if that item already exists in the cart first, if it does, just add to its existing quantity.
Russ -----Original Message----- From: Will Tomlinson [mailto:[EMAIL PROTECTED] Sent: 23 November 2006 15:36 To: CF-Talk Subject: Cart qty discounts Hey, I have a doozy cart requirement that has arisen. My cart needs the ability to apply qty discounts for a given product. With my prods, I have different SKU's listed for a given prod. i.e. Prod 1007 might have a blu sm, blu med, blu lg, each with its own SKU, etc. I built a quick'n'dirty version that works but it isn't perfect. I just linked up a qty range table to tblProducts. It includes a price for a qty range that can be applied to a product. It works, but it only works for a single sku, because the cart isn't smart'nuff to know that other skus add up to create a total qty for a product. Hope this is makin sense. lol! Anyway, the end problem is as it stands now, the cart can't keep track of qty's for a product. Just qty's for an individual SKU. Example: All Prod 1007 skus might be $55.00. Prod 1007's qty ranges might be: 10-20 = $50.00. 21-30 = $45.00 If someone adds 15 of the 1007.BLU.SM , the cart says it's $50.00 each. Fine, no problem. Then they add 10 of the 1007.BLU.MD, the cart says those are $50.00 each. OOPS! The cart doesn't know that we have another qty of the same product already there. It should be $45.00 each now, since all told, we now have 25 items for this product in the cart, which should get a price of $45.00 each. it can only keep track of the individual SKUS. If we had added 25 of the same item from the start, it woulda calculated things correctly. The cart should be able to calculate up each prod ID's qty's. Then it should query the DB table and get the price for whatever price range the total falls into. It basically should be able to keep track of a prod's total qty's at any given time. Am I thinking right? How would YOU do it? Do you create applyQTYDiscount()? Call it, it works its magic, loops over the cart struct, applying the new updated discount prices for every cart item? Thanks much! Will ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:261581 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

