If you want to add an action in a certain area where PrestaShop default hooks don’t exist you can add your custom new hook very easily. Consider you are building a new module and you need to show a certain code in a specific area. You can process this way:

<?php 

 public function install()
{
 if (!parent::install() ||
!$this->registerHook('DisplayMynewName')
//but is DisplaymynewName instead of DisplayMynewName
 )
return false;

 return true;

//and then here is the corresponding code

public function hookDisplaymynewName($params){

 $id_cart=3; //just an example
  $this->context->smarty->assign('cart_id' ,$id_cart);

   return $this->display(__FILE__, 'my_new_name.tpl');

}

?>
You can call it in any .tpl file you want like product.tpl, product-list.tpl, shopping-cart.tpl, etc this way:
{hook h="DisplaymynewName"  type="price"}
And you are done.
Facebook Comments Box
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments