Jump to content

Get products including correct tax


dhobo

Recommended Posts

Hi all,

 

I'm currently working on a new module that generates some output for a script, and I need to have a lot of product information in my module, including the price after tax has been added.

 

I know the product ID and the language ID, and I create a product like this:

 

$product = new Product($iProduct_id,false,$iLang_id);

 

the product price is then 2.73109, where it says on the product flypage of the same product that it's 2.95. I miss thus my 19% tax.

 

I then decided to create a product like this:

 

$product = new Product($iProduct_id,true,$iLang_id);

 

but it gave me a fatal error, because it goes wrong in the Product::getPriceStatic() method on the following statement:

 

 

if (!$id_cart AND !Validate::isCookie($cookie))
       die(Tools::displayError());

 

I thus need to have the $id_cart or a cookie available, now I have even a valid Cart ID in my module, so I use that to create a cookie object before creating the product:

 

 

$cookie = new Cookie(NULL,NULL,NULL);
$cookie->id_cart = $row['id_cart'];
$product = new Product($iProduct_id,true,$iLang_id);

 

which makes the error disappear, but still 2.73109 as price.

 

how can I get the price including tax in my 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...