Magento 客户自动登录

标签 magento authentication

我阅读了有关 magento 自动登录为管理员的帖子:Magento 自动登录为管理员。我试图让它与客户合作。但我无法完成它。客户似乎已登录,但在重定向到索引时,用户尚未登录。 如果您能提供任何建议,那就太好了... 谢谢你! 贝恩德

最佳答案

如果想要自动登录,请尝试下面的操作

try{
    $customer = Mage::getModel("customer/customer");
    $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
    $customer->loadByEmail($email); //load customer by email i 
        /* if customer has ,then login */
        if($customer->getId()>0){
        $userSession = Mage::getSingleton('customer/session');
        $userSession->setCustomer($customer);
        Mage::dispatchEvent('customer_login', array('customer'=>$customer));
        echo "sucess";
        }else{
            echo 'fail';
        }
    }catch(Exception $e)
    {
    echo 'fail';
    }

关于Magento 客户自动登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23285601/

相关文章:

Magento Model 源模型 - 在出现非对象错误时调用成员函数 toOptionArray()

订购页面 : "This customer email already exists" 上的 Magento

php - 买家在 magento 产品页面中填写的字段

unix - Apache Drill 普通身份验证抛出无效的用户名/密码错误

authentication - AspNetCore.Authentication.JwtBearer 失败,没有 SecurityTokenValidator 可用于带有 .net core RC2 的 token

authentication - JBoss Wildfly - 针对 LDAP 的 Web 应用程序身份验证

python - 登录并通过 if 显示菜单项

Magento:获取商店联系电话

php - 在magento中覆盖1column.phtml文件

authentication - 没有用户服务的 Spring Security X.509 身份验证