Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Variant Image

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #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
  #2  
Old 01-03-2008, 11:20 AM
 
Krista Williamson Krista Williamson is offline
 

Newbie
  
Join Date: Sep 2007
Posts: 4
 

Default Re: Variant Image

I know the issue is with my initial if statement
Quote:
{if $variants ne ""}

Does anyone know a good smarty variable to check against to see if the variant image contains a image or is blank.

Currently the above shows all the variant images in the product but also puts "X" images for variants that do not have their own image. I need to filter/remove the variant image display for those variants that do not have a image.

I tried various smarty variables but they seem to come across blank for the image and don't act as a proper flag.

Any suggestions would be greately appreciated.
__________________
Krista
X-Cart Pro v4.1.9
PHP 5.2.4
Server: Apache
Add-Ons: X-Magnifier, X-GiftRegistry, X-SpecialOffers, X-FancyCategories
Reply With Quote
  #3  
Old 12-20-2008, 09:06 PM
  fmoses's Avatar 
fmoses fmoses is offline
Banned
 

Senior Member
  
Join Date: Apr 2008
Posts: 155
 

Default Re: Variant Image

Have you been able to iron out this problem?
Reply With Quote
  #4  
Old 12-25-2008, 05:50 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Variant Image

Have you tried adding a check to see if the is a variant image to the template? something like..
Code:
{foreach name=variants from=$variants item=var} <td width="160"> {if $var.image_url ne ""} <img src="{$var.image_url}" width="200" height="200"> <br /> {/if} {foreach from=$var.options item=o} {$o.option_name} {/foreach}

Just a thoughy, I haven't checked it.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:06 AM.

   

 
X-Cart forums © 2001-2020