![]()
I was writing an order export module the other day, and I was needing to get some data from orders and found myself unable to get any customer information such as ->getCustomerEmail(). I was getting the order model collection with the following code:
$orders = Mage::getModel('sales/order')->getCollection();
I could have sworn that in some other context, I was able to get a bunch more information from the order model than what I was able to get from this. Then, with some help from the #magento channel on IRC, I realized that the getCollection() method seems to only return data from itself, and no other related models. It’s limited. If you just add a ‘*’ to the call, you’ll end up getting a lot more data, and I was able to then use getCustomerEmail().
$orders = Mage::getModel('sales/order')->getCollection('*');
