Jump to content

prestashop 1.5.4 override FrontController.php


bitshok

Recommended Posts

Hello! I have prestashop 1.5.4 on my localhost and I can't figure it out how to override the FrontController.php

 

This is what it contains:

<?php
class FrontController extends FrontControllerCore {
public function displayHeader()
{
	die('eu');
	self::$smarty->assign('currentController', get_class($this));
	return parent::displayHeader();
}
}

 

I've put this file on /override/classes/controller/ than in /modules/mymodule/override/classes/controller/ where mymodule is a module that i have installed, and nothings happens. Also tried other functions from FrontController and nothing changes.

 

I've managed to override ProductController.php from /controller/ folder, but everything that I've tried to override from the /classes/ doesn't seem to work.

 

Thank you for your help!

Link to comment
Share on other sites

Try changing the return to what is referenced in the original FrontController.php

 

return Controller::displayHeader();

 

This can't change anything because I have the die() function first, if the override would work I expect to see some errors on front page, but everything remains the same.

Link to comment
Share on other sites

I have the same problem , beffore 1.5.4 override FrontController whas working , but now : no working .

the class_index.php is now without override , so :

 

you have to add, line 327 in cache/class_index.php :

'FrontController' => 'override/classes/controller/FrontController.php',

Edited by mopi (see edit history)
  • Like 4
Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

I have the same problem , beffore 1.5.4 override FrontController whas working , but now : no working .

the class_index.php is now without override , so :

 

you have to add, line 327 in cache/class_index.php :

'FrontController' => 'override/classes/controller/FrontController.php',

 

Great! Now it works! Thanks :)

Edited by DejvCZ (see edit history)
Link to comment
Share on other sites

  • 3 years later...

I have the same problem , beffore 1.5.4 override FrontController whas working , but now : no working .

the class_index.php is now without override , so :

 

you have to add, line 327 in cache/class_index.php :

'FrontController' => 'override/classes/controller/FrontController.php',

 

Just delete cache/class_index.php it will be re-generated.

 

I tried to do the same but it does not work :

<?php
class FrontController extends FrontControllerCore
{
	public function setMedia()
    {
		$this->addJS(_THEME_JS_DIR_.'file.js');
		return parent::setMedia();
	}
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...