Jump to content

calcul ecotax


Recommended Posts

Hello, i have a big problem with the ecotax.

I found the method, but i don't now how to apply it.

i've wrote this in cart.php :

 		$productsHT = 0;
        $ecotaxes = 0;
        foreach ($products as $product) {
            $productsHT += $product['reduction_without_tax'] * $product['cart_quantity'];
            $ecotaxes += $product['ecotax'] * $product['cart_quantity'];
        }

        $shipping = 45 ;//frais de port
        $productetshipping = $productsHT + $ecotaxes + $shipping;
        $taxAmount = ($productetshipping * 20) / 100;
        $totalAmount = $productsHT + $taxAmount + $shipping + $ecotaxes;

        $value = $withTaxes ? $totalAmount : $totalAmount - $taxAmount - $ecotaxes; // changer cette ligne pour inclure $totalAmount dans $value
        return Tools::ps_round($value, $computePrecision);

I have the good result in ttc and ht but i don't know how to retrieve the good shipping cost

Now the value discount in the cart is the same as the total without taxes .

The total taxes amount as un error too, it add  $ecotaxes.

Is it understandable.

Is there someone to help me please ?

 

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