File tree 1 file changed +12
-6
lines changed
app/code/core/Mage/Adminhtml/Block/Widget 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -971,23 +971,29 @@ public function _exportIterateCollection($callback, array $args)
971
971
$ originalCollection = $ this ->getCollection ();
972
972
$ count = null ;
973
973
$ page = 1 ;
974
+ $ lPage = null ;
975
+ $ break = false ;
974
976
975
- do {
977
+ while ( $ break !== true ) {
976
978
$ collection = clone $ originalCollection ;
977
979
$ collection ->setPageSize ($ this ->_exportPageSize );
978
980
$ collection ->setCurPage ($ page );
979
981
$ 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 ++;
984
990
985
991
foreach ($ collection as $ item ) {
986
992
call_user_func_array (array ($ this , $ callback ), array_merge (array ($ item ), $ args ));
987
993
}
988
994
$ collection ->clear ();
989
995
unset($ collection );
990
- } while ( $ count == $ this -> _exportPageSize );
996
+ }
991
997
}
992
998
993
999
/**
You can’t perform that action at this time.
0 commit comments