Impossible to retreive the customer id of the session in an external script
I created an external script test.php of Magento But, i don' t succeed to retreive the customer id of the session. This cript runs well in dev 39 version but not in dev 41 version. the script is as follows : "require_once 'app/bootstrap.php';
/* Store or website code */
To test, firstly, i authentificate a user via Magento. Secondly, i launch the script test.php. But the customer id isn' t displayed.
Thanks to explain how to retreive session customer data in an erternal script ? . $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ''; /* Run store or run website _/ $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $SERVER['MAGE_RUN_TYPE'] : 'store'; / Additional local.xml file from environment variable */ $options = array(); if (!empty($_SERVER['MAGE_LOCAL_CONFIG'])) { $options['local_config'] = $_SERVER['MAGE_LOCAL_CONFIG']; }
// Mage::init($mageRunCode, $mageRunType); Mage::app($mageRunCode, $mageRunType);
$val= Mage::getSingleton('Mage_Customer_Model_Session')->getCustomer();
$customer_id = Mage::getSingleton('Mage_Customer_Model_Session')->getCustomerId() ; $customer_name = Mage::getSingleton('Mage_Customer_Model_Session')->getCustomer()->getName();
echo $customer_id;
" To test, firstly, i authentificate a user via Magento. Secondly, i launch the script test.php. But the customer id isn' t displayed.
Thanks to explain how to retreive session customer data in an erternal script ? .
I guess @mage2-team closed this because it is more a support question. @keniosor Maybe try asking the question on http://magento.stackexchange.com/