How To Add Email Address To Invoice.tpl (Need Details)

I have been trying to have the customer's email address show up on the printed invoice with no luck. I tried adding this code to my invoice.tpl:



{if $order_info.s_email && $profields_s.s_email}



{if $profields_s.s_email}{$order_info.s_email} {/if}



{/if}



This is so confusing for me, so if you have detailed instructions, I would really appreciate it.



It seems like the email address should be printed on the invoice as the default.



Thanks in advance!



Mindy

There is no 's_email'. Use 'email' instead ($order_info.email).

I am not sure where to put the code. Here is my template code:





{hook name=“orders:invoice_customer_info”}

{if !$profile_fields}

{assign var=“profile_fields” value='I'|fn_get_profile_fields}

{/if}

{if $profile_fields}





{if $profile_fields.C}

{assign var=“profields_c” value=$profile_fields.C|fn_fields_from_multi_level:“field_name”:“field_id”}



{/if}

{if $profile_fields.B}

{assign var=“profields_b” value=$profile_fields.B|fn_fields_from_multi_level:“field_name”:“field_id”}



{/if}

{if $profile_fields.S}

{assign var=“profields_s” value=$profile_fields.S|fn_fields_from_multi_level:“field_name”:“field_id”}



{/if}





{(“customer”)}:



{if $profields_c.firstname}{$order_info.firstname} {/if}{if $profields_c.lastname}{$order_info.lastname}{/if}



{if $profields_c.email}

{$order_info.email}

{/if}

{if $profields_c.phone}

{(“phone”)}: {$order_info.phone}

{/if}

{if $profields_c.fax && $order_info.fax}

{(“fax”)}: {$order_info.fax}

{/if}

{if $profields_c.company && $order_info.company}

{(“company”)}: {$order_info.company}

{/if}

{if $profields_c.url && $order_info.url}

{(“url”)}: {$order_info.url}

{/if}

{include file=“profiles/profiles_extra_fields.tpl” fields=$profile_fields.C}



{(“bill_to”)}:



{if $order_info.b_firstname && $profields_b.b_firstname || $order_info.b_lastname && $profields_b.b_lastname}



{if $profields_b.b_firstname}{$order_info.b_firstname} {/if}{if $profields_b.b_lastname}{$order_info.b_lastname}{/if}



{/if}

{if $order_info.b_address && $profields_b.b_address || $order_info.b_address_2 && $profields_b.b_address_2}



{if $profields_b.b_address}{$order_info.b_address} {/if}{if $profields_b.b_address_2}
{$order_info.b_address_2}{/if}



{/if}

{if $order_info.b_city && $profields_b.b_city || $order_info.b_state_descr && $profields_b.b_state || $order_info.b_zipcode && $profields_b.b_zipcode}



{if $profields_b.b_city}{$order_info.b_city}{if $profields_b.b_state},{/if} {/if}{if $profields_b.b_state}{$order_info.b_state_descr} {/if}{if $profields_b.b_zipcode}{$order_info.b_zipcode}{/if}



{/if}

{if $order_info.b_country_descr && $profields_b.b_country}



{$order_info.b_country_descr}



{/if}

{if $order_info.b_phone && $profields_b.b_phone}



{if $profields_b.b_phone}{$order_info.b_phone} {/if}



{/if}

{include file=“profiles/profiles_extra_fields.tpl” fields=$profile_fields.B}



{__(“ship_to”)}:



{if $order_info.s_firstname && $profields_s.s_firstname || $order_info.s_lastname && $profields_s.s_lastname}



{if $profields_s.s_firstname}{$order_info.s_firstname} {/if}{if $profields_s.s_lastname}{$order_info.s_lastname}{/if}



{/if}

{if $order_info.s_address && $profields_s.s_address || $order_info.s_address_2 && $profields_s.s_address_2}



{if $profields_s.s_address}{$order_info.s_address} {/if}{if $profields_s.s_address_2}
{$order_info.s_address_2}{/if}



{/if}

{if $order_info.s_city && $profields_s.s_city || $order_info.s_state_descr && $profields_s.s_state || $order_info.s_zipcode && $profields_s.s_zipcode}



{if $profields_s.s_city}{$order_info.s_city}{if $profields_s.s_state},{/if} {/if}{if $profields_s.s_state}{$order_info.s_state_descr} {/if}{if $profields_s.s_zipcode}{$order_info.s_zipcode}{/if}



{/if}

{if $order_info.s_country_descr && $profields_s.s_country}



{$order_info.s_country_descr}



{/if}

{if $order_info.s_phone && $profields_s.s_phone}



{if $profields_s.s_phone}{$order_info.s_phone} {/if}



{/if}

{include file=“profiles/profiles_extra_fields.tpl” fields=$profile_fields.S}



{/if}

{/hook}

{* Customer info *}









Thanks so much for your help!



Mindy

Mindy, You need to use “code” tags so it's readable. Can't help you with where you want to place it, can only give you the variable to reference it.

Can anyone else give me some direction please??

MIndy,



Tony gave you the correct code to use but it is up to you where you want to place it because we don't know where exaclty you want it.


```php {if $order_info.email}


{$order_info.email}


{/if} ```

Im also puzzeld by this.



I have in profile fields:[list]

[]Customer information

[
]Billing information

[*]Shipping information

[/list]

I also want to add the email adres to the invoice. I have this working but now the clients need to input the email adres twice. When i deleted the email field in Customer information the emailadres is not visible on the invoice.



There is an email field in Billing information that i cant delete or turn of or on. I guess this is used for the “use email adres as login” But this field won't show the email adres on the invoice.



I just want clients to input the email adres, name en then move on to the billing and shipping info where they can fill out the rest.



Is there a way to achieve this?



Thanks,

I have tried:



{if $profields_b.email}

{$order_info.b_email}{if $order_info.email}





{$order_info.b_email}



I think the b in the tag is for the billing section. However this does not work. Any thoughts?



Thanks. If you are a developer please give me a quote on adding this. Thanks.

Please try



{if $order_info.email}

{$order_info.email}

{/if}

[quote name='eComLabs' timestamp='1436430799' post='222196']

Please try



{if $order_info.email}

{$order_info.email}

{/if}


[/quote]



Thank you, that is already in there. With this methode the email adres wont show on the invoice untill i add the email field in customer info profile field. because there is a email field in the billing section that i cant edit the email field will show double at checkout.

In the admin templae, add this line where you want it:

{if $profields_b.email}

{$order_info.email}

{/if}

It should already be there in the customer template.



The 3 sections are intended to be completely different. The “contact” section generally equates to the user's profile info. The “billing” and “shipping” are usually considered unique to an order. Though they are usually pre-filled when a customer is logged in.

[quote name='tbirnseth' timestamp='1436464092' post='222306']

In the admin templae, add this line where you want it:

{if $profields_b.email}

{$order_info.email}

{/if}

It should already be there in the customer template.



The 3 sections are intended to be completely different. The “contact” section generally equates to the user's profile info. The “billing” and “shipping” are usually considered unique to an order. Though they are usually pre-filled when a customer is logged in.

[/quote]



Thank you, i have tried this But it does not work. Tony, can you have a look please? Im willing to pay you for your efforts. please let me know the price to fix this.



PM me if you have the chance.



Thanks.

[quote name='Snuggertje' timestamp='1436433024' post='222206']

Thank you, that is already in there. With this methode the email adres wont show on the invoice untill i add the email field in customer info profile field. because there is a email field in the billing section that i cant edit the email field will show double at checkout.

[/quote]



Your configuration is not quite clear. Please demo store:



Instant Demo - CS-Cart Multi-Vendor Demo Try Free for 15 days



The e-mail field exists in the Billing address section. But the value of this field can be displayed by the $order_info.email variable on the invoice templates. There is no need to use s_ or b_ prefix

[quote name='eComLabs' timestamp='1436514883' post='222365']

Your configuration is not quite clear. Please demo store:



http://demo.cs-cart…e_fields.manage



The e-mail field exists in the Billing address section. But the value of this field can be displayed by the $order_info.email variable on the invoice templates. There is no need to use s_ or b_ prefix

[/quote]





the demo is just the same. however i have to add the emailadres field to the customer profile fields to show the email on the invoice. otherwise it just wont work. Because there is already a email field in the billing section the email input fields shows twice on checkout.



i have added the field in the demo.



Thanks.

Also, i just made an order and the email adres is not showing on the printed invoice in de demostore either. cant tell for the customer email invoice because the demo is not sending out emails.



regards.

[quote name='Snuggertje' timestamp='1436519264' post='222391']

Also, i just made an order and the email adres is not showing on the printed invoice in de demostore either. cant tell for the customer email invoice because the demo is not sending out emails.



regards.

[/quote]



I just added the email adres in de profile and now the email adres shows on the invoice. But even in de demo, i have to fill in de email adres twice as a customer. check it out!

Again, the 3 are separate. Code changes can be done to use the Contact email as the default if not set in profile fields. I.e. if there is no email value set, use the contact email as the “pre-fill” for the field.