久久久久久久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)
主站蜘蛛池模板: 亚洲精久久久 | 午夜视频在线观看一区二区 | 四虎影院在线观看免费视频 | 天堂综合网 | 午夜在线| a级毛片毛片免费观看久潮喷 | 91精品国产乱码久久久久久久久 | 国产精品久久在线 | 伊人精品在线 | 狠狠躁夜夜躁人人爽天天高潮 | 欧美激情国产精品 | 久久99国产精品久久99果冻传媒 | 欧美成人精品 | 精品国产精品一区二区夜夜嗨 | 欧美多人在线 | 高清成人免费视频 | 亚洲一区二区高清 | 夜夜爽99久久国产综合精品女不卡 | 日韩超碰在线 | 成人精品一区亚洲午夜久久久 | 亚洲精品www久久久久久广东 | 欧美成视频 | 午夜精品久久久久久久久久久久久 | 国产免费观看一区 | 欧美一级久久久猛烈a大片 日韩av免费在线观看 | 黄色一级免费看 | www.毛片| 在线观看视频一区 | 久久久国产一区二区三区 | 草比网站| 国产在线精品一区二区三区 | 国产一级黄色网 | 国产自产c区 | 国产精品一区二区三区久久 | 日韩欧美高清 | 精品久久国产 | 欧美日韩在线不卡 | 中文字幕在线一区二区三区 | 久久爱黑人激情av摘花 | 亚洲精品一区中文字幕乱码 | 亚洲精品av在线 |