problem fixed using event logic
Instead of modifying account/account.php
,I intercept the route before it’s executed, using OpenCart’s startup
event system.
<?php
class ControllerStartupAgent extends Controller {
public function index() {
if (isset($this->request->get['route']) && $this->request->get['route'] == 'account/account') {
if ($this->config->get('module_agent_status')) {
$this->response->redirect($this->url->link('account/agent', '', true));
}
}
}
}