egoodman Posted June 2, 2020 Posted June 2, 2020 Prestashop 1.7.5.0 I want to add customer's email addresses to the order invoices so that it appears with the Customer's information. All help is appreciated. Share this post Link to post Share on other sites More sharing options...
Guest Posted June 3, 2020 Posted June 3, 2020 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 More sharing options...
egoodman Posted June 3, 2020 Posted June 3, 2020 (edited) 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 June 3, 2020 by egoodman (see edit history) Share this post Link to post Share on other sites More sharing options...
Guest Posted June 3, 2020 Posted June 3, 2020 (edited) 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 June 3, 2020 by Guest (see edit history) Share this post Link to post Share on other sites More sharing options...
egoodman Posted June 3, 2020 Posted June 3, 2020 (edited) I exported the PDF invoice and it is not there either. Edited June 3, 2020 by egoodman (see edit history) Share this post Link to post Share on other sites More sharing options...
Guest Posted June 3, 2020 Posted June 3, 2020 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 More sharing options...
Guest Posted June 3, 2020 Posted June 3, 2020 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 More sharing options...
egoodman Posted June 3, 2020 Posted June 3, 2020 YES!!! You sir rock big time!!! Thank you for being patient and helping me. Much appreciated. Share this post Link to post Share on other sites More sharing options...
Guest Posted June 3, 2020 Posted June 3, 2020 You can rate by clicking on the gray heart below my posts. Share this post Link to post Share on other sites More sharing options...
egoodman Posted June 3, 2020 Posted June 3, 2020 Now that we included it in the PDF invoice is there any way to include the email address in the actual order online? This will help a lot with future builds. Thanks! Share this post Link to post Share on other sites More sharing options...
Guest Posted June 3, 2020 Posted June 3, 2020 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 More sharing options...
neich78 Posted October 22, 2021 Posted October 22, 2021 Thanks for the tip. Is it possible to add this email info to delivery-slip PDFs? I cannot get it. Best! Share this post Link to post Share on other sites More sharing options...
presn00b Posted November 13, 2021 Posted November 13, 2021 (edited) 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 November 16, 2021 by presn00b (see edit history) Share this post Link to post Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now