Thread: Variant Image
View Single Post
  #1  
Old 01-01-2008, 08:22 PM
 
Krista Williamson Krista Williamson is offline
 

Newbie
  
Join Date: Sep 2007
Posts: 4
 

Post Variant Image - Display All Variant Images on Product - Filter "X"

The code below displays all available variant images for a product and their names (on the product page - product.tpl). The problem I am having is that if the variant has no image then what is displaying is a dead/missing image. What I would like is if a variant has no image then it would be completely excluded from displaying an image and its text. In other words only variants with images will show their image and name by this code. Any suggestions would be greatly appreciated!

Quote:
{if $variants ne ""}
<table cellpadding="0" cellspacing="0" border="0">
<tr>
{foreach name=variants from=$variants item=var}
<td width="160">
<img src="{$var.image_url}" width="200" height="200">
<br />
{foreach from=$var.options item=o}
{$o.option_name}
{/foreach}
<br /><br />
</td>
{if $smarty.foreach.variants.iteration is div by 3}
</tr>
<tr>
{elseif not $smarty.foreach.variants.last}
<td></td>
{/if}
{/foreach}
</tr>
</table>
{/if}
__________________
Krista
X-Cart Pro v4.1.9
PHP 5.2.4
Server: Apache
Add-Ons: X-Magnifier, X-GiftRegistry, X-SpecialOffers, X-FancyCategories

Last edited by Krista Williamson : 01-03-2008 at 11:17 AM. Reason: Updating title
Reply With Quote