php - Prestashop: Session cookies & login -
i fundamentals making centralized logon (front office) prestashop - separate logon page.
i have prestashop installation multiple shops (multistore). have tried webservices api doesn't find way handle logins , session cookies. how do this?
for example: in prestashop i've got 3 shops 3 different urls, such as:
a => mydomain.com/a b => mydomain.com/b c => mydomain.com/c when customer browses url, mydomain.com (top of domain) logon page appear.
the user logs in , gets redirected shop he/she registered.
so started project know how login user through page outside prestashop. can load classes ps , use them externally?
update 1: tried retrive cookie data 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" read employee's cookie if(!$cookie->islogged()){ echo ("please login"); exit; } else{ echo ("logged in as: ".$cookie->customer_lastname." ".$cookie->customer_firstname); } eventough logged in @ 1 of shops (mydomain.com/b) code (mydomain.com/login/cookie.php) says i'm not logged in. doing wrong
update 2: works first shop. i'm not able collect data other shops in 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; }
password salted in prestashop config.ini.php , might have different versions code cookie differently.
Comments
Post a Comment