52 parent::__construct($context);
64 \
Magento\Framework\View\Element\AbstractBlock $resultBlock,
71 $message .= ++$counter .
'. ' . $error .
'<br>';
72 if ($counter >= self::LIMIT_ERRORS_MESSAGE) {
78 $message .= $error->getErrorMessage()
79 .
' <a href="#" onclick="$(this).next().show();$(this).hide();return false;">' 80 .
__(
'Show more') .
'</a><div style="display:none;">' .
__(
'Additional data') .
': ' 81 . $error->getErrorDescription() .
'</div>';
85 $resultBlock->addNotice(
86 '<strong>' .
__(
'Following Error(s) has been occurred during importing process:') .
'</strong><br>' 87 .
'<div class="import-error-wrapper">' .
__(
'Only the first 100 errors are shown. ')
90 .
'">' .
__(
'Download full report') .
'</a><br>' 91 .
'<div class="import-error-list">' .
$message .
'</div></div>' 93 }
catch (\Exception $e) {
95 $resultBlock->addError($errorMessage);
111 foreach ($rowMessages as $errorCode => $rows) {
112 $messages[] = $errorCode .
' ' .
__(
'in row(s):') .
' ' . implode(
', ', $rows);
132 $this->historyModel->loadLastInsertItem();
133 $sourceFile = $this->reportHelper->getReportAbsolutePath($this->historyModel->getImportedFile());
134 $writeOnlyErrorItems =
true;
135 if ($this->historyModel->getData(
'execution_time') == ModelHistory::IMPORT_VALIDATION) {
136 $writeOnlyErrorItems =
false;
138 $fileName = $this->reportProcessor->createReport($sourceFile, $errorAggregator, $writeOnlyErrorItems);
139 $this->historyModel->addErrorReportFile(
$fileName);
149 return $this->
getUrl(self::IMPORT_HISTORY_FILE_DOWNLOAD_ROUTE, [
'filename' =>
$fileName]);
createDownloadUrlImportHistoryFile($fileName)
addErrorMessages(\Magento\Framework\View\Element\AbstractBlock $resultBlock, ProcessingErrorAggregatorInterface $errorAggregator)
getUrl($route='', $params=[])
const ERROR_CODE_SYSTEM_EXCEPTION
getErrorsCount(array $errorLevels=[ProcessingError::ERROR_LEVEL_CRITICAL, ProcessingError::ERROR_LEVEL_NOT_CRITICAL])
__construct(\Magento\Backend\App\Action\Context $context, \Magento\ImportExport\Model\Report\ReportProcessorInterface $reportProcessor, \Magento\ImportExport\Model\History $historyModel, \Magento\ImportExport\Helper\Report $reportHelper)
createErrorReport(ProcessingErrorAggregatorInterface $errorAggregator)
getSystemExceptions(ProcessingErrorAggregatorInterface $errorAggregator)
const IMPORT_HISTORY_FILE_DOWNLOAD_ROUTE
const LIMIT_ERRORS_MESSAGE
getErrorMessages(ProcessingErrorAggregatorInterface $errorAggregator)
getErrorsByCode(array $codes)
getRowsGroupedByErrorCode(array $errorCode=[], array $excludedCodes=[], $replaceCodeWithMessage=true)