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

Not diplaying extra fields in certain instances

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-17-2006, 08:26 AM
 
alan_ alan_ is offline
 

Member
  
Join Date: Jul 2006
Posts: 20
 

Default Not diplaying extra fields in certain instances

I am using 2 extra fields for my products, but not every product is going to use the extra fields.

I would like to style the table that the extrafields are displayed in, but the problem is, I don't want the table to be displayed if the product isn't using the extrafields.

For example, if Product X is using at least 1 of the extra fields, then the styled table along with the extra field information is displayed on the product page. If Product Y is not using any of the extra fields then the styled table is not displayed.

Does anyone have any ideas on how this can be accomplished, or if it can be accomplished?
__________________
x-cart-4.0.18gold
Reply With Quote
  #2  
Old 08-17-2006, 08:53 AM
 
jdiehl jdiehl is offline
 

eXpert
  
Join Date: Dec 2003
Location: Kansas City, MO
Posts: 270
 

Default

Look at the code that displays the extra fields. It will use some sort of loop that runs through the variables and displays the title and value of each extra field stored for the products.

All you need to do is run an if statement to see if there is a value in the extra field first before displaying it. no value no display
__________________
Jason Diehl

Finding Cures for Your Online Headaches: http://www.internetmedicineman.com/
Reply With Quote
  #3  
Old 08-17-2006, 10:49 AM
 
alan_ alan_ is offline
 

Member
  
Join Date: Jul 2006
Posts: 20
 

Default

I had tried that, but the table is going to have a header, and footer with the two extra fields in between. If there aren't values for the extra fields, the table rows and cells won't display, but the header and footer will still display. I want to keep from having the whole table from being displayed if there are no values set for the extra fields.
__________________
x-cart-4.0.18gold
Reply With Quote
  #4  
Old 09-19-2006, 07:19 AM
 
burtsTechie burtsTechie is offline
 

Member
  
Join Date: Sep 2006
Posts: 20
 

Default Re: Not diplaying extra fields in certain instances

Alan- not sure if you got this figured out, but here's my solution to the same issue:

Code:
{* $Id: product.tpl,v 1.9 2005/11/21 12:42:06 max Exp $ *} {section name=field loop=$extra_fields} {if $extra_fields[field].active eq "Y" && $extra_fields[field].field_value} {if $firstPass ne 1} <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td colspan="2"> <b><font class="ProductDetailsTitle">details</font></b> </td> </tr> <tr> <td class="Line" height="1" colspan="2"><img src="{$ImagesDir}/spacer.gif" class="Spc" alt="" /></td> </tr> <tr><td colspan="2">&nbsp;</td></tr> {assign var="firstPass" value="1"} {/if} <tr> <td width="30%">{$extra_fields[field].field}</td> {include file="milk_type_thumbnail.tpl"} </tr> {/if} {/section} {if $firstPass eq 1} </table> <p /> {/if}

I wanted the extra fields to be in their own table in the main product.tpl page, but didn't want that table to show up if no extra fields were present. This 'product.tpl' page is in the modules/extra_fields folder!
__________________
X-Cart Version: 4.15 (in development)
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 10:12 AM.

   

 
X-Cart forums © 2001-2020