如何从Magento外部访问Magento客户的会话? [英] How to access Magento customer's session from outside Magento?

查看:69
本文介绍了如何从Magento外部访问Magento客户的会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我的问题与Stackoverflow(和网络)中的问题非常相似,例如: 如何从Magento外部访问Magento用户的会话?

First up, my question is very similar to questions asked in Stackoverflow (and the web) such as: How to access Magento user's session from outside Magento?

我需要的是,如果客户登录到Magento网站,我也希望他也登录到论坛.但是,请尽我所能,我无法将isLoggedIn()设为真实.关于我可能会缺少的任何建议吗?这是应该为我提供登录信息的最小代码块:

What I need is, if a customer is logged into a Magento site, I want him to be logged on to a forum too. But try as I might, I'm unable to get isLoggedIn() to be true. Any suggestions on what I might be missing? Here's the minimal code chunk that should get me logged-in information:

require_once '/abs/path/to/Mage.php';
umask(0);
Mage::app('default');
Mage::getSingleton('core/session', array('name' => 'frontend'));
$session = Mage::getSingleton('customer/session');           
Zend_Debug::dump($session->isLoggedIn());

我检查了以下内容:

  • cookie路径设置为"/"
  • 我转储了$ session变量,但并没有变得更明智
  • 此处所述,我尝试设置使用会话ID in frontend",但看来我的Magento没有该选项(我们使用magento 1.3.2.4).
  • 我正在通过以客户身份登录和注销来检查变量,当然
  • Am包括mage.php
  • cookie path is set to '/'
  • I dumped the $session variable and didn't get wiser
  • As described here, I tried setting "Use Session ID in frontend", but it appears my Magento doesn't have that option (We use magento 1.3.2.4).
  • I'm checking the variable of course by logging in and out as a customer
  • Am including mage.php

我可能会缺少的任何帮助吗?

Any help on what I might be missing?

推荐答案

您将需要在Magentos admin->system->configuration->web->cookie domain中的.domain.com中输入.就像前面提到的Erickthered一样,您需要将Cookie设置为对其他子域可用,以使其能够被读取.所有Web应用程序都一样.

You will need to enter in .domain.com in Magentos admin->system->configuration->web->cookie domain. Like erickthered mentioned, you will need to make the cookie available to your other subdomains in order for it to be read. This is the same with all web applications.

参考: http://www.magentocommerce. com/wiki/modules_reference/english/mage_adminhtml/system_config/edit/web#session_cookie_management_field_descriptions

这篇关于如何从Magento外部访问Magento客户的会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆