I'm customizing a copy of Prestashop 1.6 default template. I created a module called "elpsocialmedia", the module runs well only until I have to inject the CSS files. I am using the code that is seen in all the forums:
$this->context->controller->addCSS(($this->_path)."elpsocialmedia.css", "all");
On the respective hook, but it does not work. If I add CSS files in other Prestashop modules such as "BlockCart" or if I include the hooks in the FrontController , it also injects them correctly.
The problem is when I try to inject CSS into custom modules.
I attach the code, thanks for the attention.
Note: I try to inject files wrongly but it does not show me any errors either.
modules / elpsocialmedia / elpsocialmedia.php
class ElpSocialMedia extends Module
{
public $lsocial = array();
public function __construct(){
$this->name = "elpsocialmedia";
$this->tab = "front_office_features";
$this->author = "Elephants Noirs";
$this->version = "0.1";
$this->need_instance = 0;
$this->boostrap = true;
$this->ps_version_compliancy = array("min"=>"1.6");
parent::__construct();
$this->displayName = $this->l("Social Media Elephants");
$this->description = "Manage social media";
$this->lsocial = array(
'youtube' => array(
'url'=> '#',
'icon' => 'fa-youtube'
),
'facebook' => array(
'url'=> '#',
'icon' => 'fa-facebook'
),
'instagram' => array(
'url'=> '#',
'icon' => 'fa-instagram'
),
'googleplus' => array(
'url'=> '#',
'icon' => 'fa-google-plus'
),
'linkedin' => array(
'url'=> '#',
'icon' => 'fa-linkedin'
)
);
Cache::clean("hook_module_list");
}
public function getContent(){
return $this->display(__FILE__, "getContent.tpl");
}
public function install(){
return (parent::install()
&& $this->registerHook("displayNav")
&& $this->registerHook("displaySectionSlider"));
}
public function uninstall(){
if( !parent::uninstall() )
return false;
return true;
}
public function hookDisplayNav(){
$this->context->controller->addCSS(($this->_path)."elpsocialmedia.css", "all");
$assign = array(
'lsocial' => $this->lsocial,
'_path'=> $this->_path
);
$this->context->smarty->assign( $assign );
return $this->display(__FILE__, "elpsocialmedia-nav.tpl");
}
public function hookDisplaySectionSlider(){
$this->context->controller->addCSS(($this->_path)."elpsocialmedia.css", "all");
$this->context->controller->addJS(($this->_path)."views/js/sliderheader.js");
/*$varsAssign = array(
'images'=> $images,
'urlcss'=> $this->_path."views/css/sliderheader.css"
);
$this->context->smarty->assign( $varsAssign );*/
return $this->display(__FILE__, "elpsocialmedia-slider.tpl");
}
}