loadTotalBySessionId($sessionId); $callbacks = array(); if ($mapperCb = $this->_parseCallback($this->getVar('mapper'), 'mapRow')) { $callbacks[] = $mapperCb; } if ($adapterCb = $this->_parseCallback($this->getVar('adapter'), 'saveRow')) { $callbacks[] = $adapterCb; } $callbacks[] = array($this, 'updateProgress'); echo $this->_getProgressBarHtml($sessionId, $total['cnt']); Mage::getModel('core/resource_iterator') ->walk($import->select($sessionId), $callbacks); } protected function _getProgressBarHtml($sessionId, $totalRows) { return '
  • ' . $this->__('Total records: %s', '' . $totalRows . '').', ' . $this->__('Processed records: %s', '0') .', ' . $this->__('ETA: %s', 'N/A') . ', ' . $this->__('Memory Used: %s', '' . memory_get_usage(true).'') . '
  • '; } public function updateProgress($args) { $memory = !empty($args['memory']) ? $args['memory'] : ''; echo ''; echo '
  • ' . $memory . '
  • '; return array(); } protected function _parseCallback($callback, $defaultMethod=null) { if (!preg_match('#^([a-z0-9_/]+)(::([a-z0-9_]+))?$#i', $callback, $match)) { return false; } if (!($model = Mage::getModel($match[1]))) { return false; } if (!($method = $match[3] ? $match[3] : $defaultMethod)) { return false; } return array($model, $method); } }