Jump to content

[resolu] New Hook et New module


Recommended Posts

Bonjour,

 

Version : Prestashop 1.5

 

Je désespère. J'essaye de mettre en place un nouveau hook, de créer un nouveau module et de rattacher ce module au nouveau hook.

 

• L'idée étant de rajouter un hook : displayBottomFullFixed

• créer un nouveau module : blockretourtopscroll

• d'afficher ce nouveau module dans ce hook

 

• j'ai créé mon hook en base :

-> name = displayBottomFullFixed

• j'ai créé mon dossier dans modules "blockretourtopscroll" avec le fichier .php et le .tpl

 

Le fichier blockretourtopscroll.php :


if (!defined('_PS_VERSION_'))
exit;

class BlockRetourTopScroll extends Module
{
 public function __construct()
 {
$this->name = 'blockretourtopscroll';
$this->tab = 'block retourtopscroll';
$this->version = 1.0;
$this->author = 'ritepac';
$this->need_instance = 0;

parent::__construct();

$this->displayName = $this->l('Block RetourTopScroll');
$this->description = $this->l('block avec bouton pour revenir vers le haut de page en scroll.');
 }


public function install()
{
if (parent::install() == false OR !$this->registerHook('leftColumn'))
  return false;
return true;
}

 public function uninstall()
{
if (!parent::uninstall())
  Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'blockretourtopscroll`');
parent::uninstall();
}

public function hookLeftColumn($params)
{
global $smarty;
return $this->display(__FILE__, 'blockretourtopscroll.tpl');
}

public function hookRightColumn($params)
{
return $this->hookLeftColumn($params);
}


public function hookBottomFullFixed($params)
{
return $this->hookLeftColumn($params);
}

}

 

j'ajoute dans le fichier footer.tpl (avant le </body>

{hook h="displayBottomFullFixed"}

 

Impossible d'attacher mon module à mon hook. Si j'enleve les dernieres lignes, je l'ai bien dans leftcolumn :


public function hookBottomFullFixed($params)
{
return $this->hookLeftColumn($params);
}

 

Une idée ?

Edited by ritepac (see edit history)
Link to comment
Share on other sites

Bon j'ai résolu le soucis. J'indique quand même le soucis :

ne pas utiliser de nom avec display dans le nom d'un nouveau hook car ça bug. En tout cas pour moi.

Du coup ce qui ne fonctionnait pas : displayBottomFullFixed fonctionne aujourd'hui avec BottomFullFixed

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...