A better way to accomplish what you are trying to do would be
//get any third party information you need
//customer = $app->getCustomer();
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
// Now you can run ANY Magento code you want
$orderCollection = Mage::getModel('sales/order')->getCollection();
//$orderCollection->addFieldToFilter('customer_email', $email);
$orderCollection->addFieldToFilter('customer_id', $id);
foreach ($orderCollection as $_order)
{
}
See
- Magento: Grab/Display Customer's Lifetime Sales Stats and Total Amount of Orders on Order View PagesMagento: Grab/Display Customer's Lifetime Sales Stats and Total Amount of Orders on Order View Pages
- Run Magento Code Externally
- How to get order list for logged in customer in magentoHow to get order list for logged in customer in magento