Pradeep Sapkota
Pradeep Sapkota

Reputation: 2082

How to get user_id in Open Cart 3?

I'm developing in admin side. And I needs to find user_id. The code

$this->user->getId()

provides no information. Is there any way to get user id. Thanks.

Upvotes: 0

Views: 580

Answers (1)

Pradeep Sapkota
Pradeep Sapkota

Reputation: 2082

Here is the best way:

You cannot directly access user_id from database since it is protected.

So you have to access it from session.

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

This returns the id of currently logged user.

Upvotes: 1

Related Questions