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

时间:2013-01-21 09:05:49

标签: php e-commerce opencart

我添加了3个客户群,我的openacart管理员,

  1. 所有者
  2. 卖方
  3. 当这个客户登录时,我正在寻找什么,每个组客户想要重定向到不同的页面... 例如:

    如果所有者登录 - 重定向到(ownerpage.php)

    如果卖家登录 - 重定向到(sellerpage.php)

    如果来宾登录 - 重定向到(guestpage.php)

    并为管理员用户权限这些群体密切关系提供一些用户页面权限... 任何的想法...?是否有任何扩展可用或必须做任何自编码... ???

    感谢...

2 个答案:

答案 0 :(得分:2)

这些页面信息页面是?无论如何,您可以在catalog / controller / account / account.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检查。 当然,您可能只想将用户重定向到主页或其他任何内容,而不是显示自定义消息。但我认为这对用户来说更优雅,更不烦人​​。 希望这会有所帮助。

答案 1 :(得分:0)

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

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

希望这有助于某人。

相关问题