Skip to content

Commit 98f9827

Browse files
committed
ACP2E-1813: Scheduled import logs successful run despite the error
- added error messages to log
1 parent f01fccc commit 98f9827

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ class Product extends AbstractEntity
305305
ValidatorInterface::ERROR_INVALID_VARIATIONS_CUSTOM_OPTIONS => 'Value for \'%s\' sub attribute in \'%s\' attribute contains incorrect value, acceptable values are: \'dropdown\', \'checkbox\', \'radio\', \'text\'',
306306
ValidatorInterface::ERROR_INVALID_MEDIA_URL_OR_PATH => 'Wrong URL/path used for attribute %s',
307307
ValidatorInterface::ERROR_MEDIA_PATH_NOT_ACCESSIBLE => 'Imported resource (image) does not exist in the local media storage',
308-
ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE => 'Imported resource (image) could not be downloaded from external resource due to timeout or access permissions',
308+
ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE => 'Imported resource (image: %s) at row %s could not be downloaded from external resource due to timeout or access permissions',
309309
ValidatorInterface::ERROR_INVALID_WEIGHT => 'Product weight is invalid',
310310
ValidatorInterface::ERROR_DUPLICATE_URL_KEY => 'Url key: \'%s\' was already generated for an item with the SKU: \'%s\'. You need to specify the unique URL key manually',
311311
ValidatorInterface::ERROR_DUPLICATE_MULTISELECT_VALUES => 'Value for multiselect attribute %s contains duplicated values',
@@ -1888,7 +1888,7 @@ private function saveProductMediaGalleryPhase(
18881888
ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE,
18891889
$rowNum,
18901890
null,
1891-
null,
1891+
sprintf($this->_messageTemplates[ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE], $columnImage, $rowNum),
18921892
ProcessingError::ERROR_LEVEL_NOT_CRITICAL
18931893
);
18941894
}

app/code/Magento/ImportExport/Model/Import.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -513,19 +513,21 @@ public function importSource()
513513
$this->getDataSourceModel()->markProcessedBunches($ids);
514514

515515
if ($result) {
516-
$this->addLogComment(
517-
[
518-
__(
519-
'Checked rows: %1, checked entities: %2, invalid rows: %3, total errors: %4',
520-
$this->getProcessedRowsCount(),
521-
$this->getProcessedEntitiesCount(),
522-
$this->getErrorAggregator()->getInvalidRowsCount(),
523-
$this->getErrorAggregator()->getErrorsCount()
524-
),
525-
$this->getForceImport() == '0' && $this->getErrorAggregator()->getErrorsCount() > 0 ?
526-
__('The import was not successful.') : __('The import was successful.'),
527-
]
528-
);
516+
$logComments = [
517+
__(
518+
'Checked rows: %1, checked entities: %2, invalid rows: %3, total errors: %4',
519+
$this->getProcessedRowsCount(),
520+
$this->getProcessedEntitiesCount(),
521+
$this->getErrorAggregator()->getInvalidRowsCount(),
522+
$this->getErrorAggregator()->getErrorsCount()
523+
)
524+
];
525+
foreach ($this->getErrorAggregator()->getAllErrors() as $error) {
526+
$logComments[] = $error->getErrorMessage();
527+
}
528+
$logComments[] = $this->getForceImport() == '0' && $this->getErrorAggregator()->getErrorsCount() > 0 ?
529+
__('The import was not successful.') : __('The import was successful.');
530+
$this->addLogComment($logComments);
529531
$this->importHistoryModel->updateReport($this, true);
530532
} else {
531533
$this->importHistoryModel->invalidateReport($this);

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ImportWithNotExistImagesTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,6 @@ private function assertImportErrors(): void
222222
RowValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE,
223223
$importError->getErrorCode()
224224
);
225-
$errorMsg = (string)__('Imported resource (image) could not be downloaded ' .
226-
'from external resource due to timeout or access permissions');
227-
$this->assertEquals($errorMsg, $importError->getErrorMessage());
228225
}
229226

230227
/**

0 commit comments

Comments
 (0)