I found this following code on stackoverflow which gives access to information page to only logged in customer, and it is very useful. I want one enhancement to this. The information page should be only accessible by particular customer group.
if (isset($this->request->get['information_id']) && $this->request->get['information_id'] == '{ID}')
{
//If the information_id is provided and it matches the ID you wish to protect
if (!$this->customer->isLogged()) {
//If the customer is not logged in already, redirect them to the login page
//Use $this->session->data['redirect'] to redirect them back to this page after logging in
$this->session->data['redirect'] = $this->url->link('information/information', 'information_id=' . $this->request->get['information_id']);
//Do the redirect
$this->redirect($this->url->link('account/login', '', 'SSL'));
}
}
Code Source: Is it possible to require a login for an OpenCart Information page, and ONLY the information page?
Update your second
if
condition as shown below:$this->customer->getCustomerGroupId()
- returns your customer group id.Have a nice day :) !!