I am building a small web services code to where I need to have magento customer login. But not able to create the session. If I create the session from core/session it remains same for the browser for all the users.
Question 1: Where are the sessions stored in the database?
Question 2: How to create customer/session and then to fetch that on different location with same session ID??
used this method but this is for core I need to know the customer is logged in or not with session id.:
$session = Mage::getSingleton("core/session", array("name"=>"mobiledevice"));
This gives the browser session id not the customer
$session->getEncryptedSessionId()
Sessions are stored in database session table or something like that or, more commonly, in var/session. Depends on the install.
Login user programmatically in magento not working properly?
tells you how to log someone into magento "outside" of the magento. I do think the answer in the link is missing:
Mage::app('mysite');
before running the code. So something like this:
Mage::app('mysite');
$session = Mage::getSingleton( 'customer/session' );
try
{
$session->login( $email, $password );
$session->setCustomerAsLoggedIn( $session->getCustomer() );
return true;
}
catch( Exception $e )
{
//error handling code
}
to create a user look here: http://inchoo.net/ecommerce/magento/programming-magento/programatically-create-customer-and-order-in-magento-with-full-blown-one-page-checkout-process-under-the-hood/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.