944,188 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 1279
  • ASP RSS
Oct 27th, 2009
0

Having trouble getting Grand Total with shopping cart web page

Expand Post »
I am trying to get a grand total from a shopping cart page and am not sure how to do that. I have the total that loops through each section but I want to display the grand total from all of those sections at the bottom of the page. Can someone offer assistance on how to do this. Here is my code:

ASP Syntax (Toggle Plain Text)
  1. dim totalPrice(20) //The total price on any given subform //CONFIG - change this to the maximum number of product types you ever expect to have.
  2. dim iQtys(20, 50) //CONFIG - Change this to the maximum number of items you ever expect to have on one order form.
  3. dim emailTo, emailFrom, emailSubject
  4. dim grandTotal(20)
  5.  
  6. if Request.Form("btnCalculate.x") <> 0 or Request.Form("btnCalculate.y") <> 0 then
  7. isPostback = 1 'cInt(Request.Form("btnCalculate"))
  8.  
  9.  
  10. for iCntr2 = 1 to Request.Form("NumForms")
  11.  
  12. for iCntr = 1 to Request.Form("NumElements" & iCntr2)
  13.  
  14. iQtys(iCntr2, iCntr) = CInt(Request.Form("Qty" & iCntr2 & "_" & iCntr))
  15. totalPrice(iCntr2) = totalPrice(iCntr2) + (Ccur(Request.Form("UnitPrice" & iCntr2 & "_" & iCntr)) * CInt(Request.Form("Qty" & iCntr2 & "_" & iCntr)))
  16.  
  17. next
  18.  
  19. next
  20.  
  21.  
  22. end if
  23.  
  24. totalPrice(iCntr2) = totalPrice(iCntr2) + (Ccur(Request.Form("UnitPrice" & iCntr2 & "_" & iCntr)) * CInt(Request.Form("Qty" & iCntr2 & "_" & iCntr)))
  25.  
  26. Response.write "<TR><TD align=left colspan=" & oProdInstances.Fields.Count - 2 & ">Grand Total: " & FormatCurrency(grandTotal(iForm), 2) & "</TD>"
Similar Threads
Reputation Points: 9
Solved Threads: 0
Light Poster
mldardy is offline Offline
32 posts
since Oct 2009
Oct 27th, 2009
0
Re: Having trouble getting Grand Total with shopping cart web page
Anyone with any ideas
Reputation Points: 9
Solved Threads: 0
Light Poster
mldardy is offline Offline
32 posts
since Oct 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: SQL Injection Attacks
Next Thread in ASP Forum Timeline: ASP Error





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC