Jump to content

Override In Frontcontroller


Recommended Posts

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

  • 3 weeks later...

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

×
×
  • Create New...