iisCART Documentation | ![]() |
iisCART BILLING.ASP |
Billing.asp Source |
<%response.buffer = true%> <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Developer Studio"> <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"> <TITLE>Secure Billing</TITLE> </HEAD> <body link="#000000" bgcolor="#57C4D2" vlink="#000000" alink="#FFFFFF"> <% Sub SendEmail( ) Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = "mail.yourmailserver.com" Mail.From = "address@email.com" Mail.FromName = "iisCART Demo Store" Mail.Subject = "iisCART Demo Store Receipt" s = "Thank you for using iisCART" & vblf & vblf s = s & "Order ID: " & Session("Cart").OrderID & vblf & vblf For Each Item in Session("Cart").Items s = s & "Item: " & Item.Name & vblf & "Quantity: " & Item.Quantity & vblf & "Price: " & formatcurrency(Item.Price) & vblf & vblf Next s = s & "Taxes: " & formatcurrency(Session("Cart").Tax) & vblf s = s & "Shipping: " & formatcurrency(Session("Cart").Shipping) & vblf s = s & "Total: " & formatcurrency(Session("Cart").Total) & vblf & vblf s = s & "Thank you for using the iisCART demo store." Mail.Body = s if len(Session("Cart").Info.ShipEmail) <> 0 then Mail.AddAddress Session("Cart").Info.ShipEmail sendtrue = 1 end if if len(Session("Cart").Info.Email) <> 0 and (Session("Cart").Info.Email <> Session("Cart").Info.ShipEmail) then Mail.AddAddress Session("Cart").Info.Email sendtrue = 1 end if if sendtrue = 1 then Call Mail.Send ' send to buyer end if Mail.Reset 'internal notification, send to fulfillment Mail.AddAddress "address@email.com" Call Mail.Send ' send to self End Sub Set Cart = Session("Cart") Cart.LoadOrder If Request("SAVE") <> "" Then ErrString = Cart.AcceptBillingInfo If ErrString = "" Then Cart.SaveBillingInfo 'call SendEmail 'don't uncomment the SendEmail subroutine listed above until you 'set the mail information (e.g. mail host, address etc.) response.redirect "thankyou.asp" End If End If %> <%' Put custom validation here %> <% If ErrString <> "" Then %> <FONT COLOR="#FF0000" FACE="Tahoma" SIZE=5>The following fields are required: <% = ErrString %></FONT> <% End If %> <H1>Enter Billing Info:</H1> <FORM METHOD=POST ACTION="Billing.asp" name="Billing"> <TABLE CELLPADDING=0> <TR><TD>Name *</TD><TD><INPUT TYPE=TEXT NAME=NAME VALUE="<% = Cart.Info.Name %>"></TD></TR> <TR><TD>Company</TD><TD><INPUT TYPE=TEXT NAME=COMPANY VALUE="<% = Cart.Info.Company %>"></TD></TR> <TR><TD>Address 1 *</TD><TD><INPUT TYPE=TEXT NAME=ADDRESS1 VALUE="<% = Cart.Info.Address1 %>"></TD></TR> <TR><TD>Address 2</TD><TD><INPUT TYPE=TEXT NAME=ADDRESS2 VALUE="<% = Cart.Info.Address2 %>"></TD></TR> <TR><TD>Address 3</TD><TD><INPUT TYPE=TEXT NAME=ADDRESS3 VALUE="<% = Cart.Info.Address3 %>"></TD></TR> <TR><TD>City *</TD><TD><INPUT TYPE=TEXT NAME=CITY VALUE="<% = Cart.Info.City %>"></TD></TR> <TR><TD>State/Province</TD><TD><INPUT TYPE=TEXT NAME=STATEPROVINCE VALUE="<% = Cart.Info.StateProvince %>"></TD></TR> <TR><TD>Zip/Postal *</TD><TD><INPUT TYPE=TEXT NAME=ZIPPOSTAL VALUE="<% = Cart.Info.ZipPostal %>"></TD></TR> <TR><TD>Country *</TD><TD><INPUT TYPE=TEXT NAME=COUNTRY VALUE="<% = Cart.Info.Country %>"></TD></TR> <TR><TD>Email</TD><TD><INPUT TYPE=TEXT NAME=EMAIL VALUE="<% = Cart.Info.Email %>"></TD></TR> <TR><TD>Payment Type</TD><TD><SELECT NAME=PAYMENTTYPE> <OPTION VALUE="Credit Card" <% If Cart.Info.PaymentType = "Credit Card" Then Response.Write "SELECTED" %>>Credit Card <OPTION VALUE="Personal Check" <% If Cart.Info.PaymentType = "Personal Check" Then Response.Write "SELECTED" %>>Personal Check <OPTION VALUE="Money Order" <% If Cart.Info.PaymentType = "Money Order" Then Response.Write "SELECTED" %>>Money Order </SELECT> </TD></TR> </TABLE> <P> <TABLE> <TD>Credit Card Type *: </TD> <TD><SELECT NAME=CCTYPE> <OPTION VALUE=Visa <% If Cart.Info.CCType = "Visa" Then Response.Write "SELECTED" %>>Visa <OPTION VALUE=Mastercard <% If Cart.Info.CCType = "Mastercard" Then Response.Write "SELECTED" %>>MasterCard <OPTION VALUE="American Express" <% If Cart.Info.CCType = "American Express" Then Response.Write "SELECTED" %>>American Express </SELECT> </TD><TR> <TD>Amount:</TD><TD><% = Cart.Total %></TD><TR> <TD>Credit Cart Number *: </TD> <TD><INPUT TYPE=TEXT NAME="CCNUMBER" VALUE="<% = Cart.Info.CCNumber %>"></TD><TR> <TD>Expires *: </TD> <TD><SELECT NAME=CCMONTH> <OPTION VALUE=0>--Select Expiration Month-- <OPTION VALUE=1 <% If Cart.Info.CCMonth = 1 Then Response.Write "SELECTED" %>>January <OPTION VALUE=2 <% If Cart.Info.CCMonth = 2 Then Response.Write "SELECTED" %>>Febuary <OPTION VALUE=3 <% If Cart.Info.CCMonth = 3 Then Response.Write "SELECTED" %>>March <OPTION VALUE=4 <% If Cart.Info.CCMonth = 4 Then Response.Write "SELECTED" %>>April <OPTION VALUE=5 <% If Cart.Info.CCMonth = 1 Then Response.Write "SELECTED" %>>May <OPTION VALUE=6 <% If Cart.Info.CCMonth = 2 Then Response.Write "SELECTED" %>>June <OPTION VALUE=7 <% If Cart.Info.CCMonth = 3 Then Response.Write "SELECTED" %>>July <OPTION VALUE=8 <% If Cart.Info.CCMonth = 4 Then Response.Write "SELECTED" %>>August <OPTION VALUE=9 <% If Cart.Info.CCMonth = 1 Then Response.Write "SELECTED" %>>September <OPTION VALUE=10 <% If Cart.Info.CCMonth = 2 Then Response.Write "SELECTED" %>>October <OPTION VALUE=11 <% If Cart.Info.CCMonth = 3 Then Response.Write "SELECTED" %>>November <OPTION VALUE=12 <% If Cart.Info.CCMonth = 4 Then Response.Write "SELECTED" %>>December </SELECT> <SELECT NAME=CCYEAR> <OPTION VALUE=0>--Select Expiration Year-- <OPTION VALUE=1999 <% If Cart.Info.CCYear = 1999 Then Response.Write "SELECTED" %>>1999 <OPTION VALUE=2000 <% If Cart.Info.CCYear = 2000 Then Response.Write "SELECTED" %>>2000 <OPTION VALUE=2001 <% If Cart.Info.CCYear = 2001 Then Response.Write "SELECTED" %>>2001 <OPTION VALUE=2002 <% If Cart.Info.CCYear = 1998 Then Response.Write "SELECTED" %>>2002 <OPTION VALUE=2003 <% If Cart.Info.CCYear = 1999 Then Response.Write "SELECTED" %>>2003 <OPTION VALUE=2004 <% If Cart.Info.CCYear = 2000 Then Response.Write "SELECTED" %>>2004 <OPTION VALUE=2006 <% If Cart.Info.CCYear = 2001 Then Response.Write "SELECTED" %>>2005 </SELECT> </TD> <TR> <TD>Name on the Card *: </TD> <TD><INPUT TYPE=TEXT NAME="CCName" VALUE="<% = Cart.Info.CCName %>"></TD><TR> <TD>Phone Number *: </TD> <TD><INPUT TYPE=TEXT NAME="PHONE" VALUE="<% = Cart.Info.Phone %>"></TD><TR> </TABLE> <INPUT TYPE=SUBMIT NAME=SAVE VALUE="Save Info"> </FORM> </BODY> </HTML> |
Methods / Properties / Objects used: |
Cart.LoadOrder Cart.SaveBillingInfo Cart.SendEmail Cart.Info |
Description / Comments: |
billing.asp loads the cart data. It then collects billing information and saves it to the database. Optionally, the CC module is integrated at this point. This file includes ASP script (SendEmail sub-routine) that creates and sends a custom receipt by building up a string with items and info collections. This demonstrates the power of accessing cart data programmatically with ASP. Of course, you can just make use of the same code with no additional development needed but make sure to set the correct email addresses and your SMTP mail host. |
© Corporate Web Solutions 1998, 1999. | ![]() |