我正在构建一个小型web服务代码,我需要有magento客户登录。但无法创建会话。如果我从core/session创建会话,它对所有用户的浏览器保持相同。
问题1:会话存储在数据库中的什么位置?
问题2:如何创建客户/会话,然后在不同的位置获取相同的会话ID??
使用此方法,但这是为核心,我需要知道客户是否登录与会话id:
$session = Mage::getSingleton("core/session", array("name"=>"mobiledevice"));
给出浏览器会话id,而不是客户。
$session->getEncryptedSessionId()
会话存储在数据库会话表或类似的东西中,或者更常见的是存储在var/session中。
在magento中以编程方式登录用户不能正常工作?
告诉您如何在magento"外部"将某人登录到magento。我确实认为链接中的答案缺失:
Mage::app('mysite');
在运行代码之前。像这样:
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
}
创建一个用户,看这里:http://inchoo.net/ecommerce/magento/programming-magento/programatically-create-customer-and-order-in-magento-with-full-blown-one-page-checkout-process-under-the-hood/