Thank you, perfect.
Only the Prestashop version is missing 😉
I give an example for PS 1.7.x.x
In the first case, there is no such hook.
You have to create your own hook and add it to the TPL template in the module installation, or create a javascript and paste it via an append.
Check template ./themes/classic/templates/checkout/_partials/cart-summary-totals.tpl
You can do this via javascript like this:
$(document).ready(function(){ var div = document.createElement("div"); div.setAttribute('id', 'my-custom-div'); div.setAttribute('name', 'my-custom-div'); div.setAttribute('class', 'my-custom-div-class'); div.setAttribute('style', "display:block; width:100;"); var span = document.createElement("span"); span.setAttribute('id', 'my-custom-tax-label'); span.setAttribute('class', 'my-custom-span-class'); span.innerHTML = myVariable; div.appendChild(span); var referenceNode = document.querySelectorAll('.cart-summary-line, .cart-total'); div.insertBefore(referenceNode); });
and your module:
public function hookHeader($params) { if ($this->context->controller->php_self == 'cart' || $this->context->controller->php_self == 'order') { /* read data in cart */ $idCart = $this->context->cart->id; $cart = new Cart((int)$idcart); /* add you variable to JavaScript */ /* $type Type enum: - ONLY_PRODUCTS - ONLY_DISCOUNTS - BOTH - BOTH_WITHOUT_SHIPPING - ONLY_SHIPPING - ONLY_WRAPPING */ Media::addJsDef(array('myVariable' => $cart->getOrderTotal(true, Cart::BOTH))); /* your javascript for front */ $this->context->controller->addJS(_PS_MODULE_DIR_.$this->name.'/views/js/cart.js'); } }
As for administration, it's more complicated there.