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

查看:33
本文介绍了如何从 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).
  • 我当然是通过以客户身份登录和注销来检查变量
  • 包括 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-> 中输入 .domain.com;web->cookie 域.就像 erickthered 提到的那样,您需要将 cookie 提供给您的其他子域才能被读取.这对于所有网络应用程序都是一样的.

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天全站免登陆