OpenCart 不重定向到登录页面

OpenCart not redirecting to login page

如果用户未登录并且他访问了心愿单页面。(http://website/index.php?route=account/wishlist) he should redirect to login page (http://website/index.php?route=account/login)但是他停留在同一页面上并且显示空白

这是控制器代码

class ControllerAccountWishList extends Controller {
public function index() {
    if (!$this->customer->isLogged()) {
        $this->session->data['redirect'] = $this->url->link('account/wishlist', '', true);

        $this->response->redirect($this->url->link('account/login', '', true));
    }
  }
}

我已经找到解决方法

重定向到心愿单或帐户时,已发送的 Headers 出现错误。我已经通过在 OpenCart 根目录的 index.php 文件中添加 ob_start() & ob_flush() 来修复。