0

I would like some help with the fundamentals for making a centralized logon (front office) for Prestashop - a separate logon page.

I have a Prestashop installation with multiple shops (multistore). I have tried the Webservices API but doesn't find any way to handle logins and session cookies. How do I do this?

For example: In my Prestashop I've got three shops with three different URLs, such as:

A => mydomain.com/a
B => mydomain.com/b
C => mydomain.com/c

When a customer browses to the URL, mydomain.com (top of domain) a logon page will appear.

The user logs in and gets redirected to the shop where he/she is registered.

So to get started with my project I would like know how to login a user through a page outside Prestashop. Can I load classes from PS and use them externally?

UPDATE 1: I tried to retrive cookie data from mydomain.com/login/cookie.php:

include_once('../config/config.inc.php');
include_once('../config/settings.inc.php');
include_once('../classes/Cookie.php');
$cookie = new Cookie('ps'); // Use "psAdmin" to read an employee's cookie

if(!$cookie->isLogged()){
  echo ("Please login");
  exit;
}
else{
  echo ("Logged in as: ".$cookie->customer_lastname." ".$cookie->customer_firstname);
}

Eventough I was logged in at one of my shops (mydomain.com/b) the code (mydomain.com/login/cookie.php) says I'm not logged in. What am I doing wrong

UPDATE 2: This works but just for the first shop. I'm not able to collect data from the other shops in the same shop group.

include_once('../config/config.inc.php');
include_once('../config/settings.inc.php');
include_once('../classes/Cookie.php');
$lastname=Context::getContext()->customer->lastname;

if(!Context::getContext()->customer->isLogged()){
    echo "Please login";
    exit;
}
else{
    echo "Logged in as".$lastname;
    exit;   
}
4

1 回答 1

0

密码在 prestashop config.ini.php 中是盐渍的,您可能有不同的版本,它们对 cookie 进行不同的编码。

于 2016-05-24T21:52:12.687 回答