Add your js and css files to a Prestashop theme
When you make a template in Prestashop and you want add css and js files, maybe this files don't load.
First add js and css files in themes/yourtheme/css (or js)
Next go to /override/classes/controller/FrontController.php and replace:
<?php
class FrontController extends FrontControllerCore
{
}
With this:
<?php
class FrontController extends FrontControllerCore
{
public function setMedia()
{
parent::setMedia(); // CSS files
Tools::addJS(_THEME_JS_DIR_.'your_js.js');
}
}
Written by Ignacio Soriano Cano
Related protips
3 Responses
this is get LazyLoad css and js loader :)
over 1 year ago
·
What about adding the CSS file? Can we have an example too?
over 1 year ago
·
use this function for css
public function setMedia()
{
parent::setMedia(); // CSS files
}
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#