<% '************************************************************ ' VP-ASP 6.50 Feb 2, 2003 ' mail affiliate at end of order ' Two templates are used ' tmp_afforderdetails.txt has the order details ' tmp_affordername.txt has the affiliates name and details '************************************************************* Sub Shopmailaffiliate (myconn, ordernumber, affid) dim rsorder, sql If getconfig("affmailorder")<>"Yes" then exit sub sql="select * from orders where orderid=" & ordernumber & " and oaffid=" & affid set rsorder=myconn.execute(sql) if rsorder.eof then closerecordset rsorder exit sub end if dim message, ordermessage message="" FormataffiliateMessage myconn, affid,mailname,mailaddress,Message FormatAffiliateOrderMessage rsorder,OrderMessage closerecordset rsorder if getconfig("xdebug")="Yes" then debugwrite "mailing to " & mailname & " at " & mailaddress end if Message=Message & OrderMessage mailPerson mailname, mailaddress, getconfig("xemailname"), getconfig("xemail"), getconfig("xemailsubject"), Message,"No" end sub Sub FormatAffiliateMessage (myconn, affid, mailname, mailaddress, message) dim strSql, affrsRS, mailtemplate, affdbc, affrs, emailformat If getconfig("xaffiliatedb")<>"" then ShopOpenOtherDB affdbc,getconfig("xaffiliateDB") end if mailaddress="" mailname="" mailtemplate=Getconfig("affmailordername") strsql = "select * from affiliates where affid=" & affid If getconfig("xaffiliateDB")<>"" Then Set affRS = affdbc.Execute(strSQL) ' get the record st for order and order items else Set affRS = myconn.Execute(strSQL) ' get the record st for order and order items end if If not affRs.eof then mailaddress=affrs("email") mailname=affrs("firstname") & " " & affrs("lastname") mailtemplate=affrs("template") if isnull(mailtemplate) then mailtemplate=getconfig("affmailordername") end if end if FormatOtherMail mailtemplate, affRS, message SetupEmailformat mailtemplate,emailformat setsess "emailformat",ucase(emailformat) end Sub Sub FormatAffiliateOrderMessage (rsorder, OrderMessage) '*************** Formats mail to Merchant and Customer ' Formats order details '****************************************************************** dim textarray(500), textcount,CR,i dim filename, emailformat, sql emailformat=ucase(getsess("emailformat")) Filename=getconfig("affmailorderdetails") CR=GetMailCR ShopTemplateArray Filename, rsOrder, TextArray, TextCount ordermessage="" for i = 0 to Textcount-1 If emailformat="HTML" then ordermessage= OrderMessage & TextArray(i) else ordermessage= ordermessage & TextArray(i) & CR end if next If emailformat="HTML" then CR="
" end if If emailformat<>"HTML" then body=Removehtml(ordermessage, CR) end if end sub %>