bullywug Posted November 15, 2012 Share Posted November 15, 2012 At first I thought I was doing something wrong, like setting tax settings incorrectly but I've eliminated that as a possibility and it doesn't seem to fit the symptoms anymore anyway. What is happening is that when a customer places an order sometimes the order doesn't match the prices of the products they purchased. It's like it's taking another $0.50 or so off the product prices. Also, the PDF invoice disagrees on the prices from the order page which disagrees with the catalog. This is happening regularly and is very time consuming not to mention troublesome as I have two invoices for the customer with two different sets of values. Could anyone please provide some insight on this problem? Would upgrading to 5.2 help (we were planning on doing it but I've seen the posts about all the bugs), we are currently using 1.5.0.17. To summarize, we are having difficulties with prices charged to customers not matching prices listed on the website and neither of those prices matching the invoice in some instances. I've attached a recent order with this problem so you can see what I'm talking about. Faulty Customer Order.pdf Link to comment Share on other sites More sharing options...
bullywug Posted November 15, 2012 Author Share Posted November 15, 2012 I've just received another order that's off but this time it appears the sale prices are off in the front end. $31.95 - $3.00 sale = $29.30 according to Prestashop which is clearly wrong. I've checked this against the previous posted invoice and found that it too has sale prices which are inaccurate (they don't agree with themselves mathematically) however, when corrected these prices still do not reflect the prices (with or without tax) being displayed on the order page however, they do SEEM to be correctly reflected on the PDF invoice. Link to comment Share on other sites More sharing options...
bullywug Posted November 15, 2012 Author Share Posted November 15, 2012 Okay, more information. I have determined that the price Prestashop is using to compute the pre tax price of the items that are on sale is the price on the customers order page. This price does not match the regular price, posted sale price, real sale price, or any of these prices with tax. The PDF invoice reflects the correct sale price but not the correct totals or taxes. Anyhow, I'll keep posting if I come across anything new. Link to comment Share on other sites More sharing options...
benjamin utterback Posted November 15, 2012 Share Posted November 15, 2012 Hello bullywug, I think if you install 1.5.2 on a subdomain, many of your issues will be fixed. 1.5.2 included a good many bug fixes that may help you. If at all possible, just try it and ideally, build your store from a fresh install instead of doing an upgrade. How customized is your shop? what is your URL? Link to comment Share on other sites More sharing options...
bullywug Posted November 16, 2012 Author Share Posted November 16, 2012 Hello bullywug, I think if you install 1.5.2 on a subdomain, many of your issues will be fixed. 1.5.2 included a good many bug fixes that may help you. If at all possible, just try it and ideally, build your store from a fresh install instead of doing an upgrade. How customized is your shop? what is your URL? Our URL is www.kinkypiggy.ca (please be aware this is an adult fetish site so if you are easily offended please avoid). We were planning on working on the manual upgrade this weekend but if I'm understanding you correctly your saying that you think we should do a clean install on a subdomain? What would that mean for all the settings and customer and product data? We are using the default Prestashop theme and other than themes and imported data brought over from our old OSCommerce shop to Prestashop by Cart2Cart. The data migration did get botched but I manually edited every single product to fix their mistakes so I hope it's not the problem. Link to comment Share on other sites More sharing options...
bullywug Posted November 18, 2012 Author Share Posted November 18, 2012 Okay, so I did a manual upgrade on the Prestashop 1.5 to 1.5.2 software and the process shed some more light on the problem but failed to resolve it. It would appear to be a problem to do with the taxes. If a customer has a country with no tax or has not signed in, the sale prices are correct but as soon as they log in the sale prices go wonkie. I seriously doubt the problem is with my taxes as I did a lot of research and even spoke on the phone with Prestashop to be certain I was setting this complicated thing up right. If you have any advice I would greatly appreciate any suggestions you can provide. Otherwise, I will be forced to do a clean install and I really don't want to do that for obvious reasons. Link to comment Share on other sites More sharing options...
bullywug Posted November 19, 2012 Author Share Posted November 19, 2012 We have located the problem. It is a bug in the Prestashop code having to do with how it calculates tax on discounts. If you would like I can supply more detailed information. Link to comment Share on other sites More sharing options...
benjamin utterback Posted November 19, 2012 Share Posted November 19, 2012 Hello bullywug, thank you for the detailed information. Could you please describe the suspected bug in the PrestaShop code? I can try and check it as well. Link to comment Share on other sites More sharing options...
bullywug Posted November 24, 2012 Author Share Posted November 24, 2012 Hi Benjamin, I just wanted to update you. We're rushing right now to build and deploy a new Prestashop installation. This new installation, with data from a completely different source is manafesting the exact same error. The price shows propperly until user logs in at which point the price changes to look like it includes tax but it's not treated like it has tax included by the system which double taxes the customer. At least this is what it looks like. As soon as things get under control here I'll update you with the details from my IT person. Link to comment Share on other sites More sharing options...
rajpaul Posted November 25, 2012 Share Posted November 25, 2012 Hi, I am an associate of bullywug and a software developer by profession. I have modified the Prestashop code in the following manner that my testing so far looks to resolve the problems we are having. Under Canadian and U.S. retail practices, as I understand them, discounts to a product are a temporary reduction in the price for purposes of tax calculation. Prices are listed as "without tax". Taxes are then not calculated until the subtotal is brought up. What I saw in the Product class (classes/Product.php), in the priceCalculation() method, is that the Tax was getting added to the price and the reduction was happening afterward. This doesn't work for the Canadian retail environment. All price adjustments need to happen before tax is calculated. To that end, the changes I made to the priceCalculation() were as follows. These changes would have to be adjusted to generalize the code for all regions. But for this site it works. There are a series of comments identifying the various steps starting at line 2565 in the file for Prestashop 1.5.2. From there the headings (and their blocks of code) around this discussion are: // Attribute price // Tax // Add tax // Reduction // Group reduction // Eco tax Two changes were made: 1) Move the //Add Tax block out from in between // Tax and // Reduction and instead place it after // Group Reduction and just before the // Eco Tax block. 2) In the //Reduction block, for 'amount' reduction types, set the reduction simply to the reduction amount instead of being based on the $use_tax variable. Specifically, line 2596 changes from this: $reduc = Tools::ps_round(!$use_tax ? $product_tax_calculator->removeTaxes($reduction_amount) : $reduction_amount, $decimals); to this: $reduc = Tools::ps_round($reduction_amount, $decimals); As we don't use the Eco Tax feature, I haven't tested the impact of these changes with respect to that feature. I am attaching my modified Product.php class file. Product.php 1 Link to comment Share on other sites More sharing options...
Stransky Posted December 4, 2012 Share Posted December 4, 2012 We are a Canadian store and were having the same issue with taxes on reduced items. I tried your product.php file and it works! Thanks rajpaul! Link to comment Share on other sites More sharing options...
benjamin utterback Posted December 4, 2012 Share Posted December 4, 2012 Thank you bullywug and rajpaul for describing this issue. It seems that you have a solution that has worked for you and other customers. I will go ahead and mark this thread as Solved and change the title to something more helpful. Thanks guys! Link to comment Share on other sites More sharing options...
bullywug Posted December 6, 2012 Author Share Posted December 6, 2012 Benjamin, the fix still needs further testing. We are still witnessing problems with sale prices on products with combinations associated with them. We are continuing to research the problem, unfortunately, at best the problem is only partially solved. Please return thread to previous status (not solved). I promise I will update you when the issue is fully resolved. Thanks. Link to comment Share on other sites More sharing options...
S.Kinio Posted December 10, 2012 Share Posted December 10, 2012 (edited) The problem still isn't solved. I had fresh instalation of 1.5.2. Whit the orginal Product.php I have default price 100 (with 8% tax.). When I add 40% discount to this product i get 59,99 but only in cart, in product price column. The price of unit display corect and the price of whole cart is also corect. I replace Product.php from this topic and after that all prices was wrong whit amount 59,99. I was trying whit rounding in code some prices but it works whit one product, but when i multiple amount of product the price again miss about 0,01 ------------ UPDATE ------------ I solve my problem for now (i need to test this solution if it dosn't mess other thing). I figured out that maybe the price is rounded to fast and i lost 0.01 from price during that proces. So i just add in classes/Product.php in function priceCalculation (2479 line) at the begining: $decimals = 6; Just only this litle line and solve my problem. Dont know if it works for other similar problem. Edited December 10, 2012 by S.Kinio (see edit history) Link to comment Share on other sites More sharing options...
aboterf Posted March 9, 2013 Share Posted March 9, 2013 (edited) So... I just applied the "Fix" listed above to my Product.php file and nothing changed. As long as I'm using an Amount discount the taxes are not applied properly. Correction: I was able to verify that the "Fix" is working on all products that Do Not have combinations. Edited March 9, 2013 by aboterf (see edit history) Link to comment Share on other sites More sharing options...
rajpaul Posted March 20, 2013 Share Posted March 20, 2013 Folks, I found that for a complete solution I had to update a theme file as well. While the change to Product.php still proved to be effective once the customer went to check out, the price reflected on the product's page was not always reflecting the correct value. I found that there was some javascript that was also trying to apply the tax rules that were not compatible with the Canadian tax methodology and our intended shopping experience of calculating and displaying the sales tax only on the subtotal in the cart. For the default theme, there is a file at themes/default/js/product.js for which I commented out the tax rules and it worked for us. I am attaching the modified file for Prestashop 1.5.2. I found for another theme that we now use that the changes were virtually the same. Likewise for 1.5.3. Anyone looking at this file can use it in the default 1.5.2 theme. If you are on a different version or theme you'll need to compare the changes between the default 1.5.2 version of this file and this file in order to apply similar changes to other themes/versions. If you don't have access to the original version for comparison don't fret. The two changes I made in this file are marked with my name. Search for "Rajpaul" and you'll see the two changes. In each case, there are two lines of code after the comment line with my name that I have commented out. That constitutes the change that fixes this particular problem for us. Both sets of changes are very near to each other in the code (only a few lines apart) product-152.zip 1 Link to comment Share on other sites More sharing options...
Divyesh Prajapati Posted August 13, 2013 Share Posted August 13, 2013 I have applied specific discount price to product, and applied tax for specific state of us... Final Price of Product = ( Base Price * Tax to specific state ) - discount Is it right???? Link to comment Share on other sites More sharing options...
J.Sahu Posted November 15, 2013 Share Posted November 15, 2013 We need the tax to be calculated after discount but its going the opposite. Suppose a customer who is logged in with the address where a specific tax is calculated then the price shows differently. i.e more than the base price(tax included). Can some one give some idea to overcome from this ? Link to comment Share on other sites More sharing options...
Recommended Posts