View Single Post
  #2  
Old 03-13-2015, 11:05 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Incrementally number in a Smarty template

I think you can make use of the iteration property. To do this I believe your foreach loop needs a name:
Code:
{foreach from=$orders.0.products item=prod name=products} {$smarty.foreach.products.iteration} {/foreach}

Another idea is to assign a variable and increment it yourself each time:
Code:
{assign var="increment" value=1} {foreach from=$orders.0.products item=prod name=products} Increment: {$increment} {assign var="increment" value=$increment+1} {/foreach}
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote