Jump to content

[Résolu] smarty et les hook : {hook h=""}


Recommended Posts

Bonjour,

 

J'ai une question concernant cette nouvelle ligne de code smarty que j'ai découvert récemment :

 

{hook h="displayProductList"}

 

Très pratique car elle evite d' "overidé" les controlleurs.

Mais je ne trouve pas le moyen de lui passer de variables smarty.

Y a t'il un moyen ou cette fonction ne s'emploi que pour afficher du static ?

Link to comment
Share on other sites

Je pense que je devrait donner un exemple :

 

dans product-list.tpl

 

{foreach from=$products item=product name=products}
...
{hook h="displayProductList"}
...
{/foreach}

 

je souaiterai passer $product de smarty dans ce hook :

 

public function hookDisplayProductList($params) {
 //$this->smarty->assign('crossellingProduit', $params['crossselling']);
 return $this->display(__FILE__, 'crossselling-cat-produit.tpl');
}

 

Je pense que ça doit être plus claire

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...