{assign var=x value=1} {foreach $alldata as $myproductdata} {capture assign=x}{$x+1}{/capture} {/foreach}