/* cart-summary-totals.tpl */
/* cart-detailed-totals.tpl */
Module:
public function hookDisplayMyCustomTax($params) { $idCart = Context::getContext()->cart->id; $cart = new Cart($idCart); $productWithoutTax = $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS); $productWithTax = $cart->getOrderTotal(false, Cart::ONLY_PRODUCTS); $getTaxAverage = ($cart->getAverageProductsTaxRate($productWithoutTax, $productWithTax) * 100); $getTax = Cart::getTaxesAverageUsed($idCart); $taxCalculate = abs($productWithTax - $productWithoutTax); $getPriceTax = Tools::displayPrice($taxCalculate); $label = $this->l('Ingresos Brutos'); $tax = $getTaxAverage.'%'; $value = $getPriceTax; $this->context->smarty->assign(array( 'custom_tax_label' => $label, 'custom_tax_tax' => $tax, 'custom_tax_value' => $value )); return $this->display(_PS_MODULE_DIR_.$this->name, '/views/templates/front/custom-tax.tpl'); }
Sample module: