Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Session 在Magento和Symfony之间共享用户会话变量_Session_Variables_Symfony1_Magento - Fatal编程技术网

Session 在Magento和Symfony之间共享用户会话变量

Session 在Magento和Symfony之间共享用户会话变量,session,variables,symfony1,magento,Session,Variables,Symfony1,Magento,我们网站的一部分将使用Symfony构建,另一部分使用Magento构建。我想知道是否有可能在他们两人之间共享用户会话变量 谢谢大家! 经过多次尝试和错误,我创建了以下解决方案。这是基于登录由Magento以外的平台管理的情况 我无法找到与Magento共享在Magento外部初始化的会话的方法。相反,我创建了一个简单的Magento扩展,它钩住了事件观察器“http\u response\u send\u before” 现在,每当Magento加载页面时,模块将检查用户是否登录到其他系统。如

我们网站的一部分将使用Symfony构建,另一部分使用Magento构建。我想知道是否有可能在他们两人之间共享用户会话变量


谢谢大家!

经过多次尝试和错误,我创建了以下解决方案。这是基于登录由Magento以外的平台管理的情况

我无法找到与Magento共享在Magento外部初始化的会话的方法。相反,我创建了一个简单的Magento扩展,它钩住了事件观察器“http\u response\u send\u before”

现在,每当Magento加载页面时,模块将检查用户是否登录到其他系统。如果是这样,它将检索该用户的电子邮件,并使用电子邮件地址作为标识符将该用户登录到Magento,并为该客户设置会话。显然,客户必须已经存在于Magento中,才能进行登录

以下是其中包含的文件和代码。请随意修改以使用您的系统

/app/code/local/Verve/Session/etc/config.xml

<config>
<modules>
    <Verve_Session>
        <version>0.5.1</version>
    </Verve_Session>
</modules>
<frontend>
    <events> 
        <http_response_send_before>
            <observers>
                <session_login>
                    <type>model</type> 
                    <class>Verve_Session_Helper_Login</class> 
                    <method>loginEvent</method>
                </session_login> 
            </observers>
        </http_response_send_before>
    </events> 
</frontend>
/app/etc/modules/Verve_Session.xml

<config>
<modules>
    <Verve_Session>
        <active>true</active>
        <codePool>local</codePool>
    </Verve_Session>
</modules>
</config>

真的
地方的

Session现在是一个模糊的通用术语。您可能需要添加更多详细信息。我想要实现的是,在系统的两个部分中都可以识别一个登录用户。做得好,Komra!非常感谢。但是你能解释一下你是如何“检查用户是否登录到另一个系统”的吗?Symfony的API?
<config>
<modules>
    <Verve_Session>
        <active>true</active>
        <codePool>local</codePool>
    </Verve_Session>
</modules>
</config>