Hello All,<br />
I trying to get customer data outside magento dir using the code below<br />
<?php require_once 'app/Mage.php'; Mage::app('default'); Mage::getSingleton('core/session', array('name' => 'frontend')); if(Mage::getSingleton('customer/session')->isLoggedIn()){ $user = Mage::getSingleton('customer/session')->getCustomer(); echo $user->getId(); }else{ echo 'session Not Found'; exit; }
but this is not working <br />
can anyone till me where the error, or how can I get customer data outside magento ?
Here's the way to get customer data outside magento:
<?php require_once '<<magento_root_directory>>/app/Mage.php'; Mage::app('default'); Mage::getSingleton('core/session', array('name' => 'frontend')); if(Mage::getSingleton('customer/session')->isLoggedIn()){ $user = Mage::getSingleton('customer/session')->getCustomer(); echo $user->getId(); }else{ echo 'session Not Found'; exit; } ?>
OR
Move File Inside Magento Root Directory.
Let me know if you face any query/concern regarding this.
Any idea how to do this in Magento 2.1?