Ordered products in a table (macro)

An example of how you could use a Flowmailer Freemarker macro to generate a table of ordered products in a template:

<#macro productTable products> 
<table>
<head>
<tr>
<th>Product</th>
<th>Quantity</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<#list products as product>
<tr>
<td>${product.name}</td>
<td>${product.quantity}</td>
<td>${product.price}</td>
</tr>
</#list>
</tbody>
</table>
</#macro>
To call the macro and generate the table in an email or attachment, you can use the following code:
<#include "productTable.ftl" products=orderedProducts />
In this example, orderedProducts is a list of product objects, each of which has a name, quantity, and price property. When the template is processed, the macro will be called, and the table will be generated using the data in the orderedProducts list.

You can also use loops and conditionals to control the output of the table and to customize the table's appearance and layout. For example, you could use a <#if> statement to include a row in the table only if a certain condition is met, or you could use a <#list> loop to generate rows for each item in a list.

Here's an example of how you could use a <#if> statement to include a row in the table only if the product's quantity is greater than zero:

<#macro productTable products> 
<table>
<thead>
<tr>
<th>Product</th>
<th>Quantity</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<#list products as product>
<#if product.quantity > 0>
<tr>
<td>${product.name}</td>
<td>${product.quantity}</td>
<td>${product.price}</td>
</tr>
</#if>
</#list>
</tbody>
</table>
</#macro>