I need to get all orders id for current customer in my custom customer tab!
I'm using: $orders = Mage::getModel('sales/order')->getCollection();
This is my Tab where I want to add Order No and Sum:
I need to get all orders id for current customer in my custom customer tab!
I'm using: $orders = Mage::getModel('sales/order')->getCollection();
This is my Tab where I want to add Order No and Sum:
magento is stored customer_email
in order table(sales_flat_order
)
Now you can order list of order by using email id
and but need fetch current customer email id then you can customer order list by below code:
$orderCollection = Mage::getModel('sales/order')->getCollection()
->addFieldToFilter('customer_email',$customerEmail)->addFieldToSelect('*');
foreach($orderCollection as $order){
echo "<pre>";
print_r($order->getData());
echo "</pre>";
}
Please user the below code.
$orders = Mage::getResourceModel('sales/order_collection')
->addFieldToSelect('*')
->addFieldToFilter('customer_id',Mage::getSingleton('customer/session')->getCustomer()->getId())
->setOrder('created_at', 'desc');