Checking for Magento login on external page
- by LinuxGnut
I'm hitting a wall here while trying to access items from Magento on an external page (same server, same domain, etc, etc). I want to see if the user is logged into Magento before showing them certain parts on the site.
Keep in mind that this code exists outside of Magento.
Mage::app("default");
Mage::getSingleton("core/session", array("name" = "frontend"));
if (empty($session))
{
$session = Mage::getSingleton("customer/session");
}
if($session-isLoggedIn())
echo "hi";
$cart = Mage::helper('checkout/cart')-getCart()-getItemsCount();
echo $cart;
$cart returns 0, where I definitely have products in my cart. isLoggedIn() also returns false. What am I doing wrong here? Is there an option in Magento that I need to turn on or off to be able to access this information outside of Magento?