sir, In my project i am adding new module. It was added in back office/ modules section. but, not appearing on website. code is as follows..
mymodule.php
<?php
if ( !defined( '_PS_VERSION_' ) )
exit;
class MyModule extends Module
{
public function __construct()
{
$this->name = 'mymodule';
$this->tab = 'mymodule';
$this->version = 1.6;
$this->author = 'Firstname Lastname';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l( 'My module' );
$this->description = $this->l( 'Description of my module' );
$this->ps_versions_compliancy = array('min' => '1.0', 'max' => _PS_VERSION_);
}
public function install()
{
if (Shop::isFeatureActive())
Shop::setContext(Shop::CONTEXT_ALL);
return parent::install() &&
$this->registerHook('leftColumn') &&
$this->registerHook('header') &&
Configuration::updateValue('MYMODULE_NAME', 'my friend');
}
public function hookDisplayLeftColumn($params)
{
$this->context->smarty->assign(
array(
'my_module_name' => Configuration::get('MYMODULE_NAME'),
'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display')
)
);
return $this->display(__FILE__,'views/templates/hooks/mymodule.tpl');
}
public function hookDisplayRightColumn($params)
{
return $this->hookDisplayLeftColumn($params);
}
public function hookDisplayHeader()
{
$this->context->controller->addCSS($this->_path.'css/mymodule.css', 'all');
}
}
?>
mymodule.tpl
location:views/templates/hooks/mymodule.tpl
<!-- Block mymodule -->
<div id="mymodule_block_left" class="block">
<h4>Welcome!</h4>
<div class="block_content">
<p>Hello,
{if isset($my_module_name) && $my_module_name}
{$my_module_name}
{else}
World
{/if}
!
</p>
<ul>
<li><a href="{$my_module_link}" title="Click this link">Click me!</a></li>
</ul>
</div>
</div>
<!-- /Block mymodule -->
mymodule.css
location:css/mymodule.css
div#mymodule_block_left p {
font-size: 150%;
font-style:italic;
}
display.php
location:controllers/front/display.php
<?php
class mymoduledisplayModuleFrontController extends ModuleFrontController
{
public function initContent()
{
parent::initContent();
$this->setTemplate('display.tpl');
}
}
display.tpl
location:controllers/front/display.php
<h1>well come !!!!!!!!</h1>
If you are still interested, your mistake seems to be on this line in the public function install()
:
$this->registerHook('leftColumn')
It should be:
$this->registerHook('displayLeftColumn')
The "display" keyword seems to be important.
One year later, Prestashop documentation still contains this crucial error.
Note that: public function hookDisplayLeftColumn($params)
don't appear in every pages (by example: it appear in product page, but not the home page).
There are some kind of specific hook for specific page. By example,
$this->registerHook('displayHome')
public function hookDisplayHome()
Added my module in the center of the home page (bellow already hooked modules). All the hooks can be found in the table ps_hook
.
Beware: public function hookDisplayRightColumn($params)
doesn't work at all for me.
That page helped me a little bit with the same problem as yours: http://doc.prestashop.com/display/PS16/Managing+Hooks
Well, I guess better worth an answer later than never...
Edit: I found how to activate columns:
In the back office, seek for the menu preferences/themes and click on the "advanced settings" button
Make sure that the columns you want are activated. In the list, click on green check or red X to reverse the visibility of columns in a specific module.