I am creating a module in prestashop 1.4, say blocktest
modules/blocktest/blocktest.php:
...
public function hookLeftColumn($params)
{
global $smarty;
$smarty->assign(array(
'test' => 'test'
));
return $this->display(__FILE__, 'blocktest.tpl');
}
public function hookHeader()
{
Tools::addCSS($this->_path.'blocktest.css', 'all');
}
modules/blocktest/blocktest.css:
* { background-color: red; }
In admin > preferences > performances > smarty, i have set cache to no, and force compile to yes. In admin > preferences > performances > smarty, cache is set to no.
Existing modules uses the same css inclusion : Tools::addCSS($this->_path.'blocktest.css', 'all');, but the css file is in <themeName>/css/modules/<moduleName>/<moduleName>.css. Which is wierd, because $this->_path points to the module folder : modules/<moduleName>/.
But anyway, I tried to put my css file in <themeName>/css/modules/blocktest/blocktest.css, that doesn't work. Maybe i am missing something
Did you remember about registering a hook for the header during module's installation?
function install() {
if (!parent::install())
return false;
if (!$this->registerHook('header'))
return false;
return true;
}
Without it you will have to use "transplant module" function from Admin > Modules > Positions, to do this. Always check with tools like Firebug to verify whether your files are there.
Also, I think there is something missing, can you supply us with the full code of your module? Please, provide us with a Prestashop version that you use as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With