Jump to content

Tax Formula Isnt Working Properly


CrossY

Recommended Posts

Hi there,

 

In a module for PDF invoice creation (not mine) there is a tax calculation, but it doesn't seem to work properly. It doesn't add the tax applied in the shop. Shop prices work fine.

$productPriceOld = $product['product_price'] + ($product['product_price']*($taxRate/100));

When I manually edit it to 21(% TAX) it does work:

$productPriceOld = $product['product_price'] + ($product['product_price']*(21/100));

Anyone knows how to fix this..? I don't think it's smart to manually manipulate the tax, especially for invoices...

 

Using Prestashop 1.5.4.1

 

Best,

Dave

Edited by CrossY (see edit history)
Link to comment
Share on other sites

Solved. Apparently the #taxRate wasnt built up or called in anywhere (you can tell i'm a programmer noob).

$total_price_tax_incl=$product['total_price_tax_incl'];
$total_price_tax_excl=$product['total_price_tax_excl'];
$taxRate = (($total_price_tax_incl-$total_price_tax_excl)/$total_price_tax_excl)*100;
$productPriceOld = $product['product_price'] + ($product['product_price']*($taxRate/100));

No idea how this relates to other modules/files.. but this worked for this module.

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