2

I am following this article. I would like to retrieve all Orders from Database. Can anyone say how can I do that??

1

Using collection you can do it easily with one single line:

$orders = Mage::getResourceModel('sales/order_collection');

Then depending on what you want to do you can loop through them:

foreach ($orders as $order) {
    // Do something
}

NB: using foreach may be resource and time consuming, I suggest you think about using the walk iterator by reading this link: Is it possible to iterate over Magento collections with pagination natively?

1

Been answered the Magento Way. If you want to just excess them in the database themselves than let me know as it's a combination of several areas.

https://stackoverflow.com/questions/9741114/how-to-get-all-orders-and-all-invoices-from-php-in-magento

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.