Jump to content

Adding Email Address To Invoice


egoodman
 Share

Recommended Posts

1. modify ./classes/HTMLTemplateInvoice.php

a) find $data = array(....

$data = array(
            'order' => $this->order,
            'order_invoice' => $this->order_invoice,
            'order_details' => $order_details,
            'carrier' => $carrier,
            'cart_rules' => $cart_rules,
            'delivery_address' => $formatted_delivery_address,
            'invoice_address' => $formatted_invoice_address,
            'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address),
            'tax_excluded_display' => $tax_excluded_display,
            'display_product_images' => $display_product_images,
            'layout' => $layout,
            'tax_tab' => $this->getTaxTabContent(),
            'customer' => $customer,
            'footer' => $footer,
            'ps_price_compute_precision' => _PS_PRICE_COMPUTE_PRECISION_,
            'round_type' => $round_type,
            'legal_free_text' => $legal_free_text,
        );

b) add 'customer_email' => $customer->email,

$data = array(
            'order' => $this->order,
            'order_invoice' => $this->order_invoice,
            'order_details' => $order_details,
            'carrier' => $carrier,
            'cart_rules' => $cart_rules,
            'delivery_address' => $formatted_delivery_address,
            'invoice_address' => $formatted_invoice_address,
            'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address),
            'tax_excluded_display' => $tax_excluded_display,
            'display_product_images' => $display_product_images,
            'layout' => $layout,
            'tax_tab' => $this->getTaxTabContent(),
            'customer' => $customer,
            'footer' => $footer,
            'ps_price_compute_precision' => _PS_PRICE_COMPUTE_PRECISION_,
            'round_type' => $round_type,
            'legal_free_text' => $legal_free_text,
            'customer_email' => $customer->email,
        );

 

2. modify ./pdf/delivery-slip.addresses-tab.tpl

a) added {$delivery_address}<br />{$customer_email}

b) added {$invoice_address}<br />{$customer_email}

<table id="addresses-tab" cellspacing="0" cellpadding="0">
	<tr>
		<td width="33%"><span class="bold"> </span><br/><br/>
			{$order_invoice->shop_address}
		</td>
		{if !empty($invoice_address)}
			<td width="33%">{if $delivery_address}<span class="bold">{l s='Delivery Address' d='Shop.Pdf' pdf='true'}</span><br/><br/>
					{$delivery_address}<br />{$customer_email}  
				{/if}
			</td>
			<td width="33%"><span class="bold">{l s='Billing Address' d='Shop.Pdf' pdf='true'}</span><br/><br/>
				{$invoice_address}<br />{$customer_email}
			</td>
		{else}
			<td width="66%">{if $delivery_address}<span class="bold">{l s='Billing & Delivery Address' d='Shop.Pdf' pdf='true'}</span><br/><br/>
					{$delivery_address}<br />{$customer_email}
				{/if}
			</td>
		{/if}
	</tr>
</table>

 

3. clear cache

Share this post


Link to post
Share on other sites

8 hours ago, Guest said:

1. modify ./classes/HTMLTemplateInvoice.php

a) find $data = array(....

$data = array(
            'order' => $this->order,
            'order_invoice' => $this->order_invoice,
            'order_details' => $order_details,
            'carrier' => $carrier,
            'cart_rules' => $cart_rules,
            'delivery_address' => $formatted_delivery_address,
            'invoice_address' => $formatted_invoice_address,
            'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address),
            'tax_excluded_display' => $tax_excluded_display,
            'display_product_images' => $display_product_images,
            'layout' => $layout,
            'tax_tab' => $this->getTaxTabContent(),
            'customer' => $customer,
            'footer' => $footer,
            'ps_price_compute_precision' => _PS_PRICE_COMPUTE_PRECISION_,
            'round_type' => $round_type,
            'legal_free_text' => $legal_free_text,
        );

b) add 'customer_email' => $customer->email,

$data = array(
            'order' => $this->order,
            'order_invoice' => $this->order_invoice,
            'order_details' => $order_details,
            'carrier' => $carrier,
            'cart_rules' => $cart_rules,
            'delivery_address' => $formatted_delivery_address,
            'invoice_address' => $formatted_invoice_address,
            'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address),
            'tax_excluded_display' => $tax_excluded_display,
            'display_product_images' => $display_product_images,
            'layout' => $layout,
            'tax_tab' => $this->getTaxTabContent(),
            'customer' => $customer,
            'footer' => $footer,
            'ps_price_compute_precision' => _PS_PRICE_COMPUTE_PRECISION_,
            'round_type' => $round_type,
            'legal_free_text' => $legal_free_text,
            'customer_email' => $customer->email,
        );

 

2. modify ./pdf/delivery-slip.addresses-tab.tpl

a) added {$delivery_address}<br />{$customer_email}

b) added {$invoice_address}<br />{$customer_email}

<table id="addresses-tab" cellspacing="0" cellpadding="0">
	<tr>
		<td width="33%"><span class="bold"> </span><br/><br/>
			{$order_invoice->shop_address}
		</td>
		{if !empty($invoice_address)}
			<td width="33%">{if $delivery_address}<span class="bold">{l s='Delivery Address' d='Shop.Pdf' pdf='true'}</span><br/><br/>
					{$delivery_address}<br />{$customer_email}  
				{/if}
			</td>
			<td width="33%"><span class="bold">{l s='Billing Address' d='Shop.Pdf' pdf='true'}</span><br/><br/>
				{$invoice_address}<br />{$customer_email}
			</td>
		{else}
			<td width="66%">{if $delivery_address}<span class="bold">{l s='Billing & Delivery Address' d='Shop.Pdf' pdf='true'}</span><br/><br/>
					{$delivery_address}<br />{$customer_email}
				{/if}
			</td>
		{/if}
	</tr>
</table>

 

3. clear cache

Thank you for your help on this. I added everything mentioned and cleared the cache in the back end. My customer did a test order and the email address still doesn't show up. Please see the attached screen shot. This is a huge help to me so thank you again.

 

Edited by egoodman (see edit history)

Share this post


Link to post
Share on other sites

Don't quote for long posts.

I advised you how to add an email to a pdf invoice.
I don't know why you're showing me the administration?

Edited by Guest (see edit history)

Share this post


Link to post
Share on other sites

Modify other ./pdf/xxxxxxxx.addresses-tab.tpl

a) add after {$delivery_address}

<br />{$customer_email}

b) add after {$invoice_address}

<br />{$customer_email}
			

 

Share this post


Link to post
Share on other sites

You do not have to create a new order during testing !!!
Just open an order in the administration and view the PDF invoice.
Prestashop generates invoices from a database, does not physically store them on FTP !!!

Share this post


Link to post
Share on other sites

Create a new order and you will see that you will have an email written on the invoice.

Share this post


Link to post
Share on other sites

  • 1 year later...
  • 3 weeks later...

Yes it is, neich78!

Change the ./classes/pdf/HTMLTemplateDeliverySlip.php:

Search for  

$carrier = new Carrier($this->order->id_carrier);

and add above

$customer = new Customer((int)$this->order->id_customer);

Then add this line 

'customer_email' => $customer->email

to this array

$this->smarty->assign(array(
	'order' => $this->order,
	…
));

Clear the cache and generate a delivery slip of an existing order, as described above. Worked neat for me.

Edited by presn00b (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More