openart客户组登录重定向到不同的页面


Opencart Customer Group Login redirect to different pages

我已经为openacart管理员添加了3个客户组,

  1. 卖方
  2. 客人

当这个客户登录时,我正在寻找什么,每个组客户希望重定向到不同的页面…例如:

如果owner login - redirect to (ownerpage.php)

if seller login -重定向到(sellerpage.php)

如果guest login -重定向到(guestpage.php)

并为这些组客户提供一些用户页面权限,如admin用户权限…你知道…吗?是否有任何可用的扩展或必须做任何自编码…??

谢谢…

这些页面是信息页面吗?总之,你可以在目录/控制器/帐户/帐户。php

中设置重定向

(示例使用Opencart 1.5.4.1)

本行前:

$this->data['heading_title'] = $this->language->get('heading_title');

添加:

$id = $this->customer->getCustomerGroupId();
   if ($id == 1){
  $this->redirect($this->url->link('custom_page1', '', 'SSL'));
   }
   if ($id == 2){
  $this->redirect($this->url->link('custom_page2', '', 'SSL'));
   }
....

不知道你说的页面权限是什么意思。也许你可以把你的问题修改一下,使它更清楚。

(编辑:2013-01-23)

要限制对某些信息页面的访问,您可以检查请求的information_id和当前用户组,然后输出自定义内容:

在目录/controller/information/information.php中查找第62行

            $this->response->setOutput($this->render());
    } else {
    ......

添加:

$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';
        }

根据您的需要修改条件。您可以在其他控制器中执行相同的操作,当然,只需删除information_id检查即可。当然,您可能只想将用户重定向到主页或其他地方,而不是显示自定义消息。但我认为这样更优雅,对用户来说也不那么烦人。

现在最新版本有这个选项(我在2.0.2中发现这个):

$groupid = $this->user->getGroupId();