foreach placing number in each product row

Hello,



I would like to number product rows on invoice.



1 product one

2 product two




{foreach from=$order_info.items item="oi"}
{hook name="orders:items_list_row"}
{if !$oi.extra.parent}







{$oi.product|unescape|default:$lang.deleted_product}
{hook name="orders:product_info"}
{if $oi.product_code}

{$lang.code}: {$oi.product_code}

{/if}
{/hook}
{if $oi.product_options}
{include file="common_templates/options_info.tpl" product_options=$oi.product_options}{/if}

{$oi.amount}
{if $oi.extra.exclude_from_calculate}{$lang.free}{else}{include file="common_templates/price.tpl" value=$oi.price}{/if}
{if $order_info.use_discount}
{if $oi.extra.discount|floatval}{include file="common_templates/price.tpl" value=$oi.extra.discount}{else} - {/if}
{/if}
{if $order_info.taxes}
{if $oi.tax_value}{include file="common_templates/price.tpl" value=$oi.tax_value}{else} - {/if}
{/if}

{if $oi.extra.exclude_from_calculate}{$lang.free}{else}{include file="common_templates/price.tpl" value=$oi.display_subtotal}{/if}

{/if}
{/hook}
{/foreach}

First you need to add a “name” to the foreach like:

{foreach name=“foo” from=$order_info.items item=“oi”}



When, when you want to output the line number you would use

{$smarty.foreach.foo.index}

[quote name=‘tbirnseth’]First you need to add a “name” to the foreach like:

{foreach name=“foo” from=$order_info.items item=“oi”}



When, when you want to output the line number you would use

{$smarty.foreach.foo.index}[/QUOTE]



Thanks a lot!



Used


{math equation="x + 1" x=$smarty.foreach.foo.index}



As your line starts from 0

yeah, like most things it probably starts at zero…