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)
-   -   Address Line 2 in Invoice (https://forum.x-cart.com/showthread.php?t=18086)

craigbrass 11-19-2005 05:58 AM

Address Line 2 in Invoice
 
Hello,

For the shipping and billing address', I get the following shown inside the invoices :-
Billing Address
David Ullswater,
sadfsdfhsdf,
,
yrewyery,
Worcestershire,
cfghsfghf,
United Kingdom (Great Britain)

Shipping Address
David Ullswater,
sadfsdfhsdf,
,
yrewyery,
Worcestershire,
cfghsfghf,
United Kingdom (Great Britain)

Notice the 3rd line of each is ",". This is where the Address Line 2 should go. How do I get it so if the user doesn't enter an address line 2, it isn't shown on the invoice?

My code for each is as follows :-

Billing Address
Code:

{if $_userinfo.default_fields.firstname}{$order.b_firstname}{/if}
{if $_userinfo.default_fields.lastname}{$order.b_lastname}{/if},

{if $_userinfo.default_fields.b_address}{$order.b_address},
{/if}
{if $_userinfo.default_fields.b_address_2}{$order.b_address_2},
{/if}
{if $_userinfo.default_fields.b_city}{$order.b_city},
{/if}
{if $_userinfo.default_fields.b_county && $config.General.use_counties eq 'Y'}{$order.b_countyname},
{/if}
{if $_userinfo.default_fields.b_state}{$order.b_statename},
{/if}
{if $_userinfo.default_fields.b_zipcode}{$order.b_zipcode},
{/if}
{if $_userinfo.default_fields.b_country}{$order.b_countryname}{/if}


Shipping Address
Code:

{if $_userinfo.default_fields.firstname}{$order.s_firstname}{/if}
{if $_userinfo.default_fields.lastname}{$order.s_lastname}{/if},

{if $_userinfo.default_fields.s_address}{$order.s_address},
{/if}
{if $_userinfo.default_fields.s_address_2}{$order.s_address_2},
{/if}
{if $_userinfo.default_fields.s_city}{$order.s_city},
{/if}
{if $_userinfo.default_fields.s_county && $config.General.use_counties eq 'Y'}{$order.s_countyname},
{/if}
{if $_userinfo.default_fields.s_state}{$order.s_statename},
{/if}
{if $_userinfo.default_fields.s_zipcode}{$order.s_zipcode},
{/if}
{if $_userinfo.default_fields.s_country}{$order.s_countryname}{/if}


Best Regards,
Craig Brass

rubyaryat 11-19-2005 10:11 AM

You want to enclose the statement in another if statement to check if the field is empty.
e.g.
{if $order.b_address_2}{if $_userinfo.default_fields.b_address_2}{$order.b_ad dress_2},
{/if}{/if}

Rubyaryat

craigbrass 11-20-2005 02:42 AM

Worked perfectly, thanks!

begeren 12-19-2005 11:06 PM

Which template can you find the above code in?

Dongan 12-19-2005 11:36 PM

Quote:

Originally Posted by begeren
Which template can you find the above code in?


skin1/mail/html/order_invoice.tpl to be edited.


All times are GMT -8. The time now is 01:43 PM.

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