File: D:/web/castironradiatorcentre/inc-template-email-html.asp
<%
' === COMMON TEMPLATE (SAME FOR ALL SHOPPING SITES) ===
' inc-template-email-html.asp 08/06/07
' (SS,19/03/09) in Sub ShowEmailAddressDetails changed "Invoice Address" to "Billing Address"
' (SS,20/04/09) to Sub ShowEmailOrderHeader added AMobile, ADeliveryDate & AVoucherCode
' added AIsDiscount and ADiscount to Sub ShowEmailOrderFooter
' added href to web address in footer
' (SS,29/05/09) changes to ShowEmailAddressDetails and ShowEmailFooter, added OrderStatus to ShowEmailOrderHeader
' (SS,02/11/09) changed to ShowEmailOrderHeader
' (SS,19/03/10) added language translation using calls to tr function
' (SS,15/02/11) sorted issue with column sizes in Outlook 2007/2010, added product link, swapped Code and Product Name column order
' (SS,06/07/11) added AProductID and AOptionsList to Sub ShowEmailOrderItem
' (SS,19/09/11) changed Order Reference to Order/Invoice No
' (SS,22/05/12) change to ShowEmailHeader to always use text rather than logo in header, i.e. changed "If AForEmail Then" to "If True Then"
' (SS,02/11/12) change to ShowEmailOrderFooter to not show VAT if label is blank
' (SS,08/03/13) changed width of cell in ShowEmailFooter for telephone/email/website from 220 to 250
' (SS,18/11/13) removed HTML comments e.g. START/END OF HEADER etc. in case it affects the spam score. Had also removed the Google Analytics javascript code from AppUtils.asp for every page except products.asp.
' (SS,18/11/13) replaced all <br> with <br /> because doc type changed to "-//W3C//DTD XHTML 1.0 Transitional//EN
' (SS,18/11/13) replaced all nowrap in td with style="white-space: nowrap", nowrap deprecated in HTML 4.01
' (SS,18/11/13) various corrections to ensure that passes W3C validation at http://validator.w3.org/
' (SS,03/07/14) positive discount now shown as adjustment, change to Sub ShowEmailOrderFooter
' (SS,30/10/15) changes to Sub ShowEmailFooter, needs latest apputils.asp (dated from this date onwards)
' (SS,04/04/17) change to Sub ShowEmailFooter, improved print preview to also close the window
' (SS,08/07/17) change to Sub ShowEmailOrderHeader to always show GBP Total for multicurrency sites (e.g. HF)
' (SS,12/03/18) Major change to return a string instead of direct HTML rendering
' To fix issue when use of itpEmailer.dll was resulting in empty attachment in Outlook 2017 (and some other email clients)
' On some email clients customers were seeing just an attached file.
' Fixed by rewriting all the "ShowEmail.." sub routines as "GetOrderEmail..." functions.
' Rather than fetching a webpage to get the email text, we can now build the content as a string using function calls.
' (SS,19/11/20) Minor width adjustment to Function GetOrderEmailFooter
' (SS,22/12/20) Added EORI No to Function GetOrderEmailFooter
' (SS,16/02/21) Added XI EORINo to Function GetOrderEmailFooter, also added AEORINumber and AXIEORINumber to Function GetOrderEmailHeaderDetail
' (SS,20/05/21) Change to Function GetOrderEmailHeaderDetails - changed label from Telephone to Phone, renamed AMobile to AAlternativePhone
' (SS,22/5/09) removed AFullName parameter, section moved to footer, added ATitle parameter to replace "Order Confirmation"
' (SS,1/6/09) added AForEmail
' (SS,9/3/18) rewrote Sub ShowEmailHeader as Function GetOrderEmailHeader to return a string instead of direct HTML
Function GetOrderEmailHeader(ATitle, AForEmail)
Dim LResult
LResult = ""
' (SS,12/3/18) following taken from order-details.asp to complete the HTML page
LResult = LResult &_
"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">" & NL &_
"<html xmlns=""http://www.w3.org/1999/xhtml"">" & NL &_
"<head>"& NL
' if called from order-details.asp page (i.e. not for emailing) then disable the cache so that latest version is fetched
' I think this needs to be just after the <head> tag to work best
If Not AForEmail Then
DisableCache
End If
LResult = LResult &_
"<meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"" />" & NL &_
"<title>" & tr("Order Details") & "</title>" & NL &_
"</head>" & NL &_
"<body>" & NL &_
"<div>" & NL
' (SS,13/3/18) HTMLEncode used because ATitle may contain an ampsersand
LResult = LResult &_
"<table width=""97%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""10"">" & NL &_
"<tr>" & NL &_
" <td style=""font-size: 24px; font-weight: bold; font-family: Verdana; color: #000000;"">" & GetStoreName & "</td>" & NL &_
" <td align=""right"" style=""font-size: 24px; font-family: Verdana; color: #0066CC;"">[" & HTMLEncode(ATitle) & "]</td>" & NL &_
"</tr>" & NL &_
"<tr>" & NL &_
" <td colspan=""2""><hr noshade=""noshade"" size=""2"" /></td>" & NL &_
"</tr>" & NL &_
"</table>" & NL
GetOrderEmailHeader = LResult
End Function
' (SS,29/5/09) replaced parameters AInvoiceAddress, ADeliveryAddress with AAddress1Title, AAddress1, AAddress2Title, AAddress2
' (SS,9/3/18) rewritten to return as string, also renamed from Sub ShowEmailAddressDetails to Function GetOrderEmailAddressDetails
Function GetOrderEmailAddressDetails(AAddress1Title, AAddress1, AAddress2Title, AAddress2)
Dim LResult
LResult = "" &_
"<table width=""97%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""8"">" & NL &_
"<tr>" & NL &_
" <td style=""font-size: 16px; font-family: Verdana; color: #0066CC;"" width=""50%""><b>" & AAddress1Title & "</b></td>" & NL &_
" <td style=""font-size: 16px; font-family: Verdana; color: #0066CC;"" width=""50%""><b>" & AAddress2Title & "</b></td>" & NL &_
"</tr>" & NL &_
"<tr>" & NL &_
" <td valign=""top"">" & NL &_
" <table width=""100%"" cellpadding=""8"" cellspacing=""0"" style=""border: 2px solid #0066CC"">" & NL &_
" <tr style=""font-size: 12px; font-family: Verdana;"">" & NL &_
" <td height=""112"" valign=""top"" bgcolor=""#ECF5FF"">" & NL &_
AAddress1 & NL &_
" </td>" & NL &_
" </tr>" & NL &_
" </table>" & NL &_
" </td>" & NL &_
" <td valign=""top"">" & NL &_
" <table width=""100%"" cellpadding=""8"" cellspacing=""0"" style=""border: 2px solid #0066CC"">" & NL &_
" <tr style=""font-size: 12px; font-family: Verdana;"">" & NL &_
" <td height=""112"" valign=""top"" bgcolor=""#ECF5FF"">" & NL &_
AAddress2 & NL &_
" </td>" & NL &_
" </tr>" & NL &_
" </table>" & NL &_
" </td>" & NL &_
"</tr>" & NL &_
"</table>" & NL
GetOrderEmailAddressDetails = LResult
End Function
' (SS,20/4/09) added AMobile, ADeliveryDate & AVoucherCode
' (SS,29/5/09) added AStatus
' (SS,1/6/09) added APaymentMethod, APaymentReference
' (SS,2/11/09) increased width of price column from 90 to 100 to allow for size "VAT Deducted" or "Included" label which appears for some customers
' (SS,15/2/11) Changed widths from 50, 0%, 80, 100, 80 to 1%, 0% was just removed, to fix issue in Outlook 2007 and 2010 where columns sizes were incorrect
' (SS,8/8/17) Added new AGBPGrandTotal parameter shown for multicurrency sites
' (SS,9/3/18) rewritten to return as string, also renamed from Sub ShowEmailOrderHeader to Function GetOrderEmailHeaderDetails
' (SS,16/2/21) added AEORINumber and AXIEORINumber
' (SS,20/5/21) changed label from Telephone to Phone, renamed AMobile to AAlternativePhone
Function GetOrderEmailHeaderDetails(AOrderNo, AOrderDate, AOrderStatus, AAccountID, APurchaseOrderNo, AMessage, ATelephone, AAlternativePhone, AEmailAddress, AVATNumber, AEORINumber, AXIEORINumber, ADeliveryDate, AVoucherCode, APaymentMethod, APaymentReference, AGBPGrandTotal)
Dim LResult
LResult = "" &_
"<table width=""97%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""10"">" & NL &_
"<tr>" & NL &_
" <td>" & NL &_
" <table width=""100%"" border=""0"" align=""center"" cellpadding=""3"" cellspacing=""2"">" & NL
LResult = LResult & GetOrderEmailHeaderDetailLine("Order/Invoice No", AOrderNo, "Account ID", AAccountID)
LResult = LResult & GetOrderEmailHeaderDetailLine("Order Date", AOrderDate, "Payment Method", APaymentMethod)
LResult = LResult & GetOrderEmailHeaderDetailLine("Order Status", AOrderStatus, "Payment Reference", APaymentReference)
If IsMulticurrency Then LResult = LResult & GetOrderEmailHeaderDetailLine("GBP Grand Total", AGBPGrandTotal, "", "")
LResult = LResult & GetOrderEmailHeaderDetailLine("Purchase Order No", APurchaseOrderNo, "", "")
LResult = LResult & GetOrderEmailHeaderDetailLine("VAT Number", AVATNumber, "", "")
' (SS,16/2/21)
LResult = LResult & GetOrderEmailHeaderDetailLine("EORI Number", AEORINumber, "XI EORI Number", AXIEORINumber)
LResult = LResult & GetOrderEmailHeaderDetailLine("Phone", ATelephone, "Email", AEmailAddress)
LResult = LResult & GetOrderEmailHeaderDetailLine("Alternative Phone", AAlternativePhone, "", "")
If ChooseDeliveryDate Then LResult = LResult & GetOrderEmailHeaderDetailLine("Delivery Date", ADeliveryDate, "", "")
LResult = LResult & GetOrderEmailHeaderDetailLine("Voucher Code", AVoucherCode, "", "")
LResult = LResult & GetOrderEmailHeaderDetailLine("Message", AMessage, "", "")
LResult = LResult &_
" </table>" & NL &_
" </td>" & NL &_
"</tr>" & NL &_
"</table>" & NL
LResult = LResult &_
"<table width=""97%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""10"">" & NL &_
"<tr>" & NL &_
" <td>" & NL &_
" <table width=""100%"" align=""center"" cellpadding=""3"" cellspacing=""2"">" & NL &_
" <tr style=""font-size: 12px; font-family: Verdana;"">" & NL &_
" <td width=""1%"" align=""center"" style=""white-space: nowrap"" bgcolor=""#CAE8FF""><b>" & tr("Qty") & "</b></td>" & NL &_
" <td width=""1%"" style=""white-space: nowrap"" bgcolor=""#CAE8FF""><b>" & tr("Code") & "</b></td>" & NL &_
" <td bgcolor=""#CAE8FF""><b>" & tr("Product Name") & "</b></td>" & NL &_
" <td width=""1%"" align=""right"" style=""white-space: nowrap"" bgcolor=""#CAE8FF""><b>" & tr("Price") & "</b></td>" & NL &_
" <td width=""1%"" align=""right"" style=""white-space: nowrap"" bgcolor=""#CAE8FF""><b>" & tr("Total") & "</b></td>" & NL &_
" </tr>" & NL
GetOrderEmailHeaderDetails = LResult
End Function
Function GetOrderEmailHeaderDetailLine(ALabel1, AValue1, ALabel2, AValue2)
Dim LResult
LResult = ""
If AValue1 <> "" Or AValue2 <> "" Then
LResult = LResult & "<tr style=""font-size: 12px; font-family: Verdana;"">" & NL
LResult = LResult & GetOrderEmailHeaderDetailLineCell(ALabel1, AValue1)
LResult = LResult & GetOrderEmailHeaderDetailLineCell(ALabel2, AValue2)
LResult = LResult & "</tr>" & NL
End If
GetOrderEmailHeaderDetailLine = LResult
End Function
Function GetOrderEmailHeaderDetailLineCell(ALabel, AValue)
Dim LResult
If ALabel <> "" And AValue <> "" Then
LResult = "<td style=""white-space: nowrap"" width=""10%""><b>" & tr(ALabel) & ":</b></td><td width=""40%"">" & AValue & "</td><td> </td>" & NL
Else
LResult = "<td colspan=""2""> </td>" & NL
End If
GetOrderEmailHeaderDetailLineCell = LResult
End Function
' (SS,15/2/11) added nowraps, also added product link, also swapped Code and Product Name column order
' (SS,6/7/11) added AProductID and AOptionsList
' (SS,9/3/18) renamed from Sub ShowEmailOrderItem, now returns a string instead of direct rendering
Function GetOrderEmailProductItem(AProductID, AProductCode, AProductName, AOptionsList, AQty, APriceEach, APriceTotal)
Dim LResult
LResult = "" &_
" <tr style=""font-size: 12px; font-family: Verdana;"">" & NL &_
" <td align=""center"" style=""white-space: nowrap"" bgcolor=""#F0F4F7"">" & AQty & "</td>" & NL &_
" <td style=""white-space: nowrap"" bgcolor=""#F0F4F7""><a href=""" & GetFullProductLink(AProductCode) & """>" & AProductCode & "</a></td>" & NL &_
" <td bgcolor=""#F0F4F7""><a href=""" & GetFullProductLink(AProductCode) & """>" & AProductName & "</a>"
If AOptionsList <> "" Then
LResult = LResult & "<br /><span style=""font-size: 10px"">" & AOptionsList & "</span>"
End If
LResult = LResult &_
" </td>" & NL &_
" <td align=""right"" style=""white-space: nowrap"" bgcolor=""#F0F4F7"">" & APriceEach & "</td>" & NL &_
" <td align=""right"" style=""white-space: nowrap"" bgcolor=""#F0F4F7"">" & APriceTotal & "</td>" & NL &_
" </tr>" & NL
GetOrderEmailProductItem = LResult
End Function
' (SS,20/4/09) added AIsDiscount and ADiscount
' (SS,2/11/12) added 'And VATLabel <> ""' because VAT Deducted is no longer shown
' (SS,3/7/14) positive discount now shown as adjustment
' (SS,9/10/14) added GetDeliveryInfo
' (SS,9/3/18) renamed from Sub ShowEmailOrderFooter, now returns a string instead of direct rendering
' (SS,22/4/21) replaced tr("Delivery") with GetDeliveryOptionLabel
Function GetOrderEmailFooterDetails(ASubtotal, AIsDiscount, ADiscount, ADelivery, AVATLabel, AVATAmount, AGrandTotal, ATotalWeight)
Dim LResult
LResult = ""
LResult = LResult & GetOrderEmailFooterDetailLine(False, "", tr("Subtotal"), ASubtotal)
If AIsDiscount Then
Dim ADiscountLabel
If InStr(ADiscount, "-") > 0 Then ' ADiscount is a string
ADiscountLabel = tr("Discount") ' as before
Else ' positive then show as adjustment
ADiscountLabel = tr("Adjustment")
End If
LResult = LResult & GetOrderEmailFooterDetailLine(False, "", ADiscountLabel, ADiscount)
End If
LResult = LResult & GetOrderEmailFooterDetailLine(False, GetDeliveryInfo, GetDeliveryOptionLabel, ADelivery)
If IsVATRegistered And AVATLabel <> "" Then LResult = LResult & GetOrderEmailFooterDetailLine(False, "", AVATLabel, AVATAmount)
LResult = LResult & GetOrderEmailFooterDetailLine(True, "", tr("Grand Total"), AGrandTotal)
If Not IsNull(ATotalWeight) Then LResult = LResult & GetOrderEmailFooterDetailLine(False, "", tr("Total Weight"), ATotalWeight)
LResult = LResult &_
" </table>" & NL &_
" </td>" & NL &_
"</tr>" & NL &_
"</table>"
GetOrderEmailFooterDetails = LResult
End Function
' (SS,9/3/18)
Function GetOrderEmailFooterDetailLine(AHighlight, AValue1, AValue2, AValue3)
Dim LResult
LResult = ""
If AValue1 <> "" Or AValue2 <> "" Then
LResult = LResult & "<tr style=""font-size: 12px; font-family: Verdana;"">" & NL
LResult = LResult & GetOrderEmailFooterDetailLineCell(1, AValue1, AHighlight)
LResult = LResult & GetOrderEmailFooterDetailLineCell(2, AValue2, AHighlight)
LResult = LResult & GetOrderEmailFooterDetailLineCell(3, AValue3, AHighlight)
LResult = LResult & "</tr>" & NL
End If
GetOrderEmailFooterDetailLine = LResult
End Function
' (SS,9/3/18)
Function GetOrderEmailFooterDetailLineCell(ANo, AValue, AHighlight)
Dim LResult
If ANo = 1 Then
If AValue <> "" Then
LResult = "<td colspan=""2""> </td>" & NL
LResult = LResult & "<td>" & AValue & "</td>" & NL
Else
LResult = "<td colspan=""3""> </td>" & NL
End If
Else ' i.e. 2 or 3
Dim LBGColour, LBoldText
If AHighlight Then
LBGColour = "#CAE8FF"
Else
LBGColour = "#F0F4F7"
End If
If ANo = 2 Or (ANo = 3 And AHighlight) Then ' 2nd column or (3rd column and highlight i.e. Grand Total) then bold text
LBoldText = ";font-weight: bold"
Else
LBoldText = ""
End If
LResult = "<td align=""right"" style=""white-space: nowrap" & LBoldText & """ bgcolor=""" & LBGColour & """>" & AValue & "</td>"
End If
GetOrderEmailFooterDetailLineCell = LResult
End Function
' (SS,22/5/09) added AFullName, also changed text "Please check the following order information:" to "Please check your order details above."
' (SS,29/5/09) added APrintPreview
' (SS,16/2/11) improved text for English, using function IsEnglish to check if English
' (SS,8/3/13) changed width of cell for telephone/email/website from 220 to 250
' (SS,23/10/15) change to not use the default when EmailUseMessageToCustomerForDespatch
' (SS,30/10/15) moved some of the code to apputils.asp
' (SS,04/04/17) improved print preview to also close the window
' (SS,9/3/18) renamed from Sub ShowEmailFooter, now returns a string instead of direct rendering
' (SS,19/11/20) adjusted width from 250 to 260 due to website name wrapping after W: to next line for CIRC
' (SS,22/12/20) added GetStoreEORINo, removed one of the <br>'s
' (SS,16/2/21) added GetStoreXIEORINo
Function GetOrderEmailFooter(AFullName, AMessage, APrintPreview)
Dim LResult, LEmailLink ' (SS,16/2/11) added because now in two places
LEmailLink = "<a href=""mailto:" + GetStoreEmail + """>" + GetStoreEmail + "</a>"
LResult = "" &_
"<table width=""97%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""10"">" & NL &_
"<tr>" & NL &_
" <td style=""font-size: 12px; font-family: Verdana;"">" & AMessage & "</td>" & NL &_
"</tr>" & NL &_
"</table>" & NL
LResult = LResult &_
"<table width=""97%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""10"">" & NL &_
"<tr>" & NL &_
" <td colspan=""2""><hr noshade=""noshade"" size=""2"" /></td>" & NL &_
"</tr>" & NL &_
"<tr style=""font-size: 11px; font-family: Verdana;"">" & NL &_
" <td width=""260"" valign=""top"">" & NL &_
" <p>" & NL
If GetStoreTelephone <> "" Then
LResult = LResult & "<b>T:</b> " & GetStoreTelephone & "<br />" & NL
End If
If GetStoreFax <> "" Then
LResult = LResult & "<b>F:</b> " & GetStoreFax & "<br />" & NL
End If
LResult = LResult &_
" <b>E:</b> " & LEmailLink & "<br />" & NL &_
" <b>W:</b> <a href=""" & GetStoreURL & """>" & GetStoreURLNoHttp & "</a><br />" & NL &_
" </p>" & NL &_
" </td>" & NL &_
" <td align=""right"" valign=""top"">" & NL &_
GetStoreAddress(True, True) & "<br />" & NL
If GetStoreVATRegNo <> "" Then
LResult = LResult & " <b>" & tr("VAT Reg No") & ":</b> " & GetStoreVATRegNo & NL
End If
' (SS,22/12/20)
If GetStoreEORINo <> "" Then
LResult = LResult & "<br />" & "<b>" & tr("EORI No") & ":</b> " & GetStoreEORINo & NL
End If
' (SS,22/12/20)
If GetStoreXIEORINo <> "" Then
LResult = LResult & "<br />" & "<b>" & tr("XI EORI No") & ":</b> " & GetStoreXIEORINo & NL
End If
LResult = LResult &_
" </td>" & NL &_
"</tr>" & NL &_
"</table>" & NL
' (SS,29/3/17) now called from print order/invoice button in local mode
' now closes the window
' replaced window.print(); with following to close the window/tab
' window.onload = function() {
' window.print();
' setTimeout(window.close, 0);
' }
If APrintPreview Then
LResult = LResult &_
"<script type=""text/javascript"">" & NL &_
" window.onload = function() {" & NL &_
" window.print();" & NL &_
" setTimeout(window.close, 0);" & NL &_
" }" & NL &_
"</script>" & NL
End If
' (SS,12/3/18) following taken from order-details.asp to complete the page
LResult = LResult &_
"</div>" & NL &_
"</body>" & NL &_
"</html>"
GetOrderEmailFooter = LResult
End Function
%>