On this weblog we’re going to discover ways to present customized block in cart abstract on checkout web page at entrance finish in prestashop.
Typically we have to present some extra info or we wish to show some customized block on the cart web page or checkout web page on the entrance finish. So, we are able to obtain the identical by following steps.
Let’s Do A Stay Take a look at..!!!
Firstly, We are able to make modifications in immediately on core prestashop tpl file to attain your rquirement. You’ll be able to immediately add textual content or HTML in your desired location. File paths are talked about under.
File Path:
/themes/traditional/templates/checkout/_partials/cart-summary.tpl
/themes/traditional/templates/checkout/_partials/cart-detailed-totals.tpl
By utilizing prestashop hooks:
We are able to obtain this by registering two hooks ‘displayCheckoutSummaryTop‘ and ‘displayCheckoutSubtotalDetails‘ in customized module. You can even create a separate small module to handle issues separatly.
Prestashop Firm ? Learn Extra
Cart Web page :
$this->registerHook(‘displayCheckoutSubtotalDetails’); // to point out customized block on cart abstract
After that, We have to create a operate to name the tpl & assign variable to get desired content material.
/**
* Perform to point out free delivery alert on cart web page
*/
public operate hookDisplayCheckoutSubtotalDetails()
{
if ('cart' == $this->context->controller->php_self) {
$this->context->smarty->assign(
array(
'message' => $this->l('Add $226.5 extra to avail free delivery.'),
)
);
return $this->fetch(
'module:MODULE_NAME/views/templates/hook/TPL_FILE_NAME.tpl'
);
}
}
Now create a tpl file on this path “/views/templates/hook” to name in above operate & right here is the outcome under. You’ll be able to handle the hook positions based on your want from backoffice.
Checkout Web page:
$this->registerHook(‘displayCheckoutSummaryTop’); // to point out customized block on checkout subtotal part
After that, We have to create a operate associated to this registered hook.
/**
* Perform to point out free delivery alert on checkout web page
*/
public operate hookDisplayCheckoutSummaryTop()
{
if ('order' == $this->context->controller->php_self) {
$this->context->smarty->assign(
array(
'message' => $this->l('Add $226.5 extra to avail free delivery.'),
)
);
return $this->fetch(
'module:MODULE_NAME/views/templates/hook/TPL_FILE_NAME.tpl'
);
}
}
Right here is the outcome under.
Observe:
It is a primary instance wherein we reveals just one customized area. You’ll be able to comply with identical for the a number of columns/fields.
Additionally, you possibly can discover our PrestaShop Improvement Companies and a wide range of high quality PrestaShop Modules.
For any doubt contact us at [email protected]