4

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:

enter image description here

  • you need put new question.. question was totally changed – Amit Bera Oct 29 '14 at 10:50
3

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>";
}
2

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'); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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