$item_total = $price * $quantity; // show tax below product if such option set $t->set_var("item_taxes", ""); foreach ($tax_values as $tax_id => $tax_info) { $show_type = $tax_info["show_type"]; if ($show_type & 2) { $t->set_var("tax_name", $tax_info["tax_name"]); $t->set_var("quantity", $quantity); $t->set_var("tax_amount", currency_format($tax_info["tax_amount"])); $t->set_var("tax_amount_total", currency_format($tax_info["tax_amount"] * $quantity)); $t->parse("item_taxes", true); } } // summary calculations $item_tax_total_values = get_tax_amount($tax_rates, $item_type_id, $item_total, $quantity, $tax_id, $tax_free, $tax_percent, "", 2); $item_tax_total = add_tax_values($tax_rates, $item_tax_total_values, "products"); if ($tax_prices_type == 1) { $price_excl_tax = $price - $tax_amount; $price_incl_tax = $price; $price_excl_tax_total = $item_total - $item_tax_total; $price_incl_tax_total = $item_total; } else { $price_excl_tax = $price; $price_incl_tax = $price + $tax_amount; $price_excl_tax_total = $item_total; $price_incl_tax_total = $item_total + $item_tax_total; } // add components price to the total product price $price_incl_tax += $components_incl_tax; $price_excl_tax += $components_excl_tax; $tax_amount += $components_tax_amount;
if ($shipping_taxable) { $shipping_taxable_value = $shipping_cost; } } } } $t->set_var("shipping_control", $shipping_control); $t->set_var("shipping_methods", $shipping_methods); $t->set_var("shipping_taxable_value", $shipping_taxable_value); // todo delete if ($shipping_cost > 0) { // get taxes for selected shipping and add it to total values $shipping_tax_id = 0; $shipping_tax_free = $shipping_taxable ? 0 : 1; $shipping_tax_values = get_tax_amount($tax_rates, "shipping", $shipping_cost, 1, $shipping_tax_id, $shipping_tax_free, $shipping_tax_percent, "", 2); $shipping_tax_total = add_tax_values($tax_rates, $shipping_tax_values, "shipping"); } // #12 - calculate the tax if ($tax_available) { // get taxes sums for further calculations $taxes_sum = 0; $discount_tax_sum = $total_discount_tax; foreach ($tax_rates as $tax_id => $tax_info) { $tax_cost = isset($tax_info["tax_total"]) ? $tax_info["tax_total"] : 0; $taxes_sum += va_round($tax_cost, $currency["decimals"]); } $taxes_param = ""; $tax_number = 0; foreach ($tax_rates as $tax_id => $tax_info) { $tax_number++; $tax_name = get_translation($tax_info["tax_name"]);