Rohitashv Singhal
Rohitashv Singhal

Reputation: 4557

check user is logged in to opencart or not

I am new to opencart. I have installed opencart on my domain

http://example.org/ocart

and a php application at url

http://example.com/testapp

testapp is a basic php application in which I want to check if any user is logged in to opencart or not. Is it possible to check in php app that any user is logged in to opencart and if it is logged in then can we get the email id of logged in user.

Both ocart and testapp are using the same database.

Upvotes: 1

Views: 666

Answers (2)

redbraz
redbraz

Reputation: 11

in the controller, ask if he is logged in and add the block, or combine it with other parameters desirable for the query.

if ($this->customer->isLogged()) {
 // your code here, if he is logged in
}

Upvotes: 1

Prashant
Prashant

Reputation: 347

You can check your other question you will get your answer

access session data of opencart through php file

After doing above steps you can access in other http://example.com/testapp

Just Access with this code

session_start();
if(!empty($_SESSION['opencart']['customer_id'])){
      // User Loged in.
}

Upvotes: 2

Related Questions