Last Updated: September 09, 2019
·
38.06K
· isocano

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');
    }
}

3 Responses
Add your response

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 ·