How to get Orderd Product name,sku,qty etc in order collection Magento
<?php
class MPS_Ordermail_Model_Observer{
public function Test($event){
//do something
Mage::log("Testing success...........",null,'custom.log');
$ordershippeddays = 7; // number of days you want
$fromDate = gmdate("Y-m-d H:i:s", gmmktime(0, 0, 0, gmdate("m"), gmdate("d") - $ordershippeddays, gmdate("Y")));
$toDate = gmdate("Y-m-d H:i:s", gmmktime(23, 59, 59, gmdate("m"), gmdate("d"), gmdate("Y")));
$ordercollection = Mage::getResourceModel('sales/order_item_collection')
->addAttributeToSelect('order_id')
->addAttributeToSelect('created_at')
->addAttributeToFilter('created_at', array('from' => $fromDate, 'to' => $toDate))
->load();
count($ordercollection);
foreach ($ordercollection as $orderkey => $ordervalue) {
$eid = $ordervalue->getOrderId();
$order = Mage::getModel("sales/order")->load($eid);
Mage::log("Testing success...........");
Mage::log($customerorderid = $order->getIncrementId());
Mage::log($customeremailid = $order->getCustomerEmail());
Mage::log($customername = $order->getCustomerFirstname());
Mage::log($order->getPayment()->getMethodInstance()->getTitle());
Mage::log($order->getStatusLabel());
$billingAddress = $order->getBillingAddress();
$shipping_address = $order->getShippingAddress();
Mage::log($billingAddress->getStreetFull());
Mage::log($billingAddress->getRegion());
Mage::log($billingAddress->getCountry());
Mage::log($billingAddress->getPostcode());
Mage::log($billingAddress->getTelephone());
Mage::log($shipping_address->getStreetFull());
Mage::log($shipping_address->getRegion());
Mage::log($shipping_address->getCountry());
Mage::log($shipping_address->getPostcode());
Mage::log($shipping_address->getTelephone());
Mage::log($orderTotalValue = number_format ($order->getGrandTotal(), 2, '.' , $thousands_sep = ''));
}
}
}