wn0czq
Last Updated: February 25, 2016
·
34.07K
· 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

2478

this is get LazyLoad css and js loader :)

over 1 year ago ·
9335

What about adding the CSS file? Can we have an example too?

over 1 year ago ·
11849

use this function for css

public function setMedia()
{
parent::setMedia(); // CSS files

}
over 1 year ago ·