View Single Post
  #15  
Old 09-27-2012, 04:54 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: Customize invoice based on product purchased

To get the total number of rows in the products array, try {$products|@count}

To know what the current index of the array is use {$smarty.foreach.myproducts.index} -to use .index or .iteration you need to name your foreach loop.
Example:
Quote:
{foreach from=$products item=product name=myproducts}
{$smarty.foreach.myproducts.index}
{/foreach}
Be warned that some of this is on the fringe of needing to be done in PHP. Smarty is a template engine used for presentation of data. Using it to perform logical operations is against the principles behind smarty. (purist nonsense to some)

Are you perhaps trying to determine how many of a certain product they bought? Then you would use {$product.amount}
__________________
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