Skip to content

Commit

Permalink
Merge pull request #633 from magento-nord/MAGETWO-52831
Browse files Browse the repository at this point in the history
[NORD] MAGETWO-52831 fix
  • Loading branch information
Korshenko, Oleksii(okorshenko) committed May 18, 2016
2 parents 3207334 + 817c1ef commit 6144265
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ protected function collectRawData()
$additionalAttributes[$fieldName] = $fieldName .
ImportProduct::PAIR_NAME_VALUE_SEPARATOR . $attrValue;
}
$data[$itemId][$storeId][$fieldName] = $attrValue;
$data[$itemId][$storeId][$fieldName] = htmlspecialchars_decode($attrValue);
}
} else {
$this->collectMultiselectValues($item, $code, $storeId);
Expand All @@ -934,6 +934,7 @@ protected function collectRawData()
}

if (!empty($additionalAttributes)) {
$additionalAttributes = array_map('htmlspecialchars_decode', $additionalAttributes);
$data[$itemId][$storeId][self::COL_ADDITIONAL_ATTRIBUTES] =
implode(Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, $additionalAttributes);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
ValidatorInterface::ERROR_MEDIA_PATH_NOT_ACCESSIBLE => 'Imported resource (image) does not exist in the local media storage',
ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE => 'Imported resource (image) could not be downloaded from external resource due to timeout or access permissions',
ValidatorInterface::ERROR_INVALID_WEIGHT => 'Product weight is invalid',
ValidatorInterface::ERROR_DUPLICATE_URL_KEY => 'Specified url key already exists',
ValidatorInterface::ERROR_DUPLICATE_URL_KEY => 'Specified URL key already exists',
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function execute()
$errorAggregator = $import->getErrorAggregator();
if (!$validationResult) {
$resultBlock->addError(
__('Data validation is failed. Please fix errors and re-upload the file..')
__('Data validation failed. Please fix the following errors and upload the file again.')
);
$this->addErrorMessages($resultBlock, $errorAggregator);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function addErrorMessages(
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. ')
. '<div class="import-error-wrapper">' . __('Only the first 100 errors are shown. ')
. '<a href="'
. $this->createDownloadUrlImportHistoryFile($this->createErrorReport($errorAggregator))
. '">' . __('Download full report') . '</a><br>'
Expand All @@ -109,7 +109,7 @@ protected function getErrorMessages(ProcessingErrorAggregatorInterface $errorAgg
$messages = [];
$rowMessages = $errorAggregator->getRowsGroupedByErrorCode([], [AbstractEntity::ERROR_CODE_SYSTEM_EXCEPTION]);
foreach ($rowMessages as $errorCode => $rows) {
$messages[] = $errorCode . ' ' . __('in rows:') . ' ' . implode(', ', $rows);
$messages[] = $errorCode . ' ' . __('in row(s):') . ' ' . implode(', ', $rows);
}
return $messages;
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/ImportExport/Model/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ public function getOperationResultMessages(ProcessingErrorAggregatorInterface $v
$messages = [];
if ($this->getProcessedRowsCount()) {
if ($validationResult->getErrorsCount()) {
$messages[] = __('Data validation is failed. Please fix errors and re-upload the file.');
$messages[] = __('Data validation failed. Please fix the following errors and upload the file again.');

// errors info
foreach ($validationResult->getRowsGroupedByErrorCode() as $errorMessage => $rows) {
$error = $errorMessage . ' ' . __('in rows') . ': ' . implode(', ', $rows);
$error = $errorMessage . ' ' . __('in row(s)') . ': ' . implode(', ', $rows);
$messages[] = $error;
}
} else {
Expand Down
12 changes: 6 additions & 6 deletions app/code/Magento/ImportExport/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ Status,Status
"Maximum error count has been reached or system error is occurred!","Maximum error count has been reached or system error is occurred!"
"Import successfully done","Import successfully done"
"This file is empty. Please try another one.","This file is empty. Please try another one."
"Data validation is failed. Please fix errors and re-upload the file..","Data validation is failed. Please fix errors and re-upload the file.."
"Data validation failed. Please fix the following errors and upload the file again.","Data validation failed. Please fix the following errors and upload the file again."
"File is valid! To start import process press ""Import"" button","File is valid! To start import process press ""Import"" button"
"The file is valid, but we can\'t import it for some reason.","The file is valid, but we can\'t import it for some reason."
"Checked rows: %1, checked entities: %2, invalid rows: %3, total errors: %4","Checked rows: %1, checked entities: %2, invalid rows: %3, total errors: %4"
"The file was not uploaded.","The file was not uploaded."
"Sorry, but the data is invalid or the file is not uploaded.","Sorry, but the data is invalid or the file is not uploaded."
"Show more","Show more"
"Additional data","Additional data"
"Following Error(s) has been occurred during importing process:","Following Error(s) has been occurred during importing process:"
"Only first 100 errors are displayed here. ","Only first 100 errors are displayed here. "
"The following error(s) occurred when importing the data:","The following error(s) occurred when importing the data:"
"Only the first 100 errors are shown. ","Only the first 100 errors are shown. "
"Download full report","Download full report"
"in rows:","in rows:"
"in row(s):","in row(s):"
"Make sure your file isn\'t more than %1M.","Make sure your file isn\'t more than %1M."
"We can\'t provide the upload settings right now.","We can\'t provide the upload settings right now."
"Created: %1, Updated: %2, Deleted: %3","Created: %1, Updated: %2, Deleted: %3"
Expand All @@ -72,8 +72,8 @@ Status,Status
"The destination directory is not writable.","The destination directory is not writable."
"Destination file is not writable","Destination file is not writable"
"The header column names are already set.","The header column names are already set."
"Data validation is failed. Please fix errors and re-upload the file.","Data validation is failed. Please fix errors and re-upload the file."
"in rows","in rows"
"Data validation failed. Please fix the following errors and upload the file again.","Data validation failed. Please fix the following errors and upload the file again."
"in row(s)","in row(s)"
"The validation is complete.","The validation is complete."
"This file does not contain any data.","This file does not contain any data."
"Begin import of ""%1"" with ""%2"" behavior","Begin import of ""%1"" with ""%2"" behavior"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@
'option_1' => ['Option 1'],
'option_2' => ['Option 2'],
'option_3' => ['Option 3'],
'option_4' => ['Option 4 "!@#$%^&*'],
],
'order' => [
'option_1' => 1,
'option_2' => 2,
'option_3' => 3,
'option_4' => 4,
],
],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
)->setVisibility(
\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH
)->setMultiselectAttribute(
[$optionIds[1], $optionIds[2]]
[$optionIds[1], $optionIds[2], $optionIds[3]]
)->setStatus(
\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
)->setStockData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ public function testExport()
$exportData = $this->model->export();
$this->assertContains('New Product', $exportData);

$this->assertContains('Option 1 Value 1', $exportData);
$this->assertContains('Option 1 & Value 1"', $exportData);
$this->assertContains('Option 1 & Value 2"', $exportData);
$this->assertContains('Option 1 & Value 3"', $exportData);
$this->assertContains('Option 4 ""!@#$%^&*', $exportData);
$this->assertContains('test_option_code_2', $exportData);
$this->assertContains('max_characters=10', $exportData);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ public function testValidateUrlKeys($importFile, $errorsCount)
$this->assertTrue($errors->getErrorsCount() == $errorsCount);
if ($errorsCount >= 1) {
$this->assertEquals(
"Specified url key already exists",
"Specified URL key already exists",
$errors->getErrorByRowNumber(1)[0]->getErrorMessage()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ public function exportImportDataProvider()
'simple',
]
],
// @todo uncomment after resolving MAGETWO-49676
/*
'simple-product-crosssell' => [
[
'Magento/Catalog/_files/products_crosssell.php'
Expand All @@ -129,7 +127,6 @@ public function exportImportDataProvider()
'simple',
]
],
*/
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
'type' => 'drop_down',
'is_require' => 1,
'values' => [
1 => ['option_type_id' => -1, 'title' => 'Option 1 Value 1', 'price' => '1.00', 'price_type' => 'fixed'],
2 => ['option_type_id' => -1, 'title' => 'Option 1 Value 2', 'price' => '2.00', 'price_type' => 'fixed']
1 => ['option_type_id' => -1, 'title' => 'Option 1 & Value 1"', 'price' => '1.00', 'price_type' => 'fixed'],
2 => ['option_type_id' => -1, 'title' => 'Option 1 & Value 2"', 'price' => '2.00', 'price_type' => 'fixed'],
3 => ['option_type_id' => -1, 'title' => 'Option 1 & Value 3"', 'price' => '3.00', 'price_type' => 'fixed']
]
],
[
Expand Down

0 comments on commit 6144265

Please sign in to comment.