0

Currently, when we login to magento admin, it shows the order amount from last 24 hours by default. Is there a way to show Current Date (today) order amount as default?

A detailed solution will be much appreciated.

Amasty
  • 6,508
  • 1
  • 22
  • 59
Jason
  • 21
  • 3

1 Answers1

0

Copy app/code/core/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php to

app/code/local/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php

goto Mage_Adminhtml_Block_Dashboard_Orders_Grid and goto _prepareCollection...

change: from

 $collection = Mage::getResourceModel('reports/order_collection')
            ->addItemCountExpr()
            ->joinCustomerName('customer')

            ->orderByCreatedAt();

to

 $collection = Mage::getResourceModel('reports/order_collection')
            ->addItemCountExpr()
            ->joinCustomerName('customer');

            $todayStartOfDayDate  = Mage::app()->getLocale()->date()
            ->setTime('00:00:00')
            ->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);

        $todayEndOfDayDate  = Mage::app()->getLocale()->date()
            ->setTime('23:59:59')
            ->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);


         $collection->addAttributeToFilter('created_at', array(
            'from'  => $todayStartOfDayDate,
            'to'    =>  $todayEndOfDayDate,                    
        ));  
Amit Bera
  • 77,456
  • 20
  • 123
  • 237