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 are displaying the cart, walk through all of the lines and add or update your discount item. Display the records further down the page and they have magically been updated already. You can use different table formatting for the discount, based on the SKU.Here's my code (lines mutated by e-mail): [lineitems] [HideIf [SKU]~DISC][Math show=F]TotalNet=TotalNet+[Quantity]*[Price][/Math][/HideIf] [ShowIf [SKU]~DISC][RemoveLineItem cart=[cartfromcookie]&index=[LineIndex]][/ShowIf][/lineitems] [AddLineItem cart=[cartfromcookie]&sku=DISC15&db=DISCOUNTS.db]quantity=1&TextA=[Lookup db=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 the subtotal. This need to be displayed each time the cart is viewed. This percentage may be zero and should thus be hidden. I've searched the list archives and I gather the best way to do this is by adding a lineitem in the cart - perhaps an item with a SKU of DISCxxx and negative price. Thinking about this briefly it seems that any time something is added, modified or removed, first the discount lineitem would have to be deleted and then after other changes to the cart, recalculated and added on as the last line item. The cart could then be displayed with the discount incorporated.Can someone pls tell me other tactics/considerations for doing this discount thing 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:

    
  1. Re[2]: Adding discount to cart (jpeacock@univpress.com 2000)
  2. Re: Adding discount to cart (jpeacock@univpress.com 2000)
You've got the logic down just fine. At the top of the page where you are displaying the cart, walk through all of the lines and add or update your discount item. Display the records further down the page and they have magically been updated already. You can use different table formatting for the discount, based on the SKU.Here's my code (lines mutated by e-mail): [lineitems] [HideIf [SKU]~DISC][Math show=F]TotalNet=TotalNet+[Quantity]*[Price][/Math][/HideIf] [ShowIf [SKU]~DISC][RemoveLineItem cart=[cartfromcookie]&index=[LineIndex]][/ShowIf][/lineitems] [AddLineItem cart=[cartfromcookie]&sku=DISC15&db=DISCOUNTS.db]quantity=1&TextA=[Lookup db=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 the subtotal. This need to be displayed each time the cart is viewed. This percentage may be zero and should thus be hidden. I've searched the list archives and I gather the best way to do this is by adding a lineitem in the cart - perhaps an item with a SKU of DISCxxx and negative price. Thinking about this briefly it seems that any time something is added, modified or removed, first the discount lineitem would have to be deleted and then after other changes to the cart, recalculated and added on as the last line item. The cart could then be displayed with the discount incorporated.Can someone pls tell me other tactics/considerations for doing this discount thing 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:

spook tcpconnect? (1999) Re:listfiles-looking for slick solution (1997) RE: New WebCatalog Version !!! (1997) Close-to Comparison Code (1998) Searching multiple Databases (1997) WebCatalog/Mac 2.1b2 New Features (1997) Special characters & [sendmail] (1998) Search returns all, not 20 (1997) Who is doing sign-ups (1998) creator code (1997) WebCat for Unix?? (1997) Public beta 2 for WebCatalog 4.0 is now available. (2000) About to give up (1998) Dates - Search and Sorting (1999) Using WC for Bulk Emailings (1997) [CART] inside a [LOOP] (1997) RE: [WebDNA] [ReturnRaw] problem (2010) Bug? (2000) Grep Ampersands (2008) PIXO (1997)