Developer's Guide
if ( parent::install() == false OR !$this->registerHook( 'leftColumn' ) )
return false;
return true;
We changed the original line to add a second test.
This code checks:
the boolean value returned by the Module class' install() method: if
true, the module is installed and can be used.
the boolean value returned by registerHook() for the leftColumn
hook: if true, the module is indeed registered to the hook it needs,
and can be used.
If any of these two boolean values is false, install() returns false too,
and the module cannot be installed. Both values have to be true for the
module to be considered installed.
Therefore, this line now reads this way: if installation or hooking fail, we
inform PrestaShop.
public function hookLeftColumn( $params )
{
global $smarty;
return $this->display(__FILE__, 'mymodule.tpl');
}
The hookLeftColumn() method makes it possible for the module to hook into
the theme's left column.
$smarty is the global variable for the Smarty template system, which
PrestaShop uses, and which we need to access.
The display() method returns the content of the mymodule.tpl template file,
if it exists.
public function hookRightColumn( $params )
{
return $this->hookLeftColumn( $params );
}
Likewise, hookRightColumn() gives access to the theme's right column. In
this example, we simply call the hookLeftColumn() method, in order to have
the very same display, whatever the column.
Save your file, and already you can hook it into the theme, move it
around and transplant it: go to the "Positions" sub-tab for the "Modules"
tab in the back-office, then click on the "Transplant a module" link.