Jump to content

Prestashop 1.7 add new variables into email total_shipping_tax_excl


sitte

Recommended Posts

I need delivery cost excluded tax in email confirmation. I made changes:

  1. in email translation order_conf I put {total_shipping_tax_excl}
  2. I made override in /override/classes/order/OrderHistory.php
    class OrderHistory extends OrderHistoryCore
    {   
        public function sendEmail($order, $template_vars = false)
        {
            $data = array(
                    '{total_shipping_tax_excl}' => Tools::displayPrice($order->total_shipping_tax_excl, $this->context->currency, false)
                );
            //die (print_r($data,true));    
            if ($template_vars) {
                    $data = array_merge($data, $template_vars);
                }
    
            return parent::sendEmail($order, $data);
        }
    }

     

Override works - if I make die (print_r($data,true)); I can see that proper value is in total_shipping_tax_excl key. Email translation works - I see new string {total_shipping_tax_excl} in email that I revice. But when email is sent then I have just {total_shipping_tax_excl} string.

I made change directly in /classes/order/OrderHistory.php but same - no results.

What am I missing?

 

 

Link to comment
Share on other sites

Below is value of $data var dropped from file: /classes/order/OrderHistory.php with code: die ('<pre>'.print_r($data,true).'</pre>');   right before  if (!Mail::Send(

Array
(
    [{total_shipping_tax_excl}] => 15,00 zł
    [{lastname}] => Machnik
    [{firstname}] => Bartosz
    [{id_order}] => 5036
    [{order_name}] => 201805036
    [{delivery_block_txt}] => test test
test
test
test
20-576 test
Polska
606281023
    [{invoice_block_txt}] => test test
test
test
test
20-576 test
Polska
606281023
    [{delivery_block_html}] => test test
test
test
test
20-576 test
Polska
606281023
    [{invoice_block_html}] => test test
test
test
test
20-576 test
Polska
606281023
    [{delivery_company}] => test
    [{delivery_firstname}] => test
    [{delivery_lastname}] => test
    [{delivery_address1}] => test
    [{delivery_address2}] => 
    [{delivery_city}] => test
    [{delivery_postal_code}] => 20-576
    [{delivery_country}] => Polska
    [{delivery_state}] => 
    [{delivery_phone}] => 606281023
    [{delivery_other}] => 
    [{invoice_company}] => test
    [{invoice_vat_number}] => test
    [{invoice_firstname}] => test
    [{invoice_lastname}] => test
    [{invoice_address2}] => 
    [{invoice_address1}] => test
    [{invoice_city}] => test
    [{invoice_postal_code}] => 20-576
    [{invoice_country}] => Polska
    [{invoice_state}] => 
    [{invoice_phone}] => 606281023
    [{invoice_other}] => 
    [{date}] => 2018-11-14 13:56:57
    [{carrier}] => Kurier
    [{payment}] => Płatność odroczona
    [{shipping_number}] => 
    [{total_paid}] => 120,53 zł
    [{total_products}] => 82,99 zł
    [{total_discounts}] => 0,00 zł
    [{total_shipping}] => 18,45 zł
    [{total_wrapping}] => 0,00 zł
    [{total_tax_paid}] => 22,54 zł
    [{paysistem_name}] => Płatność odroczona
)

 

 

Edited by sitte (see edit history)
Link to comment
Share on other sites

  • 2 years later...

Hi @sitte did you found solution?

I'm looking for similar think - I would like to add additional variable to confirmation email. My clients are in groups and I would like add that group to email - so then client knows that he's in discount group. 
Where should I add that variable to get access to it from email?

Thanks

Link to comment
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
×
×
  • Create New...