Ejemplo n.º 1
0
 /**
  * @param \Magento\Framework\View\Element\AbstractBlock $resultBlock
  * @param ProcessingErrorAggregatorInterface $errorAggregator
  * @return $this
  */
 protected function addErrorMessages(\Magento\Framework\View\Element\AbstractBlock $resultBlock, ProcessingErrorAggregatorInterface $errorAggregator)
 {
     if ($errorAggregator->getErrorsCount()) {
         $message = '';
         $counter = 0;
         foreach ($this->getErrorMessages($errorAggregator) as $error) {
             $message .= ++$counter . '. ' . $error . '<br>';
             if ($counter >= self::LIMIT_ERRORS_MESSAGE) {
                 break;
             }
         }
         if ($errorAggregator->hasFatalExceptions()) {
             foreach ($this->getSystemExceptions($errorAggregator) as $error) {
                 $message .= $error->getErrorMessage() . ' <a href="#" onclick="$(this).next().show();$(this).hide();return false;">' . __('Show more') . '</a><div style="display:none;">' . __('Additional data') . ': ' . $error->getErrorDescription() . '</div>';
             }
         }
         try {
             $resultBlock->addNotice('<strong>' . __('Following Error(s) has been occurred during importing process:') . '</strong><br>' . '<div class="import-error-wrapper">' . __('Only first 100 errors are displayed here. ') . '<a href="' . $this->createDownloadUrlImportHistoryFile($this->createErrorReport($errorAggregator)) . '">' . __('Download full report') . '</a><br>' . '<div class="import-error-list">' . $message . '</div></div>');
         } catch (\Exception $e) {
             foreach ($this->getErrorMessages($errorAggregator) as $errorMessage) {
                 $resultBlock->addError($errorMessage);
             }
         }
     }
     return $this;
 }