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

template editing question

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-01-2007, 03:16 AM
  SystemSkins's Avatar 
SystemSkins SystemSkins is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 350
 

Default template editing question

I'm creating a custom invoice and was wondering how to do something.

In my customer's billing & shipping address boxes I want to add the customer's phone, fax, email, and website, but ONLY IF they entered them.

I have gone through and added this:
Code:
{if $_userinfo.default_fields.phone} {$order.phone}<br />{/if}

But if the user did not enter in a phone number then the field still adds the <br /> which on my invoice is creating a return space. With a few of these entries: email, web address, phone, fax you can see how it can add up to multiple return spaces if these fields are blank which will make my invoice look odd.

Can someone tell me how to do this to where only if the customer adds the info to these fields it will show up and if they omit them then they are omitted from my invoice as well and the return space isn't placed in. Am I putting the <br /> in the wrong place? or am I referencing the wrong thing by using userinfo.default_fields.phone ?
__________________
Doug Rock
X-cart Gold 4.1.9
_____________________________________
Altered Cart: 1-Page checkout
Firetank: Feed Manager
Website CM: CDSEO PRO
Website CM: Product A-Z Map
Website CM: Review Approval
Website CM: Site Map Pro
Qualiteam: Sales & Stats (free version)
Reply With Quote
  #2  
Old 12-01-2007, 05:16 AM
 
carpeperdiem carpeperdiem is offline
 

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

Default Re: template editing question

{if $_userinfo.default_fields.phone ne ""}{$order.phone}<br />{/if}

gotta love smarty!
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #3  
Old 12-01-2007, 05:38 AM
  SystemSkins's Avatar 
SystemSkins SystemSkins is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 350
 

Default Re: template editing question

Hrmmm, ok, This is what I have now:
Code:
<table><tr><td> {$order.s_firstname} {$order.s_lastname}<br /> {$order.s_address} {$order.s_address_2}<br /> {$order.s_city}, {$order.s_statename} {$order.s_zipcode}<br /> {$order.s_countryname}<br /> {if $_userinfo.default_fields.phone ne ""}{$order.phone}<br />{/if} {if $_userinfo.default_fields.fax ne ""}{$order.fax}<br />{/if} {if $_userinfo.default_fields.email ne ""}{$order.email}<br />{/if} {if $_userinfo.default_fields.url ne ""}{$order.url}<br />{/if} </td></tr></table>

I'm testing this by viewing a previous order through admin area and clicking on "print invoice". If my customer has added just an email address, I'm getting 2 blank spaces between the country and email. I thought with the ne "" it would not add the return spaces?
__________________
Doug Rock
X-cart Gold 4.1.9
_____________________________________
Altered Cart: 1-Page checkout
Firetank: Feed Manager
Website CM: CDSEO PRO
Website CM: Product A-Z Map
Website CM: Review Approval
Website CM: Site Map Pro
Qualiteam: Sales & Stats (free version)
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 06:16 AM.

   

 
X-Cart forums © 2001-2020