久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

來自外部頁面的 Magento 會話(同域)

Magento Session from external page (same domain)(來自外部頁面的 Magento 會話(同域))
本文介紹了來自外部頁面的 Magento 會話(同域)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我需要檢查用戶是否已注冊并獲取您的信息,但都在同一個域內但在 Magento 結構之外的文件中:/mymagento/islogged.php

I need to check that a user is registered and get your information, but all in a file within the same domain but outside the structure of Magento: /mymagento/islogged.php

require_once ('app/Mage.php');
Mage::app(); 

define('ROOT', Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));

$sessionCustomer = Mage::getSingleton("customer/session");
if($sessionCustomer->isLoggedIn()) {
    $customer = $sessionCustomer->getCustomer();
    $telefono = $customer->getTelefonoMovil();
} else {
    header('Location: '.ROOT.'customer/account/login/');
}

但是它不起作用,找不到會話.我已查看以下主題:

But it does not work, can not find the session. I have reviewed the following threads:

  • Magento 會話在外部頁面(同域)中不起作用
  • Magento 客戶/會話不工作
  • 如何在外部創建 Magento 會話Magento?
  • 如何從 Magento 外部訪問 Magento 用戶的會話?
  • 檢查外部頁面上的 Magento 登錄
  • 在另一個頁面中獲取 magento 會話變量

推薦答案

最后我是這樣做的:

require_once ('app/Mage.php');
Mage::app(); 

// Define the path to the root of Magento installation.
define('ROOT', Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));

// Obtain the general session and search for an item called 'customer_id'
$coreSession = Mage::getSingleton('core/session', array('name' => 'frontend'));
if(isset($coreSession['visitor_data']['customer_id'])){
    $customerId = $coreSession['visitor_data']['customer_id'];
} else {
    header('Location: '.ROOT.'customer/account/login/');
}

// Load the user session.
Mage::getSingleton('customer/session')->loginById($customerId);
$customerSession = Mage::getSingleton("customer/session");

// We verified that created successfully (not required)
if(!$customerSession->isLoggedIn()) {
    header('Location: '.ROOT.'customer/account/login/');
}

// Load customer
$customer = $customerSession->getCustomer();

// We get cell phone
$telefono = $customer->getTelefonoMovil();

這篇關于來自外部頁面的 Magento 會話(同域)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 亚洲精品久久久久久一区二区 | 日本三级网址 | 韩日精品在线观看 | 伊人狼人影院 | 欧美欧美欧美 | 久久久人| 中文在线日韩 | av二区三区 | 欧美综合久久 | 91观看| 国产成人av在线播放 | 成人在线精品视频 | 国产欧美在线播放 | 亚洲在线免费 | 亚洲在线 | 亚洲欧美一区二区在线观看 | 中文日韩字幕 | 国产精品综合 | 国产一区二区三区 | 日韩欧美中文在线 | 久草免费视| 欧美日韩中文字幕在线播放 | 国产精品色综合 | 在线一区二区三区 | 91久久久www播放日本观看 | 久久精品国产久精国产 | 国产一区二区三区视频在线观看 | 日韩一二区在线观看 | 亚洲中午字幕 | 国产精品久久久久久久久久久久冷 | 国产日韩一区二区 | 中文字幕日韩三级 | 免费黄色大片 | 欧美淫片 | 国产精品日韩一区二区 | 成人精品一区二区 | 特黄色一级毛片 | 高清亚洲 | 亚洲色图插插插 | 国产成人麻豆免费观看 | 蜜月aⅴ国产精品 |