Arnaud Drieux Posted February 11, 2015 Share Posted February 11, 2015 (edited) Bonjour à toutes et à tous. Après pas mal de recherches sur le forum et les changelogs de la 1.5, voici le problème que je rencontre depuis plusieurs jours maintenant sur ma boutique en 1.5.6.1. Si je suis un client avec un groupe qui affiche les prix en TTC, tout est ok.Si je suis un client avec un groupe qui affiche les prix en HT, le montant total des taxes est légèrement différent... Exemple: En HT -> Total taxes : 12,05.En TTC -> Total taxes : 12,07. Résultat, cela influe sur le prix final.De plus, je pense que cela impact le retour boutique après paiement qui va afficher le message d'erreur du type "Erreur de paiement" : Attention 649,00 € payé au lieu de 649,86 €Comment cela est possible ? Comment débugger ce problème? Merci d'avance. EDIT : Au dernier moment, le bon post... Solution trouvée ici : https://www.prestashop.com/forums/topic/235504-tax-is-calculated-wrong-in-prestashop-it-has-to-be-not-just-me-but-everyone/?p=1160341 1- Dans votre classe/Cart.php.2- Dans la fonction getOrderTotal(),3- Dans le foreach foreach ($products as $product) // products refer to the cart details4- Dans la condition if ($this->_taxCalculationMethod == PS_TAX_EXC)5- Dans la condition, if ($with_taxes) remplacer if ($with_taxes) { $product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id, $virtual_context); $product_eco_tax_rate = Tax::getProductEcotaxRate((int)$address_id); $total_price = ($total_price - $total_ecotax) * (1 + $product_tax_rate / 100); $total_ecotax = $total_ecotax * (1 + $product_eco_tax_rate / 100); $total_price = Tools::ps_round($total_price + $total_ecotax, 2); } par if ($with_taxes) { $product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id, $virtual_context); $product_eco_tax_rate = Tax::getProductEcotaxRate((int)$address_id); $total_price = Tools::ps_round(($price - $product['ecotax']) * (1 + $product_tax_rate / 100),2); $total_price = $total_price * (int)$product['cart_quantity']; } Edited February 11, 2015 by arnaud1900 (see edit history) Link to comment Share on other sites More sharing options...
Arnaud Drieux Posted May 25, 2015 Author Share Posted May 25, 2015 (edited) Légère modification : Toujours dans la même condition, changer : if ($with_taxes) { [...code précédent] $total_price = $total_price * (int)$product['cart_quantity']; } pour : if ($with_taxes) { [...code précédent] $total_price = Tools::ps_round($total_price * (int)$product['cart_quantity'],2); } Edited May 25, 2015 by arnaud1900 (see edit history) 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