Vai al contenuto

Messaggio personalizzato contenente anche il dettaglio del documento

Aggiornato il 10.11.2022
Questo script inserisce una tabella HTML nel corpo dell'email con il dettaglio degli articoli ordinati (codice, descrizione, foto)
Option Explicit
 
Dim testo ' testo dell'email da restituire in output
Dim riga ' Oggetto DocRow. Riga del documento
Dim IdTipoFoto ' Codice del tipo foto da inserire nella tabella
Dim FotoArt ' Oggetto Photo. Foto dell'articolo
Dim NomeFoto ' percorso completo alla foto sul sito web
Dim IDArticolo
Dim CodArticolo
Dim Descrizione
' Codice del tipo foto da inserire nella tabella
IdTipoFoto=1
 
testo = "Gentile " & RowItem.CustomField(30) & ", <br />" & vbCrLf
testo = testo & "Il suo ordine è stato consegnato al corriere " & RowItem.CustomField(180) & " in data " & RowItem.CustomField(190) & "<br />" & vbcrlf
testo = testo & "<br />" & vbCrLf
testo = testo & "Questo il dettaglio degli articoli ordinati<br />" & vbCrLf
testo = testo & "<table>" & vbcrlf
 
For Each riga In RowItem.DocRows
IdArticolo = riga.Product.Id
 
If IdArticolo>0 Then
   CodArticolo = riga.Product.Code
   Descrizione = riga.Product.Name
   NomeFoto = ""
   For Each FotoArt In riga.Product.Photos
     If FotoArt.IdType = IdTipoFoto Then
       NomeFoto = FotoArt.link
       Exit For
     End If
Next
 
testo = testo & "<tr>"
testo = testo & "<td>" & CodArticolo & "</td>"
testo = testo & "<td>" & Descrizione & "</td>"
 
     If NomeFoto<>"" Then
       testo = testo & "<td>
<img src='http://www.miosito.com.com/files" & NomeFoto & "'/>
</td>"
     End If
 
testo = testo & "</tr>"
 
End If
Next
 
testo = testo & "</table>" & vbcrlf
testo = testo & "<br />
<br />" & vbCrLf
testo = testo & "Nel ringraziarla per averci scelto, cogliamo l'occasione per porgere cordiali saluti<br />" & vbCrLf
 
Response.Write(testo)