X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   template editing question (https://forum.x-cart.com/showthread.php?t=35842)

SystemSkins 12-01-2007 03:16 AM

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 ?

carpeperdiem 12-01-2007 05:16 AM

Re: template editing question
 
{if $_userinfo.default_fields.phone ne ""}{$order.phone}<br />{/if}

gotta love smarty!

SystemSkins 12-01-2007 05:38 AM

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?


All times are GMT -8. The time now is 07:05 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.