tebdilikiyafet Posted February 27, 2013 Share Posted February 27, 2013 (edited) Hi everybody; 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 there is no variable whic is called $currentController. The example is 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. Edited February 27, 2013 by tebdilikiyafet (see edit history) Link to comment Share on other sites More sharing options...
sebkos Posted February 27, 2013 Share Posted February 27, 2013 Hi, go to "cache" directory and delete class_index.php file, it will be rebuild during page refreshing. Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted February 28, 2013 Author Share Posted February 28, 2013 I tried your advice but didn't work again. Is this example work for you? When I override another function like initHeader(), initFooter it works. But overriding to displayHeader() or displayFooter() don't work. Link to comment Share on other sites More sharing options...
sebkos Posted February 28, 2013 Share Posted February 28, 2013 displayHeader() and displayFooter() are deprecated functions in 1.5. Try to put that code into initContent() function. Tested and it works. Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted February 28, 2013 Author Share Posted February 28, 2013 Thanks you so much. But I know it works with this way. Is overriding to deprecated functions not possible? Why they put an example to userguide like this If it doesn't work? I want to use a variable in header.tpl so I select to override displayHeader. If displayHeader() is a deprecated function what should I use instead of this? Link to comment Share on other sites More sharing options...
Recommended Posts