M.N Posted March 14, 2021 Share Posted March 14, 2021 As selling items with cost from 3 cents, VAT calculation for large quantity these items results big errors due to rounding. Can be avoided for invoices if to choose "Round on the total". However, in email order conformation the totals for products are not correct (rounded product prices and then multiplied by quantity) For avoiding the problem wanted to change order email conformation values to without taxes, and add VAT for summary only. The values are used in order_conf_product_list.tpl There it is simple, just replace value and if defined it will result difference in email. Defining happens in file PaymentModule.php for 1.7.7.2 starting from line 421 there is definition for email variables. First to are the needed ones of $price and $price_wt: Quote $price = Product::getPriceStatic((int) $product['id_product'], false, ($product['id_product_attribute'] ? (int) $product['id_product_attribute'] : null), 6, null, false, true, $product['cart_quantity'], false, (int) $order->id_customer, (int) $order->id_cart, (int) $order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}, $specific_price, true, true, null, true, $product['id_customization']); $price_wt = Product::getPriceStatic((int) $product['id_product'], true, ($product['id_product_attribute'] ? (int) $product['id_product_attribute'] : null), 2, null, false, true, $product['cart_quantity'], false, (int) $order->id_customer, (int) $order->id_cart, (int) $order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}, $specific_price, true, true, null, true, $product['id_customization']); price_wt should be price without tax? So if I add below field definitions for using them in tpl file, it looks like this: Quote 'price_wt' => Tools::getContextLocale($this->context)->formatPrice($price_wt * $product['quantity'], $this->context->currency->iso_code), 'unit_price_wt' => Tools::getContextLocale($this->context)->formatPrice($price_wt, $this->context->currency->iso_code), But as a result I still get prices with taxes. How to resolve it, is the there needed new definition and variable $price_wt is in reality with taxes or I refer to them not correctly? Original PaymentModule.php attached Please help! PaymentModule.php Link to comment 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