Jump to content

Logging into prestashop from outside the shop


kgood

Recommended Posts

HI, I have a site with a separate directory for prestashop. I need users to be able to login to the site and not have to login again when they click on the shop.

I've been researching webservices but there doesn't seem to be a clear way on how to do this. I noticed others have posted questions about this and have been pointed in different directions but I haven't seen a post where this has been solved.  PrestashopBridge.php seems to be an ideal solution but I can't find any information on how to use it.

The closest solution i've seen is this code here:

 if (password_verify($password, $info->passwd) == true) {            
            session_start();
            $response = array();
            $response['status'] = 'success';
            $response['message'] = "You did it!";
            setcookie("userId", $info->id);
            header('Content-type: application/json');
           $bridge->login($info->email);
            echo json_encode($response);
        } else {
            $response = array();
            $response['status'] = 'error';
            $response['message'] = 'Wrong password';
            header('Content-type: application/json');
            echo json_encode($response);
        }

but the cookie being set here seems incomplete. How do you set a login cookie for prestashop?

Does anyone have a an idea about this? I appreciate any help thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...