tebdilikiyafet Posted February 28, 2013 Share Posted February 28, 2013 Hi everybody; I try to override displayHeader() function in FrontController.php under /override/classes/controller/FrontController.php My version is 1.5.3.1. There is an example in Prestashop user guide about overriding. I totaly copy and paste the example-3 from here and apply to my site but it didn't work. When I debug a page my new variable is not shown here. On the other hand when I override to initHeader(), initFooter() functions it works. But overriding to displayHeader() or displayFooter() don't work. The example is shown in below: /* * With this override, you have a new Smarty variable called "currentController" available in header.tpl * This allows you to use a different header if you are on a product page, category page or home. */ class FrontController extends FrontControllerCore { public function displayHeader() { self::$smarty->assign('currentController', get_class($this)); return parent::displayHeader(); } } Force compile is active, cache is disable. I tried this in two new local site but it didn't work. I work on this trouble along two days and I will be crazy. Please help me.. Link to comment Share on other sites More sharing options...
tomerg3 Posted February 28, 2013 Share Posted February 28, 2013 PS 1.5 uses header() instead of displayHeader() Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted February 28, 2013 Author Share Posted February 28, 2013 There is no function which is called header() in FrontController.php. Can it be initHeader() ? Link to comment Share on other sites More sharing options...
tomerg3 Posted February 28, 2013 Share Posted February 28, 2013 Sorry, I meant display() Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted February 28, 2013 Author Share Posted February 28, 2013 Ok thanks tomerg3. I want to define a new variable to use in header.tpl. It is the right function, isn't it? Link to comment Share on other sites More sharing options...
tomerg3 Posted February 28, 2013 Share Posted February 28, 2013 yes, that should work. Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted February 28, 2013 Author Share Posted February 28, 2013 It is also work when do with initContent(). But display() is better I think too. But I really wonder why there is a wrong example in ps 1.5's userguide? Or am I doing something wrong? See example-3 here: Prestashop user guide Link to comment Share on other sites More sharing options...
marcis Posted March 22, 2013 Share Posted March 22, 2013 What about this message: "Class ContactControllerOverride does not exist" ? I was trying to override the ContactController from a module, placing the file at "\modules\[my module]\override\controllers" What am I doing wrong? Link to comment Share on other sites More sharing options...
tomerg3 Posted March 22, 2013 Share Posted March 22, 2013 Hard to say exactly, as you did not post your code, but probably you are using the wrong syntax... Link to comment Share on other sites More sharing options...
Recommended Posts