Jump to content

New template and hook for blocknewsletter module (PS1.6)


Recommended Posts

Hi all,

in the old Presta store I need to take the newsletter module to the "displayHome" hook and rebuild it visually.

In blocknewsletter.php I added:

to the constructor:

if (!$this->isRegisteredInHook('displayHome')){
	$this->registerHook('displayHome');
}
      

and:

public function hookDisplayHome($params)
	{
		if (!isset($this->prepared) || !$this->prepared)
			$this->_prepareHook($params);
		$this->prepared = true;
		$this->smarty->assign(array('id_module' => $this->id));


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

For tests, I copied the default blocknewsletter.tpl template, saved it under the name blocknewsletter_home.tpl and kept in the same location as the default one, i.e. blocknewsletter\views\templates\hook

The effect of adding _home to a .tpl file name ends with something like this:

image.png.ea398b7f4fda20d2912f7d1f690721ee.png

HTML is displayed, no PHP code is executed.

using the old template name, without the _home ending - works fine:

image.png.b1d29f9da27ec640cc65355752cd45ab.png

Renaming the .tpl file in the case of the default hook hookDisplayLeftColumn produces the same behavior. Can someone experienced suggest some solution? .Tpl filename changes require some extra action?

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