-
Notifications
You must be signed in to change notification settings - Fork 29
import-export-improvements #82 : super attribute error message improvements #115
import-export-improvements #82 : super attribute error message improvements #115
Conversation
…s - not a super attribute error message improvements
…s - not a super attribute error message improvements - travis ci build code fix
…s - not a super attribute error message improvements - travis ci build code style fix
…s - not a super attribute error message improvements - travis ci build code style fixes
@tadhgbowe thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
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.
Hey, thanks for your PR. I have added a few comments on issues. I am happy with you adding more detail for the user. Good job.
* @param int $rowNum | ||
* @return bool | ||
*/ | ||
protected function _identifySuperAttributeError($superAttrCode, $rowNum) |
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 think we could probably make this method private and remove the _ in the name. For me since this method is only being used in this class making it private would work fine. Do you think that makes sense or would you think it should be open for extension? In that case I would make it public as we are trying to stay away from protected methods.
$codeNotGlobal = false; | ||
$codeNotTypeSelect = false; | ||
// Does this attribute code exist? Does is have the correct settings? | ||
$commonAttributes = self::$commonAttributesCache; |
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.
Do we need this assignment or could we just loop through the cache directly?
$codeNotTypeSelect = false; | ||
// Does this attribute code exist? Does is have the correct settings? | ||
$commonAttributes = self::$commonAttributesCache; | ||
foreach ($commonAttributes as $attributeRow) { |
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.
Is there no way to access the attribute from the cache via the code rather than looping through all attributes. This could be a big performance hit if you have a large amount of attributes.
} | ||
} | ||
|
||
if ($codeExists == false) { |
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.
Since we are setting these attributes let's do a === check here just to be sure we are dealing with booleans.
// check attribute superity | ||
$this->_entityModel->addRowError(self::ERROR_ATTRIBUTE_CODE_IS_NOT_SUPER, $rowNum, $superAttrCode); | ||
// Identify reason why attribute is not super: | ||
if (!$this->_identifySuperAttributeError($superAttrCode, $rowNum)) { |
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.
Overall I like adding in this new check to give some more useful information to the user.
*/ | ||
protected $_messageTemplates = [ | ||
self::ERROR_ATTRIBUTE_CODE_IS_NOT_SUPER => 'Attribute with code "%s" is not super', | ||
self::ERROR_INVALID_OPTION_VALUE => 'Invalid option value for attribute "%s"', | ||
self::ERROR_ATTRIBUTE_CODE_DOES_NOT_EXIST => 'Column configurable_variations: Attribute with code "%s" does not exist or is missing from product attribute set', |
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?
…s - not a super attribute error message improvements - code styling fixes
@tadhgbowe there seem to be a could of static test failures now.
The first one seems like not a big problem to update. The second might take a bit of refactoring on the method to see if it can be decreased a bit. If you need some help, feel free to reach out to me on that. |
…s - not a super attribute error message improvements - code styling Travis CI build fixes
@dmanners - thanks for the update earlier. Yep I noticed it too. I pushed up some enhancements (i.e. tidy up!) earlier on. Removing the foreach introduced this little beauty. There were some cyclomatic complexities too. I'm on the case... :-) ps. hope you've been out for fresh air ;-) |
…s - not a super attribute error message improvements - code styling Travis CI build fixes
…s - not a super attribute error message improvements - code styling Travis CI build fixes
Hi @tadhgbowe looking good for the changes, I will check why the integration tests are timing out and get back to you on the next steps for this pr. Weekend involved plenty of fresh air and family time. |
Morning @dmanners. #NoMagentoSunday working nicely for me. Football fever over here! |
So I have run the internal tools and it all seems fine from the testing side, think it might just be travis. Will pass this onto our QA team now @tadhgbowe and keep you updated. |
@dmanners - That's great. Thanks for the update. I've got a few other issues to get on with. Cheers. T |
…essage improvements #115
Improvement to product import error handling for configurable variations column super attribute codes.
Description
If the standard product import detects that a configurable_variations attribute code is not super one the following error messages will be displayed:
Attribute code does not exist or is not in chosen attribute set.
Attribute code needs to have an Input Type of "Dropdown", "Visual Swatch" or Text Swatch"
Attribute code needs to have a Scope of "Global".
This covers all the reasons why it may not be a not super attribute. Displaying "Attribute with this code is not super" is not helpful enough.
Fixed Issues (if relevant)
#82
Please see the above issue as there is a full comment trace.
Manual testing scenarios
Try import a configurable product with a super attribute code inside configurable_variations that:
Contribution checklist