Skip to main content

Hide sub-items in emails (optional)

To hide sub-items in emails, open the email templates under Settings Email templates. In the templates where the individual items are listed, you will find a text section for inserting items that looks roughly like this:

{foreach item=details key=position from=$sOrderDetails}

{$position+1|fill:3} {$details.ordernumber|fill:10:" ":"..."} {$details.articlename|fill:30} {$details.quantity} x {$details.price|string_format:"%.2f"} {$sConfig.sCURRENCY} {/foreach}

Replace this section with the following section. The new section checks a list introduced by the bill of materials plugin, which is used to ignore all sub-items.

{assign var=position value=1}

{foreach item=details key=index from=$sOrderDetails}

{assign var=itemEmailQuantity value=-1}

{if $EventResult && $EventResult.orderItemsWhitelist|is_array}

{foreach item=whitelistQuantity key=whitelistId from=$EventResult.orderItemsWhitelist}

{if $whitelistId == $details.orderdetailsID}

{assign var=itemEmailQuantity value=$whitelistQuantity}

{break}

{/if}

{/foreach}

{else}

{assign var=itemEmailQuantity value=$details.quantity}

{/if}

{if $itemEmailQuantity > -1}

{$position|fill:3} {$details.ordernumber|fill:20} {$details.articlename|fill:50} {$itemEmailQuantity}/{$details.quantity} x {$details.price|string_format:"%.2f"} {$sConfig.sCURRENCY}

{assign var=position value=$position+1}

{/if}

{/foreach}

The lines printed in bold in both sections indicate the information that will ultimately be displayed per item on the document. This can still be customized individually.

Did this answer your question?