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

Automatically hiding blank extra fields
 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #1  
Old 10-01-2003, 09:22 PM
  groovico's Avatar 
groovico groovico is offline
 

X-Man
  
Join Date: Apr 2003
Location: Firetanksoftware.com
Posts: 2,326
 

Default Automatically hiding blank extra fields

If you don't want extra fields to show up when they have no value (why would you...) then backup and replace your

/skin1/Modules/Extra_fields/Products.tpl with

Code:
{* $Id: product.tpl,v 1.0 2003 10 02 4:38:01 AP firetank Exp $ *} {section name=field loop=$extra_fields} {if $extra_fields[field].active eq "Y"} {assign var="showthis" value="no"} {if %field.index% eq 0}{if $product.param00 ne""}{assign var="showthis" value="yes"}{/if} {elseif %field.index% eq 1}{if $product.param01 ne""}{assign var="showthis" value="yes"}{/if} {elseif %field.index% eq 2}{if $product.param02 ne""}{assign var="showthis" value="yes"}{/if} {elseif %field.index% eq 3}{if $product.param03 ne""}{assign var="showthis" value="yes"}{/if} {elseif %field.index% eq 4}{if $product.param04 ne""}{assign var="showthis" value="yes"}{/if} {elseif %field.index% eq 5}{if $product.param05 ne""}{assign var="showthis" value="yes"}{/if} {elseif %field.index% eq 6}{if $product.param06 ne""}{assign var="showthis" value="yes"}{/if} {elseif %field.index% eq 7}{if $product.param07 ne""}{assign var="showthis" value="yes"}{/if} {elseif %field.index% eq 8}{if $product.param08 ne""}{assign var="showthis" value="yes"}}{/if} {elseif %field.index% eq 9}{if $product.param09 ne""}{assign var="showthis" value="yes"}{/if} {/if} {if $showthis eq "yes"} <tr><td width=30%> {$extra_fields[field].field}</td> </td> <td> {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}{else}{/if} </td> </tr> {/if} {/if} {/section}

This was tested with 3.4.5 - 3.4.8.

One day I'll understand why the extra field names aren't tied directly to paramXX fields by default since it's limited to 9 internally anyway...

If anyone has a better way of doing the above without changing the php file (i.e using smarty to do it) please post it. I couldn't (be bothered ) to find a way to build the param0X name dynamically in smarty so I could loop through it
__________________
Groovico

Used by X-carters the world over:
Marketing Manager Pro Bundle For X-cart
Featured Product Manager for X-cart
Feed manager pro for X-cart

http://www.firetanksoftware.com

Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X
Reply With Quote
  #2  
Old 10-02-2003, 05:25 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

it works and thats the main thing
__________________
ex x-cart guru
Reply With Quote
  #3  
Old 10-02-2003, 12:16 PM
  PhilJ's Avatar 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Location: UK
Posts: 3,576
 

Default

Thanks, good mod, ought to be standard
Reply With Quote
  #4  
Old 10-06-2003, 07:51 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Doesn't work so good in 3.3.8.

Useful but this mod made me realise that I don't need the extra fields. They are just more clutter on the product screen.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 11:55 AM.

   

 
X-Cart forums © 2001-2018