Jump to content

Problem adding tax to email template


Recommended Posts

I've tried following instructions in the forum about adding a line showing tax to the email template order_conf.html but have not had success with PS 1.5.2

 

I need to display the Product Price without tax and the to display the tax separately.

 

Here's what I have in PaymentModule.php:


$total_products_notax = $order->total_products;
$total_paid_notax = $order->total_products + $order->total_shipping + $order->total_wrapping - $order->total_discounts;
$total_tax = $order->total_paid - $total_paid_notax - $order->total_shipping; 

 

and

'{total_products_notax}' => Tools::displayPrice($total_products_notax),
'{total_tax}' => Tools::displayPrice($total_tax, $currency, false, false));

 

Here's what I'm getting: post-359796-0-03657700-1364908764_thumb.png

 

Help?

Link to comment
Share on other sites

I just spent the better part of an hour on it and can't figure it out. Had to take a break. I really want need the tax shown in the confirmation email, so I'll work on it a bit more tonight, but if I can't figure it out I'll probably just end up putting it in the paid services forum.

Link to comment
Share on other sites

I got this working. I was being dumb and had forgotten that I had previously made some edits to PaymentModule.php and the working copy was actually in the override/classes/ directory. I added this at line 440

$total_paid_notax = $order->total_products; + $order->total_shipping + $order->total_wrapping - $order->total_discounts;
 $total_tax = $order->total_paid - $total_paid_notax - $order->total_shipping;

 

And then in the array, edited to total_products line and added total_tax

'{total_products}' => Tools::displayPrice($order->total_paid - $total_tax - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $this->context->currency, false),
'{total_tax}' => Tools::displayPrice($total_tax, $currency, false),

 

Then made the corresponding changes in order_conf.html and order_conf.txt

  • Like 1
Link to comment
Share on other sites

No, that's not the place. Here's are the lines from my PaymentModule.php file, including the two new ones at the bottom:

// Send an e-mail to customer (one order = one email)
 if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id)
 {
  $invoice = new Address($order->id_address_invoice);
  $delivery = new Address($order->id_address_delivery);
  $delivery_state = $delivery->id_state ? new State($delivery->id_state) : false;
  $invoice_state = $invoice->id_state ? new State($invoice->id_state) : false;
  $total_paid_notax = $order->total_products; + $order->total_shipping + $order->total_wrapping - $order->total_discounts;
 $total_tax = $order->total_paid - $total_paid_notax - $order->total_shipping;

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 4 months later...
×
×
  • Create New...