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

Show Field Only If Data Entered

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-28-2010, 12:29 PM
  photo's Avatar 
photo photo is offline
 

X-Wizard
  
Join Date: Feb 2006
Location: UK
Posts: 1,146
 

Default Show Field Only If Data Entered

We have Tax Number enabled in the User Profiles options section but would like it to only display on the invoice if a customer does indeed have a tax number. Is there a way to use an {if} statement to accomplish this?

Example for customer with a tax number,

First Name: John
Last Name: Doe
Company: Cakes Are Us
Tax Number: 1234567
Phone: 555 1212
E-Mail: john@cakesrus.com
URL: cakesville.com

Example for customer without a tax number,

First Name: John
Last Name: Doe
Company: Cakes Are Us
Phone: 555 1212
E-Mail: john@cakesrus.com
URL: cakesville.com

Below is the current {if} statement for that field.

Code:
{if $_userinfo.default_fields.tax_number}{$lng.lbl_tax_number|truncate:$max_truncate:"...":true|cat:":"|string_format:$max_space}{$order.tax_number} {/if}


Thanks
__________________
v4.1.10
In Dev v4.5.x


"If you don't keep an eye on your business, someone else will."
Reply With Quote
  #2  
Old 01-28-2010, 01:43 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Show Field Only If Data Entered

try this

{if $order.tax_number ne ""}
{if $_userinfo.default_fields.tax_number}{$lng.lbl_tax _number|truncate:$max_truncate:"...":true|cat:":"| string_format:$max_space}{$order.tax_number}
{/if}
{/if}
__________________
xcart 5.1.2
Reply With Quote
  #3  
Old 01-29-2010, 05:57 AM
  photo's Avatar 
photo photo is offline
 

X-Wizard
  
Join Date: Feb 2006
Location: UK
Posts: 1,146
 

Default Re: Show Field Only If Data Entered

Quote:
Originally Posted by Ashley
try this

{if $order.tax_number ne ""}
{if $_userinfo.default_fields.tax_number}{$lng.lbl_tax _number|truncate:$max_truncate:"...":true|cat:":"| string_format:$max_space}{$order.tax_number}
{/if}
{/if}

Thanks Ashley, I'll give this a try.
__________________
v4.1.10
In Dev v4.5.x


"If you don't keep an eye on your business, someone else will."
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 01:14 PM.

   

 
X-Cart forums © 2001-2020