RE: System Email Templates
We have a custom System Email Template. On the HTML code we would like to display a paragraph only if one item in the Sales Order has a type of Download. item type = download.
This logic is at the end of the template and the problem is if we use an if statement it will only capture the last item type. Is there a way to store the type in a variable like isDownload = true when one of the item is a download. That way I can say if(isDownload).
Or something that can say if one item in the SO has a type of Download then display this paragraph.
Presuming this works like Advanced PDF Templates (I’ve not worked on an email template in forever), you should be able to create a variable, loop the item “list” and assign a value to your variable when you have a match.
You should then be able to evaluate your variable.
https://freemarker.apache.org/docs/ref_directive_assign.html
https://freemarker.apache.org/docs/ref_directive_list.html
This may also help as a starting point not specific to what you want but close.
<#assign variableName = "" >
<#list transaction.item as item>
<#if item.itemname == "desiredItemName">
<#assign variableName = item.itemquantity >
</#if>
</#list>