Restrict access to specific information pages based on customer group with SSL enabled.
Posted: Fri Jan 01, 2021 2:01 pm
In Opencart version 1.5.4.1 I used the following code to restrict access to information page 7 if the customer is in group 1. It works fine with SSL disabled but will not work with SSL enabled. What can I do to get it working with SSL?
To restrict access to certain information pages you can check for requested information_id and current user group, then output custom content:
in catalog/controller/information/information.php find line 62:
$this->response->setOutput($this->render());
} else {
......
Add before:
$id = $this->customer->getCustomerGroupId();
if ($id == 1 && $information_id == 7){
$this->data['heading_title'] = 'Not allowed.';
$this->data['description'] = 'You are not allowed to view this page';
}
To restrict access to certain information pages you can check for requested information_id and current user group, then output custom content:
in catalog/controller/information/information.php find line 62:
$this->response->setOutput($this->render());
} else {
......
Add before:
$id = $this->customer->getCustomerGroupId();
if ($id == 1 && $information_id == 7){
$this->data['heading_title'] = 'Not allowed.';
$this->data['description'] = 'You are not allowed to view this page';
}