Magento – Customer Session outside Magento

ce-1.7.0.2customersession

I would like to know if it is possible to fetch the Magento customer session outside Magento and how to go about it.

For example if my Magento instance is in a folder with the path : "public_html/Magento" and if I have a php file with the path "public_html/abc.php" i.e outside the Magento folder, can I check if a user is logged in on Magento (& also get cart details) on abc.php?

I've tried various solutions out there (like including Mage.php & fetching the session), which were mostly similar to How to Create session for customer login with session outside magento
but I wasn't able to check if the customer is logged in and get the cart item details on abc.php.

Best Answer

Sounds like the cookie containing the session named frontend is not available on your abc.php script.

Make sure the cookie path in your Magento installation is set to / under System > Configuration > Web > Session Cookie Management > Cookie Path and install an extension in your browser that can easily display cookies. In chrome I use edit this cookie.

Related Topic