获取有关Opencart当前用户的信息

时间:2012-10-30 06:52:31

标签: opencart

我一直在使用Opencart开发模块,我想知道如何获取当前用户信息。

我在想这样的事情:$this->getuserid();

4 个答案:

答案 0 :(得分:19)

我刚刚发现了:

$this->customer->getFirstName();
$this->customer->getLastName();
$this->customer->getEmail();
$this->customer->getTelephone();
$this->customer->getFax();

等等。

源代码(包括其他可用方法)位于system/library/customer.php文件中。

您可以在任何地方使用这些方法。

希望这有帮助。

答案 1 :(得分:7)

客户和用户之间存在差异。要获取当前用户ID(管理员,经理等),请执行以下操作:

$this->session->data['user_id'];

答案 2 :(得分:0)

获取当前登录用户ID的另一种方法

$this->user->getId();

答案 3 :(得分:0)

在oc3中

您可以在

中获得库文件夹。
your_project/system/library/cart/customer.php

在customer.php文件中,您将获得所有函数,可以在其中调用控制器并进行检出。

$this->customer->getId();

获取您的客户ID等,您可以从customer.php文件中获取。

谢谢。

相关问题