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';
}
While a simple event could do it on more recent OC versions, rather than playing with core files, I would suggest to use the $this->response->addHeader with 404 as a response page rather than hardcoding an error page without using the header. The catalog/controller/product/product.php file would be one of the examples on how to achieve this specifically.
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
Who is online
Users browsing this forum: No registered users and 35 guests