douchenhui5569 2013-01-21 09:05
浏览 49
已采纳

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

i had added 3 customer groups my openacart admin, that

  1. owner
  2. seller
  3. guest

what i am looking for when this customer login, each group customers want redirect to different pages... for example:

if owner login - redirect to (ownerpage.php)

if seller login - redirect to (sellerpage.php)

if guest login - redirect to (guestpage.php)

and give some user page permision also for these group cutomers like admin user permisions... any idea...? is there is any extension available or have to do any self coding...???

thanks...

  • 写回答

2条回答 默认 最新

  • dongque20030402 2013-01-21 10:25
    关注

    Are these pages information pages? Anyway, you could setup redirect in catalog/controller/account/account.php

    (Example uses Opencart 1.5.4.1)

    Before this line:

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

    Add:

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

    Not sure what you mean by page permissions. Maybe you can revise your question to make it clearer.

    [EDIT: 2013-01-23]

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

    Modify condition to your needs. You can do the same in other controllers, just remove the information_id check, of course. Of course, you may want to just redirect user to home page or whatever, instead of showing custom message. But I think this is more elegant and less annoying to the user. Hope this helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写