<% Sub FormatMail (rsOrder, rsitems, merchant, customer) '*************** Formats mail to Merchant and Customer ' Version 4.00 SEptember 8, 2001 ' Used only if VP-ASP Option Package is not installed ' Option package uses templates '****************************************************************** dim ydecimalpoint ydecimalpoint=getconfig("xdecimalpoint") Body="" Dim Body Dim body1 dim body2 Dim CR Dim description Dim FullName, AddressName, CityName, StateName, CountryName, PostalName, Nameb, Addressb, Cityb, Stateb, Countryb, Companyb, Postalb Dim Companyname Dim DeliveryAddress, DeliveryArray CR = GetMailCR SetSess ("EmailFormat"),"Text" body1 = langmailmerchant & cr body2 = langmailcustomer & cr body = langmailordernumber & rsorder("orderid") & cr &_ langmailorderamount & shopformatcurrency(rsorder("orderamount"),ydecimalpoint) & cr &_ langmailshippingcost & shopformatcurrency(rsorder("oshipcost"),ydecimalpoint) & cr &_ langmailshippingmethod & rsorder("oshipmethodtype") & cr &_ langmailtax & shopformatcurrency(rsorder("otax"),ydecimalpoint) & cr if rsorder("odiscount")>0 then body=body & langmaildiscount & shopformatcurrency(rsorder("odiscount"),ydecimalpoint) & cr end if body = body & cr &_ langmailpayment & rsorder("ocardtype") & cr &_ langmaildate & shopdateformat(rsorder("odate"),getconfig("xdateformat")) & cr &_ langmailphone & rsorder("ophone") & cr &_ langmailemail & rsorder("oemail") & cr & cr &_ langmailshipto & cr & cr if not isnull(rsorder("oshipname")) then fullname = rsorder("oshipname") else fullname = rsorder("ofirstname") & " " & rsorder("olastname") end if if not isnull(rsorder("oshipaddress")) then addressname = rsorder("oshipaddress") else addressname = rsorder("oaddress") end if if Not isNULL(rsorder("oshiptown")) then CityName = rsOrder("oshiptown") else CityName = rsOrder("ocity") end if if Not isNULL(rsorder("oshipstate")) then StateName = rsOrder("oshipstate") else StateName = rsOrder("ostate") end if if Not isNULL(rsorder("oshipzip")) then PostalName = rsOrder("oshipzip") else PostalName = rsOrder("opostcode") end if if Not isNULL(rsorder("oshipcountry")) then CountryName = rsOrder("oshipcountry") else CountryName = rsOrder("ocountry") end if Body = Body & FullName & CR if Not isNULL(rsorder("oshipcompany")) then Body = Body & rsOrder("oshipcompany") & CR else IF Not isNULL(rsorder("ocompany")) then Body = Body & rsOrder("ocompany") & CR End If end if Body = Body & AddressName & CR &_ "" & CityName & ", " & StateName & " " & PostalName & CR &_ "" & CountryName & CR & CR &_ LangMailCustomerIs & CR & CR FullName = rsOrder("ofirstname") & " " & rsOrder("olastname") AddressName = rsOrder("oaddress") CityName = rsOrder("ocity") StateName = rsOrder("ostate") PostalName = rsOrder("opostcode") CountryName = rsOrder("ocountry") Companyname="" IF Not isNULL(rsorder("ocompany")) then Companyname=("ocompany") End If Body = Body & FullName & CR Body = Body & AddressName & CR &_ "" & CityName & ", " & StateName & " " & PostalName & CR &_ "" & CountryName & CR & CR &_ LangMailProducts & CR & CR Do While Not RSItems.EOF Itemname=RSItems("itemname") If getconfig("XdeliveryAddress")="Yes" then Deliveryaddress=RSITEMS("address") If not isnull(Deliveryaddress) and Deliveryaddress<>"" then ConvertDeliveryToArray DeliveryArray, Deliveryaddress GetDeliveryName Itemname, DeliveryArray end if end if Itemname=RemoveHtmlmail(itemname, CR) Body = Body & "" & itemname & CR Body = Body & LangProductQuantity & ": " & RSItems("numitems") & CR Body = Body & LangProductPrice & ": " & shopformatcurrency(RSItems("unitprice"),ydecimalpoint) & CR & CR RSItems.MoveNext Loop ' If Not isNULL(rsorder("ocomment")) then Body = Body & LangOrderComments & CR Body = Body & rsorder("ocomment") End If Merchant= Body1&Body Customer= Body2&CR&Body 'Debugwrite merchant end sub Function Removehtmlmail(itemname, CR) dim workrecord, firstchar, morefields, pos, endpos, length dim token workrecord=replace(itemname,"
",CR) If getconfig("xemailremovehtml")<>"Yes" then Removehtmlmail=workrecord exit function end if pos=1 morefields = True Do While morefields = True pos=1 pos = InStr(pos, workrecord, "<") If pos > 0 Then endpos = InStr(pos, workrecord, ">") If endpos=0 then morefields=false else length = endpos - pos + 1 token = Mid(workrecord, pos, length) workrecord=replace(workrecord,token,"") end if else morefields=false end if loop Removehtmlmail=workrecord end function %>