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

Extra Fields displayed in the Product Details pages (solved)

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-27-2003, 03:07 PM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default Extra Fields displayed in the Product Details pages (solved)

The product details page shows the Extra Field labels even when there is no data in the field. How can I nix the display of the Extra Fields on the product details page if there is no data in the field? Can I do it in the modules/Extra_Fields/product.tpl? How?
Reply With Quote
  #2  
Old 04-28-2003, 09:49 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

http://forum.x-cart.com/viewtopic.php?t=2655&highlight=extra+fields
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #3  
Old 04-28-2003, 07:21 PM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default

Quote:
You'll notice im commenting out some of the variables {* comment *}

Hmmm, that looks like you are just supressing the extra fields regardless of whether they have data in them. I need to supress the fields only if they contain no data. I believe someone else was asking for this as well...
Reply With Quote
  #4  
Old 04-29-2003, 12:57 PM
 
machnhed1 machnhed1 is offline
 

eXpert
  
Join Date: Feb 2003
Location: Illinois
Posts: 274
 

Default

Quote:
I need to supress the fields only if they contain no data. I believe someone else was asking for this as well...

That was me. Here is a link to my other post, maybe it will spark an idea or, dare I say it, a solution.

http://forum.x-cart.com/viewtopic.php?t=3147
__________________
Following the signature guidelines : xcart pro 3.5.8 - [RedHat]
Reply With Quote
  #5  
Old 04-29-2003, 05:04 PM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default Suppress Extra Fields if they contain no data - Solution

Problem was resolved here: http://forum.x-cart.com/viewtopic.php?p=13867#13867

...but here is the code anyway (modules/Extra_Fields/product.tpl):
Code:
{* $Id: product.tpl,v 1.2 2002/04/23 10:38:01 mav Exp $ *} {section name=field loop=$extra_fields} {if $extra_fields[field].active eq "Y"} <tr><td width=30%> {if %field.index% eq 0 and $product.param00 ne ""}{$extra_fields[field].field} {elseif %field.index% eq 1 and $product.param01 ne ""}{$extra_fields[field].field} {elseif %field.index% eq 2 and $product.param02 ne ""}{$extra_fields[field].field} {elseif %field.index% eq 3 and $product.param03 ne ""}{$extra_fields[field].field} {elseif %field.index% eq 4 and $product.param04 ne ""}{$extra_fields[field].field} {elseif %field.index% eq 5 and $product.param05 ne ""}{$extra_fields[field].field} {elseif %field.index% eq 6 and $product.param06 ne ""}{$extra_fields[field].field} {elseif %field.index% eq 7 and $product.param07 ne ""}{$extra_fields[field].field} {elseif %field.index% eq 8 and $product.param08 ne ""}{$extra_fields[field].field} {elseif %field.index% eq 9 and $product.param09 ne ""}{$extra_fields[field].field} {/if} </td> <td class="ProductPriceSmall"> {if %field.index% eq 0}{$product.param00} {elseif %field.index% eq 1}{$product.param01} {elseif %field.index% eq 2}{$product.param02} {elseif %field.index% eq 3}{$product.param03} {elseif %field.index% eq 4}{$product.param04} {elseif %field.index% eq 5}{$product.param05} {elseif %field.index% eq 6}{$product.param06} {elseif %field.index% eq 7}{$product.param07} {elseif %field.index% eq 8}{$product.param08} {elseif %field.index% eq 9}{$product.param09} {/if} </td> </tr> {/if} {/section}
Reply With Quote
  #6  
Old 04-30-2003, 07:55 AM
 
machnhed1 machnhed1 is offline
 

eXpert
  
Join Date: Feb 2003
Location: Illinois
Posts: 274
 

Default

Ok, here's the ultimate chunky code, but it tests each extra field and won't print even a blank row if it there' nothing to print - sort of a modified version of the code above.

Code:
{* $Id: product.tpl,v 1.3 2003/04/30 10:38:01 TSC Exp $ *} {if $extra_fields[0].active eq "Y" and $product.param00 ne ""} <tr> <td valign="top">{$extra_fields[0].field}</td> <td>{$product.param00}</A></td> </tr> {/if} {if $extra_fields[1].active eq "Y" and $product.param01 ne ""} <tr> <td valign="top">{$extra_fields[1].field}</td> <td>{$product.param01}</td> </tr> {/if} {if $extra_fields[2].active eq "Y" and $product.param02 ne ""} <tr> <td valign="top">{$extra_fields[2].field}</td> <td>{$product.param02}</td> </tr> {/if} {if $extra_fields[3].active eq "Y" and $product.param03 ne ""} <tr> <td valign="top">{$extra_fields[3].field}</td> <td>{$product.param03}</td> </tr> {/if} {if $extra_fields[4].active eq "Y" and $product.param04 ne ""} <tr> <td valign="top">{$extra_fields[4].field}</td> <td>{$product.param04}</td> </tr> {/if} {if $extra_fields[5].active eq "Y" and $product.param05 ne ""} <tr> <td valign="top">{$extra_fields[5].field}</td> <td>{$product.param05}</td> </tr> {/if} {if $extra_fields[6].active eq "Y" and $product.param06 ne ""} <tr> <td valign="top">{$extra_fields[6].field}</td> <td>{$product.param06}</td> </tr> {/if} {if $extra_fields[7].active eq "Y" and $product.param07 ne ""} <tr> <td valign="top">{$extra_fields[7].field}</td> <td>{$product.param07}</td> </tr> {/if} {if $extra_fields[8].active eq "Y" and $product.param08 ne ""} <tr> <td valign="top">{$extra_fields[8].field}</td> <td>{$product.param08}</td> </tr> {/if} {if $extra_fields[9].active eq "Y" and $product.param09 ne ""} <tr> <td valign="top">{$extra_fields[9].field}</td> <td>{$product.param09}</td> </tr> {/if}
__________________
Following the signature guidelines : xcart pro 3.5.8 - [RedHat]
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 12:35 AM.

   

 
X-Cart forums © 2001-2020