Skip to content

Commit 4e7a8e1

Browse files
authored
Revert of Mage_Adminhtml_Block_Widget_Grid::_exportIterateCollection (#1914)
1 parent 758dc6c commit 4e7a8e1

File tree

1 file changed

+12
-6
lines changed
  • app/code/core/Mage/Adminhtml/Block/Widget

1 file changed

+12
-6
lines changed

app/code/core/Mage/Adminhtml/Block/Widget/Grid.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,23 +971,29 @@ public function _exportIterateCollection($callback, array $args)
971971
$originalCollection = $this->getCollection();
972972
$count = null;
973973
$page = 1;
974+
$lPage = null;
975+
$break = false;
974976

975-
do {
977+
while ($break !== true) {
976978
$collection = clone $originalCollection;
977979
$collection->setPageSize($this->_exportPageSize);
978980
$collection->setCurPage($page);
979981
$collection->load();
980-
981-
$count = $collection->count();
982-
983-
$page++;
982+
if (is_null($count)) {
983+
$count = $collection->getSize();
984+
$lPage = $collection->getLastPageNumber();
985+
}
986+
if ($lPage == $page) {
987+
$break = true;
988+
}
989+
$page ++;
984990

985991
foreach ($collection as $item) {
986992
call_user_func_array(array($this, $callback), array_merge(array($item), $args));
987993
}
988994
$collection->clear();
989995
unset($collection);
990-
} while($count == $this->_exportPageSize);
996+
}
991997
}
992998

993999
/**

0 commit comments

Comments
 (0)