title: Magento retrieve customer ID
body: <p>I've tried various methods to get the customerID but an empty value is stored in the variable. Please advise :) </p>
  
  <p>Below remnants of things I've tried. The file is located in the root.</p>
  
  <pre><code>require_once '/home/ab71714/public_html/app/Mage.php';
  //Mage::app("default");
  
  Mage::app()-&gt;setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
  
  /* if(Mage::getSingleton('customer/session')-&gt;isLoggedIn()) {
       $customerData = Mage::getSingleton('customer/session')-&gt;getCustomer();
        echo $customerData-&gt;getId();
   } */
  
   if(Mage::getSingleton('customer/session')-&gt;isLoggedIn()) {
      $customerId = Mage::getModel('customer/session')-&gt;getCustomer()-&gt;getId();
  } else {
      echo 'Not logged In';
  }
  </code></pre>