Override controller in Prestashop 1.6

丶灬走出姿态 提交于 2020-02-23 05:10:31

问题


My override is not working

I tried to add a custom.css the safe way to our default bootstrap theme. I followed this tutorial:

http://www.prestadb.com/prestashop-override-controllers-tutorial/

The difference to 1.6 should be that the file should be placed in:

/override/controllers/front

instead of

/overrides/controllers/

In the first mentioned directory I have a file called FrontControllerCore.php with following content:

<?php
class FrontController extends FrontControllerCore
{
    public function setMedia()
    {
        parent::setMedia();   
        $this->addCSS(_THEME_CSS_DIR_.'custom.css');  
    }
}

?>

But the custom.css is not loaded, I do not see it in the source code of the frontend. What am I missing here?


回答1:


Ahh my fault I found it!

The name of the file should be FrontController.php and for this to be loaded, you have to manually delete the cache/class_index.php file!




回答2:


if you need to simply add a custom.css to a theme you can create a custom.css file in:

/themes/my_theme/css/autoload/custom.css

instead of override the controller



来源:https://stackoverflow.com/questions/23472036/override-controller-in-prestashop-1-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!