I know Magento orders can be attained with
$orders = Mage::getResourceModel('sales/order_collection');
but then how can I get the information for each order? The information I need most per order is: SKUs purchased, date purchased, money spent on each item, and discounts, if any.
All help is greatly appreciated and I always accept an answer!
Not a direct answer
Mage::getResourceModel('sales/order_collection');
retrieves collection of orders (sales_flat_order
)
SKU is stored in sales_flat_order_item
From order you can get order items using method getAllVisibleItems (it will retrieve respective sales_flat_order_item
) see the definition in Mage_Sales_Model_Order
$orders = Mage::getResourceModel('sales/order_collection');
foreach($orders as $order){
$items = $order->getAllVisibleItems();
foreach($items as $item){
$sku = $item->getSku();
}
}
The point is like that, you have to modify it by yourself.
For the money spent on each item, you can also take a look at sales_flat_order_item