简体   繁体   中英

Prestashop FrontController override not working

I override frontController in override\\classes\\controller\\FrontController.php. I added only simple code

    class FrontController extends FrontControllerCore
    {    
    init()
{
        [...]
        $logo_image_url = 'themes/'._THEME_NAME_.'/img/shop/'.Tools::getValue('controller').'.png';
        if (!file_exists($logo_image_url)) $logo_image_url = 'themes/'._THEME_NAME_.'/img/shop/main.png';
        [...]
        $this->context->smarty->assign(array(
        // Usefull for layout.tpl
        [...]
        'logo_shop_image' => $logo_image_url,
        ));
    [...]
    }
    }

And in header.tpl i added img with src="{$logo_shop_image}" . I delete class_index.php and after page refresh it is working ( class_index.php was regenerated) on my localhost.

Overridedcode not working on my server. $logo_shop_image is always empty. I regenerating class_index.php too, it looks like presta stil uses original FrontController because when i override original code then it works. How to force using override file in override catalog?

I interested in class_index.php file and i saw something strange.

  'FrontController' => 
  array (
    'path' => 'override/classes/controller/FrontController.php',
    'type' => 'class',
    'override' => false,
  ),

Why 'override' => false? This is file from working localhost. Is it important?

带有_PS_HOST_MODE_ config属性的东西。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM