Reputation: 414
I tried in many ways to create my own module with an own hook that must appear in a column in header.tpl. Unforunately which tutorial I follow, it doesn't work. What am I doing wrong? For example my steps:
Step 1: created my module events
dir: prestashop\modules\events files: logo.gif, logo.png, events.tpl, events.php
in events.php:
<?php
if (!defined('_PS_VERSION_'))
exit;
class Events extends Module
{
public function __construct()
{
$this->name = 'events';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'Dinizworld';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('Dinizworld Events');
$this->description = $this->l('Upcoming events.');
$this->confirmUninstall = $this->l('Are you sure you want to delete this module?');
}
public function install()
{
return parent::install() && $this->registerHook('hookEvents');
}
public function hookEvents($params)
{
//return $this->display(__FILE__, 'events.tpl');
return "test message";
}
}
Step 2: adding hook
On the right location in header.tpl: {hook h='hookEvents'}
Step 3 installing module in adminpanel I see after that the hook is transplanted on my module.
Then nothing appear. When I try it with for example the HOOK_HOME my test message is visible. But not with my own hook. What am i doing wrong?
Upvotes: 0
Views: 3526
Reputation: 1708
Try
$this->registerHook('events')
Instead of
$this->registerHook('hookEvents')
Edit
and in header.tpl
{hook h='events'}
Upvotes: 2