%
If getconfig("xIncludeCountries")="Yes" Then
%>
<%
End if
If getconfig("xIncludeStates")="Yes" Then
%>
<%
End if
If getconfig("xvatnumber")="Yes" Then
%>
<%
End if
Sub ShopCustomerForm
'*******************************************************************
' Customer form used in many places
' CreateCustRow is in shop$colors.asp
' Version 5.00 April 5, 2003
' ShippingOtherfields
'********************************************************************
Response.Write(TableDef)
CreateCustRow getlang("langCustFirstname"), "strfirstname", strFirstname,"Yes"
CreateCustRow getlang("langCustLastname"), "strLastname", strLastname,"Yes"
CreateCustRow getlang("langCustAddress"), "strAddress", strAddress,"Yes"
CreateCustRow getlang("langCustCity"), "strCity", strCity,"Yes"
If getconfig("xPromptForState")="Yes" then
If getconfig("xIncludeStates")="Yes" Then
Response.Write(tableRow & tablecolumn & "* " & getlang("langCustState") & tablecolumnend & "
")
else
CreateCustRow getlang("langCustState"), "strState", strState,"Yes"
end if
end if
CreateCustRow getlang("langCustPostCode"), "StrPostcode", strPostCode,"Yes"
CreateCustRow getlang("langCustPhone"),"strPhone", strPhone, "Yes"
CreateCustRow getlang("langCustEmail"), "strEmail", strEmail, "Yes"
If getconfig("xPromptForCountry")="Yes" then
if strcountry="" and getconfig("xdefaultcountry")<>"" then
strcountry=getconfig("xdefaultcountry")
end if
If getconfig("xIncludeCountries")="Yes" Then
If getconfig("xCountryRequired")="Yes" then
Response.Write(tableRow & tablecolumn & "* " & getlang("langCustCountry") & tablecolumnend & "
")
End if
ShopCountries "StrCountry", strCountry
Response.Write("
")
else
If getconfig("xCountryRequired")="Yes" then
CreateCustRow getlang("langCustCountry"), "strCountry", strCountry,"Yes"
Else
CreateCustRow getlang("langCustCountry"), "strCountry", strCountry,"No"
End if
end if
end if
CreateCustRow getlang("langCustCompany"), "strCompany", strCompany,"No"
If getconfig("xvatnumber")="Yes" then
CreateCustRow getlang("langVatnumber"),"vatnumber", strvatnumber,"No"
end if
AddOtherFields
AddPassword
Response.Write(TableDefEnd)
AddCookieMessage
AddMaillIst
AddHowDidYouHear
end sub
'
Sub AddPassword
if getconfig("xpassword")="Yes" then
If GetSess("Login")="" then
Response.Write("
")
end if
AddPasswordForm "Yes"
end if
end sub
Sub AddPasswordForm (yesno)
If Getconfig("Xcustomeruserid")="Yes" then
CreateCustRow getlang("langadminusername"), "strcustuserid", strcustuserid,Yesno
end if
CreateCustRowP getlang("langPassword"), "strpassword1", strpassword1,Yesno
CreateCustRowP getlang("langPassword"), "strpassword2", strpassword2,Yesno
end sub
Sub ShopShippingForm
'on error resume next
Response.Write(TableDef)
If getconfig("xShippingDatabaseRecords")="Yes" then
If GetSess("Shipmethodtype")="" and getconfig("xDefaultShippingMethod")<>"Yes" then
shipmethodtype=getlang("langCommonSelect")
end if
Response.Write(tableRow & tablecolumn & "* " & getlang("langShippingMethod") & tablecolumnend & "
")
else
CreateCustRow getlang("langCustState"),"shipstate",strshipstate,"No"
end if
end if
CreateCustRow getlang("langCustPostCode"),"shipzip", strshipzip,"No"
If getconfig("xPromptForCountry")="Yes" then
If getconfig("xIncludeCountries")="Yes" Then
Response.Write(tableRow & tablecolumn & getlang("langCustCountry") & tablecolumnend & "
")
else
CreateCustRow getlang("langCustCountry"), "shipcountry", strshipCountry,"No"
end if
end if
CreateCustRow getlang("langCustCompany"), "shipcompany", strshipcompany,"No"
ShippingAddOtherFields
Response.Write(TableDefEnd)
' end if shipping table
end sub
Sub AddMailList
If getconfig("XmailListCheckBox")<>"Yes" then exit sub
Response.Write(TableDef)
Response.Write tablerow
Response.write TableColumn
Response.write getlang("langCustAdminMailList")
Response.write TableColumnEnd
Response.write TableColumn
If blnmaillist="" then
blnmaillist=TRUE
end if
If blnmaillist then%>
<%Else%>
<%
End if
response.write tablecolumnend & tablerowend & tabledefend
end Sub
Sub AddOtherFields
dim words,wordcount, captions, capcount,customervalues,i
redim words(Getconfig("xCustomerMaxotherfields"))
redim captions(getconfig("xCustomerMaxotherfields"))
if Getconfig("xCustomerOtherFields")<>"" then
Customervalues=Getsess("Customervalues")
Parserecord Getconfig("xcustomerOtherFields"), words, wordcount,","
Parserecord getconfig("xcustomerOtherCaptions"), captions, capcount,","
for i = 0 to wordcount-1
If isarray(customervalues) then
CreateCustRow captions(i),words(i), customervalues(i),"No"
else
CreateCustRow captions(i),words(i), "","No"
end if
next
end if
end sub
'
Sub CustomerGetFields
dim words,wordcount,customervalues,i, customerfieldcount
dim required, requiredcount, testfield, j
if getconfig("xCustomerOtherFields")="" then exit sub
redim words(Getconfig("xCustomerMaxotherfields"))
redim Required(getconfig("xCustomerMaxotherfields"))
Customervalues=Getsess("Customervalues")
CustomerFieldcount=Getsess("CustomerFieldcount")
Parserecord getconfig("xcustomerOtherFields"), words, wordcount,","
If getconfig("xCustomerOtherrequired")<>"" then
Parserecord getconfig("xcustomerOtherRequired"), required, requiredcount,","
else
requiredcount=0
end if
If not isarray(customervalues) then
redim customervalues(wordcount)
SetSess "customerFieldcount",wordcount
customerfieldcount=wordcount
end if
for i = 0 to wordcount-1
customervalues(i)=request(words(i))
next
SetSess "Customervalues",customervalues
SetSess "customerFieldcount",wordcount
If requiredcount=0 then exit sub
for i = 0 to requiredcount-1
testfield=ucase(required(i))
for j=0 to wordcount-1
if testfield=ucase(words(j)) then
If customervalues(j)="" Then
sError = sError & words(j) & getlang("langCustRequired") & " "
end if
exit for
end if
next
next
End sub
Sub AddCookieMessage
If getconfig("XCookielogin")<>"Yes" then exit sub
Response.Write(TableDef)
Response.Write tablerow
Response.write TableColumn
Response.write getlang("langCookieQuestion")
Response.write TableColumnEnd
Response.write TableColumn
If blncookiequestion="" then
blncookiequestion=TRUE
end if
If blncookiequestion then%>
<%Else%>
<%
End if
response.write tablecolumnend & tablerowend & tabledefend
end Sub
Sub ValidateCustomerFields
If strFirstname = "" Then
sError = sError & getlang("langCustFirstname") & getlang("langCustRequired") & " "
End If
If strLastname = "" Then
sError = sError & getlang("langCustLastname") & getlang("langCustRequired") & " "
End If
If strAddress = "" Then
sError = sError & getlang("langCustAddress") & getlang("langCustRequired") & " "
End If
If strCity = "" Then
sError = sError & getlang("langCustCity") & getlang("langCustRequired") & " "
End If
If getconfig("xIncludeStates")="Yes" and strState="??" then
strstate=""
end if
If getconfig("xstaterequired")="Yes" then
If getconfig("xPromptForState")="Yes" then
If strState = "" Then
sError = sError & getlang("langCustState") & getlang("langCustRequired") & " "
End If
end if
end if
If strPostCode = "" Then
sError = sError & getlang("langCustPostCode") & getlang("langCustRequired") & " "
End If
If strPhone = "" Then
sError = sError & getlang("langCustPhone") & getlang("langCustRequired") & " "
End If
If strEmail = "" Then
sError = sError & getlang("langCustEmail") & getlang("langCustRequired") & " "
Else
CustomerValidateEmail stremail
end If
If getconfig("xCountryRequired")="Yes" then
If strCountry="" or strCountry="??" then
sError = sError & getlang("langCustCountry") & getlang("langCustRequired") & " "
End If
end if
If getconfig("xvatnumber")="Yes" then
validatevat strcountry
end if
If strhearaboutus=getlang("langcommonselect") then
strhearaboutus=""
end if
If getconfig("xhearaboutusrequired")="Yes" and strhearaboutus="" then
sError = sError & getlang("langhearaboutus") & getlang("langCustRequired") & " "
end if
end sub
'
Sub CustomerValidateEmail (stremail)
If Not InStr(strEmail, "@") > 1 Then
Serror=Serror & getlang("langInvalidEmail") & " "
end if
End sub
Sub ShippingAddOtherFields
dim words,wordcount, captions, capcount,customervalues,i
redim words(Getconfig("xCustomerMaxotherfields"))
redim captions(getconfig("xCustomerMaxotherfields"))
if Getconfig("xShippingOtherFields")<>"" then
Customervalues=Getsess("Shippingvalues")
Parserecord Getconfig("xShippingOtherFields"), words, wordcount,","
Parserecord getconfig("xShippingOtherCaptions"), captions, capcount,","
for i = 0 to wordcount-1
If isarray(customervalues) then
CreateCustRow captions(i),words(i), customervalues(i),"No"
else
CreateCustRow captions(i),words(i), "","No"
end if
next
end if
end sub
Sub ShippingGetOtherFields
dim words,wordcount,shippingvalues,i, shippingfieldcount
dim required, requiredcount, testfield, j
if getconfig("xshippingOtherFields")="" then exit sub
redim words(Getconfig("xCustomerMaxotherfields"))
redim Required(getconfig("xcustomerMaxotherfields"))
shippingvalues=Getsess("shippingvalues")
shippingFieldcount=Getsess("shippingFieldcount")
Parserecord getconfig("xshippingOtherFields"), words, wordcount,","
If getconfig("xshippingOtherrequired")<>"" then
Parserecord getconfig("xshippingOtherRequired"), required, requiredcount,","
else
requiredcount=0
end if
If not isarray(shippingvalues) then
redim shippingvalues(wordcount)
SetSess "shippingFieldcount",wordcount
shippingfieldcount=wordcount
end if
for i = 0 to wordcount-1
shippingvalues(i)=request(words(i))
next
SetSess "shippingvalues",shippingvalues
SetSess "shippingFieldcount",wordcount
If requiredcount=0 then exit sub
for i = 0 to requiredcount-1
testfield=ucase(required(i))
for j=0 to wordcount-1
if testfield=ucase(words(j)) then
If shippingvalues(j)="" Then
sError = sError & words(j) & getlang("langCustRequired") & " "
end if
exit for
end if
next
next
End sub
'*********************************************************************
' see if customerid alread exists by userid
'********************************************************************
Sub ValidateUsername (strcustuserid, serror, rc)
dim conn, sql, rs
If serror<>"" then exit sub
If getconfig("xcustomeruserid")<>"Yes" then exit sub
Opencustomerdb conn
sql="select * from customers where userid='" & strcustuserid & "'"
set rs=conn.execute(sql)
if not rs.eof then
rc=4
sError = sError & getlang("langCustomerExists") & " "
end if
closerecordset rs
shopclosedatabase conn
end sub
'******************************************************************************
' Use xhowdidyourhear and values'
'****************************************************************************
Sub AddHowDidYouHear
dim words(50), wordcount, hearvalues
If getconfig("xhearaboutus")<>"Yes" then exit sub
hearvalues=getconfig("xhearaboutusvalues")
if hearvalues="" then exit sub
parserecord hearvalues,words,wordcount,","
Response.Write TableDef & tablerow & TableColumn
Response.write getlang("langHearaboutus")
Response.write TableColumnEnd & tablerowend
Response.Write tablerow & TableColumn
response.write "