Jump to content

Mail Alerts - Products W/O Tax


Recommended Posts

Hi:    Prestashop 1.4.7, mailalerts 2.2

 

I am trying to get the New order email to show the product prices W/O tax but can not seem to figure it out.

I have this working fine for the Order-confirmation mail, and have added a separate tax line to both.

 

This is the code I am working with from mailalerts.php:

red=original

blue=modified 

green=added

 

'{total_paid}' => Tools::displayPrice($order->total_paid, $currency),
'{total_products}' => Tools::displayPrice($order->getTotalProductsWithTaxes(), $currency),
'{total_products}' => Tools::displayPrice($order->getTotalProductsWithOutTaxes(), $currency),
 
'{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $currency, false),
 
'{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency),
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency),
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency),
'{currency}' => $currency->sign,
'{message}' => $message
);
 
 
As you can see I have modified the {total_products} line just at getTotalProducts this does make the Products line below the individual products show total without tax I just can't seem to find where to change the individual products to show without taxes already included in the price.
You can aslo see that I have added {total_tax_paid} to this and PaymentModule.php along with the {total_tax_paid} to the emails this works fine.
 
Any help is appreciated.
Edited by tdr170 (see edit history)
Link to comment
Share on other sites

Ok got it sorted out and was much simpler then expected.

 

Here is what I did so that both the mail sent to customer (order-confirmation) and the mail sent to me (new-order) showed the products without tax included and have a separate tax line.

 

First start with classes/PaymentModule.php in the // Send an e-mail to customer section change 1 line and add 1 line.

 

Change this:

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

 

To this:

'{total_products}' => Tools::displayPrice($order->total_products),

 

Add this for the separate tax line:

'{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $currency, false),

 

 

Now add the tax line to the order-conf.html and .txt files:

 

I added this just after shipping and before total paid: (html)

<tr style="text-align:right;">
<td> </td>
<td style="background-color:#EBECEE; padding:0.6em 0.4em;" colspan="3">Sales Tax</td>
<td style="background-color:#EBECEE; padding:0.6em 0.4em;">{total_tax_paid}</td>
</tr>
 
This to text file:
Sales Tax: {total_tax_paid}
 
 
 
Now in the MailAlerts module we need to edit the mailalerts.php file:
 
Find this and remove the _wt
 
$unit_price = $product['product_price_wt];
$price = $product['total_price'];
 
 
Now change 1 line and add 1 line:
 
Change this:
'{total_products}' => Tools::displayPrice($order->getTotalProductsWithTaxes(), $currency),
 
To this:
'{total_products}' => Tools::displayPrice($order->getTotalProductsWithOutTaxes(), $currency),
 
Add this for separate tax line:
'{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $currency, false),
 
Now add the tax line to the new-order.html and .txt files I once again added after shipping before total:
 
<tr style="text-align:right;">
<td colspan="4" style="background-color:#EBECEE; padding:0.6em 0.4em;">Sales Tax</td>
<td style="background-color:#EBECEE; padding:0.6em 0.4em;">{total_tax_paid}</td>
</tr>
 
and this to txt file.
Sales Tax: {total_tax_paid}
 
 
This is what you should end up with in this case the unit price and product price are shown without tax the total products line is without tax and a separate tax line is shown.
I also removed the Gift Wrapping line as we do not offer:
 
 
 
post-310220-0-84192200-1399572352_thumb.jpg

 

Edited by tdr170 (see edit history)
  • Like 3
Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...
  • 4 months later...
  • 2 months later...

PrestaShop 1.6 - Mail Alerts Module v3.4 Modification

I need to add the "product image" to the order confirmation mail

By default there's no visible the product images, only shows the Name, Price and Quantity.
I want to add the product's small image too to each table row in the notification email template.

Any help is appreciated.
 

Sorry for my english :) 

 

Link to comment
Share on other sites

  • 11 months later...

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...