View Single Post
  #2  
Old 06-07-2011, 12:24 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: foreach loop product.tpl

That code doesn't look quite right if you want to check each image. The first line should be within the foreach loop so it gets reset each time through.

It may be difficult to tell if the images are truly unique but you may be able to compare image URLs.

If you want to compare with the previous entry in the loop then store each one and compare (untested):
Code:
{assign var=oldImg value=""} {foreach from=$variants item=v key=vid} {if $v.is_image ne "" and $v.image_url ne $oldImg} ... {assign var=oldImg value=$v.image_url} {/if} {/foreach}
But if you truly want to ensure they are all unique this should be done in the php file.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote