Redirect Opencart强制登录和注册
我使用了shadyyx的解决方案 它工作得很好 但是,当我想排除注册页面时,我应该在代码中的什么地方进行更改? 否则,客户将无法注册,因为他们将被重定向到登录页面Redirect Opencart强制登录和注册,redirect,login,opencart,Redirect,Login,Opencart,我使用了shadyyx的解决方案 它工作得很好 但是,当我想排除注册页面时,我应该在代码中的什么地方进行更改? 否则,客户将无法注册,因为他们将被重定向到登录页面 class ControllerCommonLogin extends Controller { public function index() { if($this->config->get('config_store_id') == 4) { // if desired store, continue che
class ControllerCommonLogin extends Controller {
public function index() {
if($this->config->get('config_store_id') == 4) { // if desired store, continue checking
if(!$this->user->isLogged()) { // Check user isn't logged in
if(empty($this->request->get['route']) || $this->request->get['route'] != 'account/login') { // Redirect if route isn't account/login
$this->redirect($this->url->link('account/login', '', 'SSL'));
}
}
}
}
}
提前感谢。将此代码用于控制器代码
Class ControllerCommonLogin extends Controller {
public function index() {
if($this->config->get('config_store_id') == 1) { // if desired store, continue checking
$skip = array(
'account/login',
'account/register',
);
$route = empty($this->request->get['route']) ? 'common/home' : $this->request->get['route'];
if(!$this->customer->isLogged()) { // Check user isn't logged in
if(!in_array($route, $skip)) { // Redirect if route isn't account/login
$this->redirect($this->url->link('account/login', '', 'SSL'));
}
}
}
}
}
谢谢你的快速回复!但现在我得到了以下错误:致命错误:在/public_html/catalog/controller/common/login.php中对非对象调用成员函数isLogged()13@Bennieb见上面-原来的答案似乎是使用管理代码它的作品:)谢谢,但现在我得到一个错误,当我访问注册页面。如果没有重定向,或者在multishop的其他站点上,这是没有问题的。错误是:SyntaxError:Unexpected token