Jump to content

[SOLVED]Hook Module Newsletter


Kaby

Recommended Posts

Hi all,

 

I am using Prestashop 1.5.4.0 and I am trying to re-hook my newsletter block (in the right column).

 

Here is what I do:

 

- In the module install I have this line:

if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('header') || !$this->registerHook('rightColumn'))
return false;

- Then I have this function:

public function hookDisplayRightColumn($params)
{
return $this->hookDisplayLeftColumn($params);
}

I reseted the module but I can't hook this newsletter block on ANY module of prestashop  (Right Column, Left Column, Header...)

 

I have the error message "You cannot hook this block here" (I don't know the exact English message.

 

What might I have forget ?

 

Thanks !

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

i think your are mispelling the hooks maybe?

 

can you try this?

if (!parent::install() || !$this->registerHook('displayLeftColumn') || !$this->registerHook('displayHeader') || !$this->registerHook('displayRightColumn'))
return false;

than reinstall the module

Link to comment
Share on other sites

Hi !

 

Indeed I had a long and meticulous look on the naming of hooks and here is what I get now, which works:

 

if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('rightColumn'))
return false;

The here is the name of my functions:

 

public function hookLeftColumn($params)
{
$this->_prepareHook($params);
$this->context->controller->addCSS(($this->_path).'blocknewsletter.css', 'all');
return $this->display(__FILE__, 'blocknewsletter.tpl', $this->getCacheId());
}


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

So that was actually a matter of right spelling of the name of hooks and functions, thanks for pointing me that issue ! And don't toatally understand as the hookDisplayLeftColumn function was the native one from the module.

 

Have a nice day all ! Ty again !

Link to comment
Share on other sites

I think if you use $this->registerHook('displayLeftColumn')

 

the function should be named hookDisplayLeftColumn()

 

if you remove the "display" part from the hook registration the function should be renamed accordingly

 

don't forget to mark the topic as solved prepending [sOLVED] to the title ^_^

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