Skip to content

Commit

Permalink
Revert of Mage_Adminhtml_Block_Widget_Grid::_exportIterateCollection (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
midlan authored Dec 23, 2021
1 parent 758dc6c commit 4e7a8e1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -971,23 +971,29 @@ public function _exportIterateCollection($callback, array $args)
$originalCollection = $this->getCollection();
$count = null;
$page = 1;
$lPage = null;
$break = false;

do {
while ($break !== true) {
$collection = clone $originalCollection;
$collection->setPageSize($this->_exportPageSize);
$collection->setCurPage($page);
$collection->load();

$count = $collection->count();

$page++;
if (is_null($count)) {
$count = $collection->getSize();
$lPage = $collection->getLastPageNumber();
}
if ($lPage == $page) {
$break = true;
}
$page ++;

foreach ($collection as $item) {
call_user_func_array(array($this, $callback), array_merge(array($item), $args));
}
$collection->clear();
unset($collection);
} while($count == $this->_exportPageSize);
}
}

/**
Expand Down

0 comments on commit 4e7a8e1

Please sign in to comment.