View Single Post
  #4  
Old 11-01-2012, 04:55 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: Extra Fields if statement

THIS is NOT TESTED SPECIFICALLY, but based on code that works. This should get you started.

1. verify the extra field content is available on your page (use webmaster mode)
2. define a variable, $test for the extra field, "testing". The if code makes sure there is something there, else it ignores.

Code:
{section name=field loop=$extra_fields} {if $extra_fields[field].field eq "testing" && $extra_fields[field].field_value ne ""} {assign var="test" value=$extra_fields[field].field_value} {/if} {/section}

3. place your variable in a div with inline css. The if makes sure something is there, else it ignores. If $test is empty, nothing happens. If test has something in it, it will display the <div> - which is set to not display anything using css, style="display:none;"

Code:
{if $test ne ""} <div style="display:none;">TESTING CONTENT GOES HERE</div> {/if}

The logic is: "is there anything in the test field? If so, do not display the content.

Hope this helps in some way.

J
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote