schitz011
Starting Member
39 Posts |
Posted - August 07 2006 : 04:40:04
|
thanks.. i tried your suggestions but ended up with this error...
Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'supplierEmail'
/shopquestion.asp, line 149
here is the code itself.. Note i'm using the pother2 field instead..
**************** <%option explicit%> <!--#include file="shop$db.asp"--> <!--#include file="shopmail.asp"--> <!--#include file="shopfileio.asp"--> <% '************************************************************************** ' Question about product ' VP-ASP 6.00 June 29, 2005 ' shopQuestion.asp?id=xxx ' April 26, 2005 add translate ''************************************************************************* Dim CR CR=GetMailCR Dim strMessage Dim sAction Dim my_to Dim my_toaddress Dim my_from Dim my_fromaddress Dim my_subject,mailtype Dim my_system Dim mailer Dim my_attachment Dim body Dim strCustName Dim strCustEmail Dim strFriendsName Dim strFriendsEmail Dim id Dim extDescription dim dbc, prs dim mailid, ProductMessage Dim TellafriendSubject sError="" dim strcustphone, strhousenumber, strquantity, stroffer dim cprice,cname,ccode '======================= ' Entry Point '======================= if getconfig("xproductquestion")<>"Yes" then shoperror getlang("LangCustNotAllowed") end if id=request("id") ShopopendatabaseP dbc If id="" then serror=getlang("LangNoCatalogID") else If not isnumeric(id) then Serror=getlang("LangNoCatalogID") id="" end if end if If serror="" then GetProductInfo prs end if ShopPageHeader If sError<>"" then HandleError else sAction=Request("Action") if sAction="" then sAction=Request("Action.x") end if If sAction = "" Then DisplayForm() Else ValidateData() if sError = "" Then SendMail WriteInfoMessage else DisplayForm end if end if end if If id<>"" then closerecordset prs end if ShopPageTrailer shopclosedatabase dbc '======================= ' Sub DisplayForm '======================= Sub DisplayForm() If serror<>"" then shopwriteerror serror end if response.write "<br>" WriteProductdetails prs Response.Write("<form name=form1 method=Post action=shopquestion.asp?id=") Response.Write(id & ">") Response.Write(TableDef) CreateCustRow getlang("langYourName"), "Custname", strCustname,"No" CreateCustRow getlang("langYourEmail"), "Custemail", strCustemail,"No" CreateCustRow getlang("langcustPhone"), "phone", strcustphone,"No" Response.Write(tabledefend) Response.write "<p align=center>" shopwriteheader Getlang("langquestion") Response.write "<br><textarea rows=3 name=strmessage cols=50>" & strshipcomment & "</textarea></p>" shopbutton Getconfig("xbuttoncontinue"), getlang("Langquestion"),"action" Response.Write("</form>") end Sub '======================= ' Sub ValidateData '=======================
Sub ValidateData() Validatefield getlang("langYourName"), "Custname", strCustname,"No" Validatefield getlang("langYourEmail"), "Custemail", strCustemail,"No" Validatefield getlang("langcustPhone"), "phone", strcustphone,"No" Validatefield "Your Question", "strmessage", strmessage,"No" If Serror<>"" then Serror= getlang("LangCommonRequired") & "<br>" & SError exit sub end if If Not InStr(strcustemail, "@") > 1 Then Serror=Serror & getlang("LangInvalidEmail") & "-" & getlang("Langyouremail") & "<br>" end if End sub
Sub ValidateField(caption, fieldname, fieldvalue,other) fieldvalue=request(fieldname) If fieldvalue="" Then sError = sError & caption & "<br>" End If end sub
'======================= ' Sub SendMail '======================= Sub SendMail dim url, ProductMessage, emailformat, acount dim xmysite Emailformat="Text" Body="" Mailfield Getlang("langproductname"),"xxx", cname,"No" Mailfield getlang("langproductcode"), "xxx", ccode,"No" body=body & vbcrlf body=body & "Customer details" & vbcrlf Mailfield getlang("langcommonName"), "Custname", strCustname,"No" Mailfield getlang("langcustemail"), "Custemail", strCustemail,"No" Mailfield getlang("langcustPhone"), "phone", strcustphone,"No" Mailfield getlang("langquestion"), "xxx", strmessage,"No" body=body & vbcrlf 'debugwrite body mailtype=getconfig("xemailtype") my_from=strCustName my_fromaddress=strCustEmail if supplierEmail <> "" then my_toaddress=supplierEmail else my_toaddress=getconfig("xemail") end if my_to=getconfig("xemailname") my_system=getconfig("xemailsystem") my_subject=getlang("langquestion") & " " & getlang("langproductcode") & "=" & ccode acount=0 ExecuteMail mailtype,My_from,my_fromaddress,my_to,my_toaddress,my_subject,body,emailformat,My_attachment,acount end sub
Sub Mailfield (caption, other, fieldvalue,other1) 'Debugwrite "mail=" & fieldvalue body=body & caption & ": " & fieldvalue & vbcrlf end sub
Sub WriteInfoMessage
shopwriteheader getlang("LangTellafriendinfo") end sub
Sub GetProductInfo (prs) Dim sql sql = "select * from products where catalogid = " & id set prs = dbc.execute(sql) If prs.eof then serror=getlang("LangErrorNoProduct") & " catalogid=" & id exit sub end if cprice=prs("cprice") cprice=shopformatcurrency(cprice,Getconfig("xdecimalpoint")) cname=prs("cname") cname=translatelanguage(dbc, "products", "cname","catalogid", id, cname) ccode=prs("ccode") dim supplierEmail supplierEmail = prs("pother2") end sub
Sub WriteProductdetails (prs) dim template, orc template=Getconfig("xproductquestiontemplate") ShopTemplateWrite template,prs, orc end sub
Sub HandleError shopwriteerror serror end sub
%> ************************ |
|
|