%
Sub ShopThanksLinks (myconn,OrderID, attachmentarray, attachmentcount)
'****************************************************************
' Merchant can add additional messages
' analyze fields in the order
' set the name of an attachment file
' attachment must be full path name such as c:\images\abc.gif
' Inputs Orderid = number of the order
' OrderRs = already open recordset to the order. Do not close it
' Outputs
' Orderattachment - file to be attached (only works with ASPMAIL)
' March 22, 2002 add 4.50 points
'******************************************************************
attachmentcount=0
If Getconfig("xendoforderhyperlinks")="Yes" then
GenerateHyperlinks myconn,Orderid
end if
If Getconfig("xendoforderattachments")="Yes" then
GenerateAttachments myconn,Orderid, attachmentarray, attachmentcount
end if
If Getconfig("xpoints")="Yes" then
Generatepoints myconn, orderid
end if
end sub
Sub GenerateHyperlinks (Orderconn,Orderid)
dim rc
dim ProductRS
Dim strSQL
dim orderRS
dim productcatalogid, downloadcount
InternalOpenOrder Orderconn, OrderRs, orderid
ValidatePurchase OrderRS, rc
downloadcount=0
If rc<>0 then
Closerecordset orderRs
exit sub
end if
strSQL = "select * FROM oitems where orderid = " & OrderRS("orderid")
Set ProductRS = orderconn.Execute(strSQL) '
Do While Not ProductRS.EOF
Productcatalogid=productrs("catalogid")
GenerateHyperlink orderconn,Productcatalogid, downloadcount
ProductRS.MoveNext
Loop
closerecordset productrs
Closerecordset orderrs
end sub
'
Sub InternalOpenOrder (myconn,rsorder, ordernumber)
dim sql
sql = "select * from orders where orderid=" & clng(ordernumber)
Set rsorder = myconn.Execute(SQL)
end sub
'
Sub GenerateHyperlink (myconn,catalogid, count)
dim productlink
productlink=getconfig("xendoforderhyperlinkfield")
dim productsql, rs, cname, filename
If catalogid= 0 then exit sub
Productsql="select * from products where catalogid=" & catalogid
set rs=myconn.execute(productsql)
if rs.eof then
closeRecordset rs
exit sub
end if
cname=rs("cname")
filename=rs(productlink)
if isnull(filename) then
closerecordset rs
exit sub
end if
If count=0 then
response.write getconfig("xfont") & LangdownloadFiles & ""
end if
%>
<%=cname%>
<%
CloseRecordset rs
count=count+1
end sub
'
Sub ValidatePurchase (orderRS, rc)
'*******************************************************
' See if payment type matches any of the valid payments allowed
'
'*******************************************************
Dim cardtype, cardarray(20),cardcount,paymenttype,i
rc=0
CardType=Getconfig("xendofordervalidpayments")
Paymenttype =ucase(OrderRS("oCardType"))
If cardtype="" then
exit sub
end if
parserecord cardtype, cardarray,cardcount,","
for i = 0 to cardcount-1
If ucase(cardarray(i))=paymenttype then
exit sub
end if
next
rc=4
end sub
'
Sub GenerateAttachments (orderconn, Orderid, attachmentarray, attachmentcount)
dim rc
dim ProductRS, orderRS
Dim strSQL
dim productcatalogid
InternalOpenOrder Orderconn, OrderRs, orderid
ValidatePurchase OrderRS, rc
If rc<>0 then
Closerecordset orderRS
exit sub
end if
strSQL = "select * FROM oitems where orderid = " & OrderRS("orderid")
Set ProductRS = orderconn.Execute(strSQL) '
Do While Not ProductRS.EOF
Productcatalogid=productrs("catalogid")
GenerateAttachment orderconn, Productcatalogid, attachmentarray,attachmentcount
ProductRS.MoveNext
Loop
CloseRecordset productrs
CloseRecordset OrderRS
end sub
'
Sub GenerateAttachment (myconn, catalogid, attachmentarray, attachmentcount)
dim productlink
productlink=getconfig("xendoforderattachmentfield")
dim productsql, rs, cname, filename
If catalogid= 0 then exit sub
Productsql="select * from products where catalogid=" & catalogid
set rs=myconn.execute(productsql)
if rs.eof then
closerecordset rs
exit sub
end if
filename=rs(productlink)
if isnull(filename) then
closerecordset rs
exit sub
end if
attachmentarray(attachmentcount)=filename
attachmentcount=attachmentcount+1
closerecordset rs
end sub
%>