Re: Adding discount to cart
This WebDNA talk-list message is from 2000
It keeps the original formatting.
numero = 28851
interpreted = N
texte = You've got the logic down just fine. At the top of the page where you aredisplaying the cart, walk through all of the lines and add or update yourdiscount item. Display the records further down the page and they havemagically been updated already. You can use different table formatting for thediscount, based on the SKU.Here's my code (lines mutated by e-mail):[lineitems] [HideIf [SKU]~DISC][Mathshow=F]TotalNet=TotalNet+[Quantity]*[Price][/Math][/HideIf] [ShowIf [SKU]~DISC][RemoveLineItemcart=[cartfromcookie]&index=[LineIndex]][/ShowIf][/lineitems][AddLineItemcart=[cartfromcookie]&sku=DISC15&db=DISCOUNTS.db]quantity=1&TextA=[Lookupdb=DISCOUNTS.db&lookInField=SKU&value=DISC15&returnField=Description]&password=??????&price=[Math]-1*TotalNet*0.15[Math][/AddLineItem]HTHJohn Peacock____________________Reply Separator____________________Subject: Adding discount to cart Author:
(WebCatalog Talk)Date: 3/10/00 1:29 PMI need to factor in a discount to an order which is a percentage of thesubtotal. This need to be displayed each time the cart is viewed. Thispercentage may be zero and should thus be hidden. I've searched the listarchives and I gather the best way to do this is by adding a lineitem in thecart - perhaps an item with a SKU of DISCxxx and negative price. Thinking aboutthis briefly it seems that any time something is added, modified or removed,first the discount lineitem would have to be deleted and then after otherchanges to the cart, recalculated and added on as the last line item. The cartcould then be displayed with the discount incorporated.Can someone pls tell me other tactics/considerations for doing this discountthing and outline the elegant solutions they've come up with? TIA.-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to
Associated Messages, from the most recent to the oldest:
You've got the logic down just fine. At the top of the page where you aredisplaying the cart, walk through all of the lines and add or update yourdiscount item. Display the records further down the page and they havemagically been updated already. You can use different table formatting for thediscount, based on the SKU.Here's my code (lines mutated by e-mail):[lineitems] [HideIf [SKU]~DISC][Mathshow=F]TotalNet=TotalNet+[Quantity]*[Price][/Math][/HideIf] [ShowIf [SKU]~DISC][RemoveLineItemcart=[cartfromcookie]&index=[LineIndex]][/ShowIf][/lineitems][AddLineItemcart=[cartfromcookie]&sku=DISC15&db=DISCOUNTS.db]quantity=1&TextA=[Lookupdb=DISCOUNTS.db&lookInField=SKU&value=DISC15&returnField=Description]&password=??????&price=[math]-1*TotalNet*0.15[math][/AddLineItem]HTHJohn Peacock____________________Reply Separator____________________Subject: Adding discount to cart Author: (WebCatalog Talk)Date: 3/10/00 1:29 PMI need to factor in a discount to an order which is a percentage of thesubtotal. This need to be displayed each time the cart is viewed. Thispercentage may be zero and should thus be hidden. I've searched the listarchives and I gather the best way to do this is by adding a lineitem in thecart - perhaps an item with a SKU of DISCxxx and negative price. Thinking aboutthis briefly it seems that any time something is added, modified or removed,first the discount lineitem would have to be deleted and then after otherchanges to the cart, recalculated and added on as the last line item. The cartcould then be displayed with the discount incorporated.Can someone pls tell me other tactics/considerations for doing this discountthing and outline the elegant solutions they've come up with? TIA.-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to
jpeacock@univpress.com
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Max Record length restated as maybe bug (1997)
Apache on windows and WebDNA (2004)
[WebDNA] 301 redirect (2016)
Multiple cart additions (1997)
[WebDNA] Funding for a new v7+ commerce system? (2011)
Credit Card Checking?? (1998)
Search and list the titles of book (2003)
[WebDNA] Append speed limits (2008)
[ShowNext] (2007)
[GROUPS] followup (1997)
Protect Tag and Groups (1998)
AmEx, shipping (2000)
year 2000 + and webmerch, macauth? (1998)
Possible Bug in 2.0b15.acgi (1997)
Sun doesn't have an emailer app? (2000)
Can't use old cart file (was One more try) (1997)
[WebDNA] cron - curl to replace triggers.. (2009)
iTools 7 instructions for 5.1? (2003)
Signal Raised (1997)
Friendly , quick 'security' check, please (2003)