Jump to content

mail order confirmation without tax


Recommended Posts

Is it possible to show the prices excluding tax in the order confirmation?

I found out that the prices called in the mail_conf.html file are defined in the classes/PaymentModule.php but I can't figure out how to define a price without tax.

Thanks

Link to comment
Share on other sites

Yes, you just have to change the first parameter in the getOrderTotal() function calls from true to false. Do you want the tax to be included on the order, but excluded on the email that is sent? That may be confusing if the customer views their order history and sees different prices than the email they were sent.

  • Like 1
Link to comment
Share on other sites

Well, I have a B2B website. All prices on the website are nicely ex tax. But on the final invoice there has to be tax displayed as the other company of course has to pay taxes. In the cart and PDF invoice I got it all sorted out. Only the mail is quite a pain. So what I try to accomplish is that the product prices are -tax, the totals should also be -tax. But at the end I need to display the tax and the total + tax.

So something like this:

product                        price -tax
                              ------------ 
total                          total -tax
tax                            tax
                              ------------
total                          total +tax



If it matters, I have presta 1.3.1.1

Link to comment
Share on other sites

It is the following code in classes/PaymentModules.php that you need to change:

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



{total_paid} is the last total line above (so it should include tax), {total_products} is the product line above (so it should exclude tax). I'm not sure about the other two lines above. I guess you'll need to change new variables for them. As an example, you can remove the tax in the total products by changing the {total_products} line above to:

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



I hope it points you in the right direction.

Link to comment
Share on other sites

I ended up making some extra php variables:

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


I call those variables in the $data array :

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



I works fine now. There is only one thing bothering me. Here I use hard coded the tax rate:

$total_paid = $total_paid_notax * 1.19;


How to get that out??

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
  • 1 month later...

Have you tried going to Customers > Groups, editing the customer groups and changing "Price display method" to "Tax excluded"? If that doesn't do what you want, you will need to manually edit the code on lines 243 and 254:

'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt, $currency, false, false).'



Comment out the code so that the price without tax is always displayed. For example:

'.Tools::displayPrice(/*Product::getTaxCalculationMethod() == PS_TAX_EXC ? */$price/* : $price_wt*/, $currency, false, false).'

Link to comment
Share on other sites

Dear rocky,
one problem in Total price at (order_conf):
now if product price (without tx) is 14,35eur and quantity is 2pcs. then total price is shown 28,69eur (not 28,70eur as should) one cent is mising...

I think problem is with this line:

'.Tools::displayPrice((intval($product['cart_quantity']) - $customizationQuantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false, false).'

32125_VTI1KSa7KvsNC4LwoGHf_t

Link to comment
Share on other sites

Try using the Tools::ps_round function like this:

'.Tools::displayPrice(Tools::ps_round((intval($product['cart_quantity']) - $customizationQuantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), 2), $currency, false, false).'

Link to comment
Share on other sites

  • 3 months later...

Hej Klubas,

I've made some changes and for me it is ok. You can give it a try.

 

I have added this to PaymentModule.php.(around line 230)

 

$unit_price = Product::getPriceStatic($product['id_product'], (bool)(Product::getTaxCalculationMethod() == PS_TAX_INC), $product['id_product_attribute'], 2, NULL, false, true, $product['cart_quantity']);

The $unit_price calculation is now ok.

 

And i have changed the display within the td.

 

old situation

 

'.Tools::displayPrice((intval($product['cart_quantity']) - $customizationQuantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false, false).'

 

new situation

 

'.Tools::displayPrice(($unit_price * $product['cart_quantity']), $currency, false, false).'

Display with the rounded unit_price.

 

 

This is working for me in Version 1.3.2.3

Link to comment
Share on other sites

  • 8 months later...
  • 1 year later...

It is the following code in classes/PaymentModules.php that you need to change:

 

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

 

{total_paid} is the last total line above (so it should include tax), {total_products} is the product line above (so it should exclude tax). I'm not sure about the other two lines above. I guess you'll need to change new variables for them. As an example, you can remove the tax in the total products by changing the {total_products} line above to:

 

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

 

I hope it points you in the right direction.

 

I'm trying to do a similar thing with my shop (PS 1.5.1)

I understand to edit paymentmodules.php, but which file and where do I add the calculations for the new variables?

I would like to have shipping (without tax), Total (without tax), Total tax, Grand Total...

Link to comment
Share on other sites

  • 2 years later...
  • 10 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...