Opencart Get Current User Information

I am working on a module with Opencart, and I'm just wondering how I can get current user information.

I thought something like this: $this->getuserid();

thanks.

+4
source share
3 answers

I just found out:

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

etc.

The source code (including other available methods) is located in the system/library/customer.php file.

You can use the methods anywhere.

Hope this helps.

+14
source

There is a difference between client and user. To get the current user ID (administrator, manager, etc.), follow these steps:

 $this->session->data['user_id']; 
+4
source

Another way to get the user ID that is currently registered

 $this->user->getId(); 
0
source

Source: https://habr.com/ru/post/1442922/


All Articles