-
Notifications
You must be signed in to change notification settings - Fork 28
import-export-improvements #82 : super attribute error message improvements #115
Changes from 1 commit
e99c99e
65bce0a
7f9f6db
a76e3a3
3a0599d
6a5b15d
b98f417
8db836b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…r attribute error message improvements - travis ci build code style fix
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,10 +41,13 @@ class Configurable extends \Magento\CatalogImportExport\Model\Import\Product\Typ | |
|
|
||
| const ERROR_UNIDENTIFIABLE_VARIATION = 'unidentifiableVariation'; | ||
|
|
||
| // @codingStandardsIgnoreStart | ||
| /** | ||
| * Validation failure message template definitions | ||
| * | ||
| * @var array | ||
| * | ||
| * Note: Many of these messages exceed maximum limit of 120 characters. Ignore from coding standards. | ||
| */ | ||
| protected $_messageTemplates = [ | ||
| 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 | |
| self::ERROR_DUPLICATED_VARIATIONS => 'SKU %s contains duplicated variations', | ||
| self::ERROR_UNIDENTIFIABLE_VARIATION => 'Configurable variation "%s" is unidentifiable', | ||
| ]; | ||
| // @codingStandardsIgnoreEnd | ||
|
|
||
| /** | ||
| * Column names that holds values with particular meaning. | ||
|
|
@@ -300,8 +304,7 @@ protected function _isParticularAttributesValid(array $rowData, $rowNum) | |
| $superAttrCode = $rowData['_super_attribute_code']; | ||
| if (!$this->_isAttributeSuper($superAttrCode)) { | ||
| // Identify reason why attribute is not super: | ||
| if (!$this->_identifySuperAttributeError($superAttrCode, $rowNum)) | ||
| { | ||
| if (!$this->_identifySuperAttributeError($superAttrCode, $rowNum)) { | ||
|
||
| $this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_IS_NOT_SUPER, $rowNum, $superAttrCode); | ||
| } | ||
| return false; | ||
|
|
@@ -334,36 +337,29 @@ protected function _identifySuperAttributeError($superAttrCode, $rowNum) | |
| // Does this attribute code exist? Does is have the correct settings? | ||
| $commonAttributes = self::$commonAttributesCache; | ||
|
||
| foreach ($commonAttributes as $attributeRow) { | ||
|
||
|
|
||
| if ($attributeRow['code'] == $superAttrCode) | ||
| { | ||
| if ($attributeRow['code'] == $superAttrCode) { | ||
| $codeExists = true; | ||
|
|
||
| if ($attributeRow['is_global'] !== '1') | ||
| { | ||
| if ($attributeRow['is_global'] !== '1') { | ||
| $codeNotGlobal = true; | ||
| } | ||
| elseif ($attributeRow['type'] !== 'select') | ||
| { | ||
| elseif ($attributeRow['type'] !== 'select') { | ||
| $codeNotTypeSelect = true; | ||
| } | ||
|
|
||
| break; | ||
| } | ||
| } | ||
|
|
||
| if ($codeExists == false) | ||
| { | ||
| if ($codeExists == false) { | ||
|
||
| $this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_DOES_NOT_EXIST, $rowNum, $superAttrCode); | ||
| $reasonFound = true; | ||
| } | ||
| elseif ($codeNotGlobal == true) | ||
| { | ||
| elseif ($codeNotGlobal == true) { | ||
| $this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_NOT_GLOBAL_SCOPE, $rowNum, $superAttrCode); | ||
| $reasonFound = true; | ||
| } | ||
| elseif ($codeNotTypeSelect == true) | ||
| { | ||
| elseif ($codeNotTypeSelect == true) { | ||
| $this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_NOT_TYPE_SELECT, $rowNum, $superAttrCode); | ||
| $reasonFound = true; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen a few of these line issues before and people will format the array so the key and value are on two different lines. Would that make lines under 120 characters? Also does that make sense from your point of view?