How to get last 7 days order information. I don't know how to write Collection of this,
Can you please guide some one ?
<?php
include_once "app/Mage.php";
umask(0);
Mage::app();
$fromDate = date('Y-m-d H:i:s', strtotime('-7 days'));
$todayDate = Mage::getModel('core/date')->date('Y-m-d H:i:s');
$orders = Mage::getModel('sales/order')->getCollection()
->addAttributeToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate));
foreach ($orders as $orderkey => $ordervalue) {
echo $eid = $ordervalue->getOrderId();
echo $order = Mage::getModel("sales/order")->load($eid);
echo $customerorderid = $order->getIncrementId();
echo $customeremailid = $order->getCustomerEmail();
echo $customername = $order->getCustomerFirstname();
}
?>
Best Answer
Please try this in test.php