Magento Get Order Collection Bug 1.4.X

Magento Get Order Collection Bug 1.4.X

Iíve run across a bug in Magento where if I get an Order Collection and then call getAllIds(); It errors out. This is a bug with Magento.

In the file app/code/core/Mage/Sales/Model/Mysql4/Order/Collection.php there is a function called _getAllIdsSelect(); and in the function it calles parent::getAllIds which causes an infinite loop.

Simply change this function to read: (I suggest you copy this file and folder structure to your app/code/local/ folder)

protected function _getAllIdsSelect($limit = null, $offset = null)
 {
 $idsSelect = parent::_getAllIdsSelect($limit, $offset);
 $idsSelect->resetJoinLeft();
 return $idsSelect;
 }

This should solve the infinite loop error and you will be able to traverse through orders normally.

Comments
comments powered by Disqus