I am following this article. I would like to retrieve all Orders from Database. Can anyone say how can I do that??
Asked
Active
Viewed 498 times
3 Answers
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?
Raphael at Digital Pianism
- 70,385
- 34
- 188
- 352
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.
Bill Murray
- 667
- 6
- 19
0
If some one needs to read huge amount of data using command object, without having memory problems, you can use magento walk iterator.
example code on http://www.rosenborgsolutions.com/collection-walk-iterator.php
Nadeem Sayyed
- 320
- 2
- 7