Jump to content

Base price (pre-tax) in product page does not agree with the `price` column in database


safius

Recommended Posts

For example, I have a product that costs ~1.02 pre-tax and is associated with a 13% tax rule. From the back-office, it says that the base price is ~1.16 (which is 1.03 plus 13% tax), and that the final price after tax is 13% more applied to the base price, which becomes 1.31.

I looked into the `Product` class, and it seems to be setting the `base_price` property directly from the `price` property, which in turn has been directly pulled from the database via the `fields` definition array. The `price` property is then recalculated, which should not affect `base_price` since the assignment was by value, not by reference.

I could not find any other line of code anywhere within PrestaShop where `base_price` is recalculated, and I can't find any evidence of the tax rate being hardcoded in the associated classes.

The attached screenshots are of another product, but the same problem arises. This time, however, the tax rate for the product has changed. The base price is after-tax, but calculated with the old tax rate, which prevents me from using the base price as the final price, as is.

post-1116251-0-83249200-1466773147_thumb.jpeg

post-1116251-0-43020800-1466773155_thumb.jpeg

Link to comment
Share on other sites

Edit: I have found the root of the problem. The "base price" is pulled not from the class property, but directly from the database table `ps_product_shop`, which has a base price calculated for every product associated with that store (which is every product in my catalog).

Now, this is what exactly went on. I had uploaded my catalog from the CSV Import tab, and at the time I set my price column in the CSV as 'Price (tax excl.)'. Some time afterwards, I was told that the prices were after tax, so I ran a query in the DB to change all the prices in `ps_product`. I was not aware that I had to run the query on `ps_product_shop` as well.

Link to comment
Share on other sites

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...