INFO:
I want to add new form fields to the checkout pages, how would I do that?
Article #:
5020 |
The information in this article applies
to this particular SalesCart Product(s):
STD, PRO, SQL
SYMPTOMS
I would like to add new fields to the checkout pages so that I can collect more information from my visitors. How can I do this? |
CAUSE
This is a database customization. In addition you will have to modify the SQL statement on two pages. Please follow the instructions below.
NOTE: This tutorial is only to inform you that it is in fact possible to modify the cart. Proceed with caution and always Backup your checkoutpage before proceeding. We will not provide support for any modified checkout pages, instead we will restore the page to their original state if we are asked to.
RESOLUTION
1. Open the Shop Database in the fpdb folder
2. Go to the customer table and add two new fields
to it. Call the first field keycode and the second one contactsource.
Note: The field names are case sensitive!
4. Open the details1.asp in the cgi-bin and add the two text box fields to the form.
5. Change the SQL statement on the next page.
The newly added scripting will gather the data from the
details1.asp page and send it to the database. This is the code, the red
part is the additional part!
order = Session("orderid")
subweight = FGetVar("subweight",1,"n")
subsize = FGetVar("subsize",1,"n")
subquantity = FGetVar("subquantity",1,"n")
subtotal= FGetVar("subtotal",1,"n")
subship= FGetVar("subship",1,"n")
subhand= FGetVar("subhand",1,"n")
Keycode = FGetVar("Keycode",1,"n")
Contactsource = FGetVar("Contactsource",1,"n")
6. Add the new fields to
the SQL statement. Notice that if its a text field, then the field must be
surrounded by ' single quotes.
'WRITE STUFF to Database
Dim objSimpleAdo, rstRS, SQLStmt
SQLStmt = "UPDATE DISTINCTROW [customer] "
SQLStmt = SQLStmt & "SET shipfname='" & shipfname & "', "
SQLStmt = SQLStmt & "Keycode='" & Keycode & "', "
SQLStmt = SQLStmt & "Contactsource='" & Contactsource & "', "
SQLStmt = SQLStmt & "password='" & password & "', "
SQLStmt = SQLStmt & "shiplname='" & shiplname & "', "
SQLStmt = SQLStmt & "shipemail='" & shipemail & "', "
SQLStmt = SQLStmt & "shipcompany='" & shipcompany & "', "
SQLStmt = SQLStmt & "shipaddress='" & shipaddress & "', "
SQLStmt = SQLStmt & "shipcity='" & shipcity & "', "
SQLStmt = SQLStmt & "shipstate='" & shipstate & "', "
SQLStmt = SQLStmt & "shipcounty='" & shipcounty & "', "
SQLStmt = SQLStmt & "shipcountry='" & shipcountry & "', "
SQLStmt = SQLStmt & "shipzip='" & shipzip & "', "
SQLStmt = SQLStmt & "shipphone='" & shipphone & "', "
SQLStmt = SQLStmt & "mailinglist='" & mailinglist & "', "
SQLStmt = SQLStmt & "giftmessage='" & giftmessage & "',
"
SQLStmt = SQLStmt & "shipfax='" & shipfax & "' "
SQLStmt = SQLStmt & "WHERE Orderid=" & order & ";" You are all done.
Now test the the pages but placing and order and checking out. Make sure
that the data is stored in the database by checking it.
Good luck, with the customization! |
|