wn0czq
Last Updated: February 25, 2016
·
30.03K
· isocano
Yo

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

3 Responses
Add your response

2478
Cd9aac681e33f7be2d36e13183e2c072

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
0 ovjognczfq hawt2pgwmgznl5tli2712yjdvgqnvsba 1ixutpd61nguwp5j7e h0jrqtphue7r

use this function for css

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

}
over 1 year ago ·