File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
app/code/core/Mage/Adminhtml/Block/Widget Expand file tree Collapse file tree 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)
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 /**
You can’t perform that action at this time.
0 commit comments