Post by garygajesjr » Thu Nov 23, 2017 5:26 pm

Hi,

Cant find any solution, I want to force customer to login first,
I found something like this:
Create a class catalog/controller/common/login.php
class ControllerCommonLogin extends Controller {

public function index() {
if($this->config->get('config_store_id') == 1) { // if desired store, continue checking

if(!$this->customer->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'));
}
}
}
}

}

Then open up index.php (frontend one) and find line:

// Maintenance Mode
$controller->addPreAction(new Action('common/maintenance'));
and after add this:

// Login needed pre-action
$controller->addPreAction(new Action('common/login'));

I cant find maintenance line in index.php, im using OC 2.3
Anyone please?

New member

Posts

Joined
Sun Mar 05, 2017 9:18 pm

Post by garygajesjr » Thu Nov 23, 2017 6:04 pm

anyone please?
where should I put this: $this->response->redirect($this->url->link('account/login'));
Is it at: /catalog/controller/common/header.php???

New member

Posts

Joined
Sun Mar 05, 2017 9:18 pm

Post by garygajesjr » Thu Nov 23, 2017 6:27 pm

Solve,

catalog/controller/common/home.php:
$this->response->redirect($this->url->link('account/login', '', ''));

New member

Posts

Joined
Sun Mar 05, 2017 9:18 pm
Who is online

Users browsing this forum: Amazon [Bot], Majestic-12 [Bot] and 47 guests