Check if Customer Logged In and get the details from Session
<?php
// require_once '/var/www/magento/app/Mage.php';
// Mage::init();
function getSession()
{
return Mage::getSingleton('customer/session');
}
if (!getSession()->isLoggedIn()) {
$this->_redirect('customer/account/login');
return;
}
if (getSession()->isLoggedIn()) {
echo 'loggedIn';
$customerData = Mage::getSingleton('customer/session')->getCustomer();
printf("%s\n %s\n %s\n %s",
$customerData->getId(),
$customerData->getWebsiteId(),
$customerData->getStoreId(),
$customerData->getIsActive());
//Zend_Debug::dump($customerData);
} |