X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Extra Fields displayed in the Product Details pages (solved) (https://forum.x-cart.com/showthread.php?t=2474)

kpriest 04-27-2003 03:07 PM

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?

B00MER 04-28-2003 09:49 AM

:arrow: http://forum.x-cart.com/viewtopic.php?t=2655&highlight=extra+fields

kpriest 04-28-2003 07:21 PM

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...

machnhed1 04-29-2003 12:57 PM

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

kpriest 04-29-2003 05:04 PM

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}


machnhed1 04-30-2003 07:55 AM

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}



All times are GMT -8. The time now is 10:33 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.