Я нашел этот следующий код в stackoverflow, который дает доступ к странице информации только для входа в систему, и это очень полезно. Я хочу улучшить это. Информационная страница должна быть доступна только определенной группе клиентов.Показать страницу с информацией только для зарегистрированных пользователей и конкретной группы клиентов
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'));
}
}
Код Источник: Is it possible to require a login for an OpenCart Information page, and ONLY the information page?
Работал очень хорошо. Благодаря кодам. – Asif
Что-то не так. Перенаправление одобрено, но отображается для всей группы клиентов. Помогите!!! – Asif
if (! $ This-> customer-> isLogged() '||' $ this-> customer-> getCustomerGroupId()! = 1) {- обновлено .. найди мой обновленный ответ. раньше я использовал 'AND' вместо' OR'. –