I'm building a custom report sales order using the following code as a start. I'm trying to get all orders that have been updated Yesterday, by passing filters from date and to date to
$date = Mage::getSingleton('core/date'); $formatDate = 'Y-m-d H:i:s'; $from_date = $date->gmtDate($formatDate, 'Yesterday 12:00:00AM'); $to_date = $date->gmtDate($formatDate, 'Yesterday 11:59:59PM'); $updated_order_collection = Mage::getModel('sales/order')->getCollection() ->addAttributeToFilter('updated_at', array( 'from' => $from_date, 'to' => $to_date, 'date' => true, ))->load(); $updated_count = count($updated_order_collection); // Total order is not matching Magento's sales order report as showon in the screenshot.
I was not able to get the same result as Magento's sales order report. The custom code total orders are less than Magento's total orders. See picture below for more details.
So I'm wondering what I'm missing to get an incorrect total results.