I try to create override MyAccountController
class MyAccountController extends MyAccountControllerCore
{
public function init()
{
parent::init();
if ($module = Module::getInstanceByName('my_module')) {
$urls = $module->getData();
Tools::redirect($urls['redirect']);
}
}
}
I saved this file in override/controllers/front
folder.
After some tests, it does not work. My redirection is not called.
But when I set to true the variable _PS_DEBUG_PROFILING_
, the redirect is well captured by the profiler.
My Prestashop instance is clean. No modules or files are installed.
Prestashop version : 1.7.8.7
After place your controller in override
, you need to rebuild the class index.
This is the file:
var/cache/prod/class_index.php
Just remove that file, it will be created again, taking in account your override.
Note: /prod/
because of production environment.