Skip to content

Commit 7f9f6db

Browse files
author
Tadhg Bowe
committed
import-export-improvements #82 : configurable variations - not a super attribute error message improvements - travis ci build code style fix
1 parent 65bce0a commit 7f9f6db

File tree

1 file changed

+11
-15
lines changed
  • app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type

1 file changed

+11
-15
lines changed

Diff for: app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php

+11-15
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ class Configurable extends \Magento\CatalogImportExport\Model\Import\Product\Typ
4141

4242
const ERROR_UNIDENTIFIABLE_VARIATION = 'unidentifiableVariation';
4343

44+
// @codingStandardsIgnoreStart
4445
/**
4546
* Validation failure message template definitions
4647
*
4748
* @var array
49+
*
50+
* Note: Many of these messages exceed maximum limit of 120 characters. Ignore from coding standards.
4851
*/
4952
protected $_messageTemplates = [
5053
self::ERROR_ATTRIBUTE_CODE_DOES_NOT_EXIST => 'Column configurable_variations: Attribute with code "%s" does not exist or is missing from product attribute set',
@@ -56,6 +59,7 @@ class Configurable extends \Magento\CatalogImportExport\Model\Import\Product\Typ
5659
self::ERROR_DUPLICATED_VARIATIONS => 'SKU %s contains duplicated variations',
5760
self::ERROR_UNIDENTIFIABLE_VARIATION => 'Configurable variation "%s" is unidentifiable',
5861
];
62+
// @codingStandardsIgnoreEnd
5963

6064
/**
6165
* Column names that holds values with particular meaning.
@@ -300,8 +304,7 @@ protected function _isParticularAttributesValid(array $rowData, $rowNum)
300304
$superAttrCode = $rowData['_super_attribute_code'];
301305
if (!$this->_isAttributeSuper($superAttrCode)) {
302306
// Identify reason why attribute is not super:
303-
if (!$this->_identifySuperAttributeError($superAttrCode, $rowNum))
304-
{
307+
if (!$this->_identifySuperAttributeError($superAttrCode, $rowNum)) {
305308
$this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_IS_NOT_SUPER, $rowNum, $superAttrCode);
306309
}
307310
return false;
@@ -334,36 +337,29 @@ protected function _identifySuperAttributeError($superAttrCode, $rowNum)
334337
// Does this attribute code exist? Does is have the correct settings?
335338
$commonAttributes = self::$commonAttributesCache;
336339
foreach ($commonAttributes as $attributeRow) {
337-
338-
if ($attributeRow['code'] == $superAttrCode)
339-
{
340+
if ($attributeRow['code'] == $superAttrCode) {
340341
$codeExists = true;
341342

342-
if ($attributeRow['is_global'] !== '1')
343-
{
343+
if ($attributeRow['is_global'] !== '1') {
344344
$codeNotGlobal = true;
345345
}
346-
elseif ($attributeRow['type'] !== 'select')
347-
{
346+
elseif ($attributeRow['type'] !== 'select') {
348347
$codeNotTypeSelect = true;
349348
}
350349

351350
break;
352351
}
353352
}
354353

355-
if ($codeExists == false)
356-
{
354+
if ($codeExists == false) {
357355
$this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_DOES_NOT_EXIST, $rowNum, $superAttrCode);
358356
$reasonFound = true;
359357
}
360-
elseif ($codeNotGlobal == true)
361-
{
358+
elseif ($codeNotGlobal == true) {
362359
$this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_NOT_GLOBAL_SCOPE, $rowNum, $superAttrCode);
363360
$reasonFound = true;
364361
}
365-
elseif ($codeNotTypeSelect == true)
366-
{
362+
elseif ($codeNotTypeSelect == true) {
367363
$this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_NOT_TYPE_SELECT, $rowNum, $superAttrCode);
368364
$reasonFound = true;
369365
}

0 commit comments

Comments
 (0)