0

We have a legacy application (raw PHP) that is loaded from an Iframe in the Magento Frontend View. Now we need to detect from that legacy application if the user is logged in or not.

We had tried to store a value to $_SESSION from the Magento but while trying it, we realized that Magento uses different session name.

Do you have any alternative on how we can detect if the user is logged in or not from the legacy application that is loaded in an iframe?

1 Answer 1

0

You can check if user is logged in in the application with this piece of code:

Mage::getSingleton('customer/session')->isLoggedIn()
After you can get information about user. For example:

$customer=Mage::getSingleton('customer/session')->getCustomer();
echo "<pre>" print_r($customer);

and for example set $_SESSION['username']=$customer->getName();

2
  • As I said, Magento uses different session name (i.e frontend) and might have different session settings (i.e session_path).
    – Ner
    Oct 30, 2017 at 11:43
  • ah ok so use : Don't use $_SESSSiON var. Add something to the session like this: Mage::getSingleton('core/session')->setData('key_here', 'value_here'); To read it from the session do this: Mage::getSingleton('core/session')->getData('key_here'); or if you want to retrieve the value and remove it from the session do this: Mage::getSingleton('core/session')->getData('key_here', true); Oct 30, 2017 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.