I need to get order collection of last one year, In which I have to show data month wise like

Jan - xxx(Orders)
Feb - xxx(Orders)
  • 1
    you can get report from admin section or you want to get it pro-grammatically Mar 9, 2017 at 6:58
  • I need to go programatically Mar 9, 2017 at 7:28
  • Want to use data for some custom pages Mar 9, 2017 at 7:28

1 Answer 1


Try below code

$fromDate = date('Y-m-d H:i:s', strtotime($fromDate));
$toDate = date('Y-m-d H:i:s', strtotime($toDate));

/* Get the collection */
$orders = Mage::getModel('sales/order')->getCollection()
    ->addAttributeToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate))
    ->addAttributeToFilter('status', array('eq' => Mage_Sales_Model_Order::STATE_COMPLETE))->setOrder('created_at', 'ASC');
foreach ($orders as $order) {
            //save Data you want show in $tmp array

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.