crystalized Posted March 2, 2011 Share Posted March 2, 2011 I am running v.1.3.7 and have a United States based shop. I am looking for a way to alter the order of shopping cart calculations. Basically I need voucher discounts to be calculated and THEN have taxes applied to the discounted total.For example, I have an item for $12.00 before taxes. I have a 25% off coupon to use. Shipping is $6.00. In the following example you can see that 5% state tax is applied to $12.00 instead of $9.00.Sub-Total: $ 12.00Total Coupons: -$ 3.00Total shipping (tax excl.): $ 6.00Total (tax excl.): $ 15.00Tax (5% VA State Tax): $ 0.60Total: $ 15.60Prestashop should calculate it like the following:Sub-Total: $ 12.00Total Coupons: -$ 3.00Total shipping (tax excl.): $ 6.00Total (tax excl.): $ 15.00Tax (5% VA State Tax): $ 0.45Total: $ 15.45I am not proficient in coding however I can follow any directions that you can provide. Any help would be much appreciated. Thank you in advance. Link to comment Share on other sites More sharing options...
crystalized Posted March 3, 2011 Author Share Posted March 3, 2011 Does anyone have any suggestions on what file to look at or any ideas? Link to comment Share on other sites More sharing options...
justhost Posted April 1, 2011 Share Posted April 1, 2011 HelloI am looking for a solution to the same issue? Does anyone have any insight? Link to comment Share on other sites More sharing options...
thewinefeed Posted April 26, 2011 Share Posted April 26, 2011 I have the same problem. Does anyone know how to fix this problem? Basically we are paying too much tax and losing money on every sale. It will be an accounting nightmare to convince the government that we don't actually owe them what our records indicate we do. Link to comment Share on other sites More sharing options...
epicureanfoods.com Posted May 10, 2011 Share Posted May 10, 2011 Hi,I'm certainly no expert in Prestashop but I have been very frustrated with the whole taxes issue myself. I think the best solution is to upgrade to 1.4 from everything I've read.Also - check your individual product tax rate because it will override the state tax rateGood luck!Phyllis Link to comment Share on other sites More sharing options...
milehigh Posted May 14, 2011 Share Posted May 14, 2011 This issue is in 1.4 and 1.41 as well. Just confirmed. I charge tax for Illinois orders...if I have a $15 voucher discount...and I'm not logged in as an Illinois user it correct discounts the amount of $15.If I'm logged in as an Illinois user... I shows a discount of $14.02. I still can't determine where the 98 cents comes into play. (Total order subtotal-$115, $8 shipping, 7% tax). Link to comment Share on other sites More sharing options...
hikiko Posted May 31, 2011 Share Posted May 31, 2011 I have the same problem in 1.41... ¿any update about this bug? Link to comment Share on other sites More sharing options...
gbaby Posted June 10, 2011 Share Posted June 10, 2011 I need this same fix too. If a customer has a voucher for $20, the voucher needs to be worth $20 before tax (see attached screenshot). If a customer enters a voucher code for $20 and the discount calculated is $17.86 they are not receiving their full discount. Right now PS calculates the discount of the grand total (product total after tax). It should calculate the discount off the subtotal (product total before tax). This is a necessity for both Canada & USA. Using PS 1.4.2.5 Link to comment Share on other sites More sharing options...
berta recchia Posted August 7, 2011 Share Posted August 7, 2011 Same here and running 1.4.3. Strange that no1 has a suggestion. The voucher / discount is reduced by the local tax amount. So customers don't get the full discount. I noticed there are few voucher bugs here: http://forge.prestashop.com/secure/IssueNavigator.jspa They show as unassigned. Link to comment Share on other sites More sharing options...
aliaspt Posted September 8, 2011 Share Posted September 8, 2011 Oh come on, Prestashop. This is a major issue and must be fixed! It is not the first time this is discussed and it is a shame there is no input from anyone. If the problem is money, I am sure many would pay to have this resolved. Link to comment Share on other sites More sharing options...
jwhiz Posted October 25, 2011 Share Posted October 25, 2011 I am having this exact problem - it seems to apply at different times! As a start up online biz, we are a losing customers before we can establish ourselves. Not amused. Link to comment Share on other sites More sharing options...
milehigh Posted October 27, 2011 Share Posted October 27, 2011 This bug is following through to 1.4.5.1. A $15 voucher is still showing up as $14.02. Link to comment Share on other sites More sharing options...
aliaspt Posted October 27, 2011 Share Posted October 27, 2011 What a shame. I can't believe they are not fixing that. Link to comment Share on other sites More sharing options...
jadess Posted November 12, 2011 Share Posted November 12, 2011 I was able to fix this to how I wanted after making some changes in cart.php. My code now calculates tax after the discounts are applied. It's a dirty, brute force hacked fix but works for me until there is an official fix.. I can share what I did if anyone's interested.. Link to comment Share on other sites More sharing options...
thewinefeed Posted November 12, 2011 Share Posted November 12, 2011 I was able to fix this to how I wanted after making some changes in cart.php. My code now calculates tax after the discounts are applied. It's a dirty, brute force hacked fix but works for me until there is an official fix.. I can share what I did if anyone's interested.. I would be interested in hearing what you did jadess. Thanks! Link to comment Share on other sites More sharing options...
crystalized Posted November 12, 2011 Author Share Posted November 12, 2011 I would also be interested. Any help would be incredibly appreciated! Link to comment Share on other sites More sharing options...
jadess Posted November 12, 2011 Share Posted November 12, 2011 Hello... This is what I did.. (by the way, I'm using 1.4.5.1) So in cart.php, there is a function getOrderTotal() Within this function, there's this segment: foreach ($products AS $product) { if ($this->_taxCalculationMethod == PS_TAX_EXC) { // Here taxes are computed only once the quantity has been applied to the product price $price = Product::getPriceStatic((int)$product['id_product'], false, (int)$product['id_product_attribute'], 2, NULL, false, true, $product['cart_quantity'], false, (int)$this->id_customer ? (int)$this->id_customer : NULL, (int)$this->id, ($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})); $price = $product['price']; $total_ecotax = $product['ecotax'] * (int)$product['cart_quantity']; $total_price = $price * (int)$product['cart_quantity']; if ($withTaxes) { $total_price = ($total_price - $total_ecotax) * (1 + (float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100); $total_ecotax = $total_ecotax * (1 + Tax::getProductEcotaxRate((int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) / 100); $total_price = Tools::ps_round($total_price + $total_ecotax, 2); } } else { $price = Product::getPriceStatic((int)($product['id_product']), true, (int)($product['id_product_attribute']), 2, NULL, false, true, $product['cart_quantity'], false, ((int)($this->id_customer) ? (int)($this->id_customer) : NULL), (int)($this->id), ((int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) ? (int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) : NULL)); $total_price = Tools::ps_round($price, 2) * (int)($product['cart_quantity']); if (!$withTaxes) $total_price = Tools::ps_round($total_price / (1 + ((float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100)), 2); } $order_total += $total_price; } I believe these particular line is what is calculating the taxes: $total_price = ($total_price - $total_ecotax) * (1 + (float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100); If you scroll further down, there is code that I believe figures the discount, so that is why I think it was being calculated before the discount was applied. So first I commented out this line within getOrderTotal() (I also don't use ecotax) $total_price = ($total_price - $total_ecotax) * (1 + (float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100); Near the end of the function, there's some lines of code like this: if ($type == Cart::ONLY_SHIPPING) return $shipping_fees; if ($type == Cart::ONLY_WRAPPING) return $wrapping_fees; if ($type == Cart::BOTH) $order_total += $shipping_fees + $wrapping_fees; if ($order_total < 0 AND $type != Cart::ONLY_DISCOUNTS) return 0; if ($type == Cart::ONLY_DISCOUNTS AND isset($order_total_discount)) Directly before those lines, I added this: if ($withTaxes) { $order_total = $order_total * (1 + (float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100); } I'm still testing to make sure I haven't broken anything else but so far seems to work how I want it to... Link to comment Share on other sites More sharing options...
jadess Posted November 12, 2011 Share Posted November 12, 2011 -- Link to comment Share on other sites More sharing options...
filehere Posted November 20, 2011 Share Posted November 20, 2011 Hello... This is what I did.. (by the way, I'm using 1.4.5.1) So in cart.php, there is a function getOrderTotal() Within this function, there's this segment: foreach ($products AS $product) { if ($this->_taxCalculationMethod == PS_TAX_EXC) { // Here taxes are computed only once the quantity has been applied to the product price $price = Product::getPriceStatic((int)$product['id_product'], false, (int)$product['id_product_attribute'], 2, NULL, false, true, $product['cart_quantity'], false, (int)$this->id_customer ? (int)$this->id_customer : NULL, (int)$this->id, ($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})); $price = $product['price']; $total_ecotax = $product['ecotax'] * (int)$product['cart_quantity']; $total_price = $price * (int)$product['cart_quantity']; if ($withTaxes) { $total_price = ($total_price - $total_ecotax) * (1 + (float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100); $total_ecotax = $total_ecotax * (1 + Tax::getProductEcotaxRate((int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) / 100); $total_price = Tools::ps_round($total_price + $total_ecotax, 2); } } else { $price = Product::getPriceStatic((int)($product['id_product']), true, (int)($product['id_product_attribute']), 2, NULL, false, true, $product['cart_quantity'], false, ((int)($this->id_customer) ? (int)($this->id_customer) : NULL), (int)($this->id), ((int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) ? (int)($this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) : NULL)); $total_price = Tools::ps_round($price, 2) * (int)($product['cart_quantity']); if (!$withTaxes) $total_price = Tools::ps_round($total_price / (1 + ((float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100)), 2); } $order_total += $total_price; } I believe these particular line is what is calculating the taxes: $total_price = ($total_price - $total_ecotax) * (1 + (float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100); If you scroll further down, there is code that I believe figures the discount, so that is why I think it was being calculated before the discount was applied. So first I commented out this line within getOrderTotal() (I also don't use ecotax) $total_price = ($total_price - $total_ecotax) * (1 + (float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100); Near the end of the function, there's some lines of code like this: if ($type == Cart::ONLY_SHIPPING) return $shipping_fees; if ($type == Cart::ONLY_WRAPPING) return $wrapping_fees; if ($type == Cart::BOTH) $order_total += $shipping_fees + $wrapping_fees; if ($order_total < 0 AND $type != Cart::ONLY_DISCOUNTS) return 0; if ($type == Cart::ONLY_DISCOUNTS AND isset($order_total_discount)) Directly before those lines, I added this: if ($withTaxes) { $order_total = $order_total * (1 + (float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100); } I'm still testing to make sure I haven't broken anything else but so far seems to work how I want it to... How do you comment this line, I don't see any changes? $total_price = ($total_price - $total_ecotax) * (1 + (float)(Tax::getProductTaxRate((int)$product['id_product'], (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) / 100); 1 Link to comment Share on other sites More sharing options...
AdiFletcher Posted December 3, 2011 Share Posted December 3, 2011 Thanks. This seems to be working fine now! I also had to make this change in the 'getValue' function of Discount.php to work in Canada so the voucher value was NOT tax inclusive... /* Absolute value */ case 2: // An "absolute" voucher is available in one currency only $currency = ((int)$cart->id_currency ? Currency::getCurrencyInstance($cart->id_currency) : Currency::getCurrent()); if ($this->id_currency != $currency->id) return 0; $taxDiscount = Cart::getTaxesAverageUsed((int)($cart->id)); if (!$useTax AND isset($taxDiscount) AND $taxDiscount != 1) // COMMENTED OUT THE NEXT LINE AND INSERTED THE ONE AFTER //$this->value = abs($this->value / (1 + $taxDiscount * 0.01)); $value = $this->value; // Main return Link to comment Share on other sites More sharing options...
drew_m Posted June 7, 2012 Share Posted June 7, 2012 I can confirm that the fix from jadess also seems to work with PS 1.4.7.0. Link to comment Share on other sites More sharing options...
luchiniii Posted September 19, 2012 Share Posted September 19, 2012 (edited) There is the same problem in PS 1.4.8.2. by the way, have you realized that in invoices shows the right prices, and discounts? Edited September 19, 2012 by luchiniii (see edit history) Link to comment Share on other sites More sharing options...
eliascooper Posted November 19, 2012 Share Posted November 19, 2012 (edited) Ive dont all the steps and seems to calculate correctly for dollar amount coupons but not on % based coupons.. any help would be greatly appreciated.. i am on prestashop 1.4.8.3 JC Edited November 19, 2012 by eliascooper (see edit history) Link to comment Share on other sites More sharing options...
J.Sahu Posted November 12, 2013 Share Posted November 12, 2013 Well the problem is still in PS 1.5.5. Still no fix to this. Link to comment Share on other sites More sharing options...
pandorrah Posted April 6, 2014 Share Posted April 6, 2014 Working with PS 1.5.6.1.Have the same problem: tax is calculated befóre the discount (see attachment) is given.I need tax to be calculated áfter discount. Link to comment Share on other sites More sharing options...
tuk66 Posted April 25, 2014 Share Posted April 25, 2014 Here is an example how it could look - http://www.presta-addons.com/pdf/invoice-1.4.6.2-m4pdf.jpg Link to comment Share on other sites More sharing options...
Ricardo1195 Posted September 14, 2016 Share Posted September 14, 2016 Sorry for giving a live to this topic again but is there a fix for this? Because I have a store with PrestaShop™ 1.6.0.13 and the discount is being applied to the final price, I want the discount being applied to the product but without taxes... So, in first place the discount must be applied to the total price of the products, and the taxes applies after the discount. Is there a fix for this? A module? Anything? I really search to a solution for this but seems to be impossible... Sorry for my english, i hope you understand. 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