Skip to content

Conversation

@gomencal
Copy link
Contributor

@gomencal gomencal commented Oct 26, 2017

#8846

Description

When adding an attribute option, check if its label exists for current attribute. If so, doesn't add the option and return false.

Fixed Issues

  1. Attribute option value uniqueness is not checked if created via REST Api #8846 Attribute option value uniqueness is not checked if created via REST Api

Manual testing scenarios

Same testing described at issues #8846. Add an attribute option via API twice.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@orlangur
Copy link
Contributor

What is current behavior for identical labels added via Admin UI?

@gomencal
Copy link
Contributor Author

What is current behavior for identical labels added via Admin UI?

HI @orlangur, it's validated via js, in app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml:
<script type="text/x-magento-init"> { "*": { "Magento_Catalog/js/options": { "attributesData": <?= /* @noEscape */ json_encode($values, JSON_HEX_QUOT) ?>, "isSortable": <?= (int)(!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) ?>, "isReadOnly": <?= (int)$block->getReadOnly() ?> }, "Magento_Catalog/catalog/product/attribute/unique-validate": { "element": "required-dropdown-attribute-unique", "message": "<?= $block->escapeHtml(__("The value of Admin must be unique.")) ?>" } } } </script>

@orlangur
Copy link
Contributor

Oh :O Didn't expect we still have some client side validations stricter than server side.

@okorshenko okorshenko self-assigned this Oct 31, 2017
@okorshenko okorshenko added this to the October 2017 milestone Oct 31, 2017
@okorshenko okorshenko added Release Line: 2.2 2.2.x bug report Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog labels Oct 31, 2017
@okorshenko okorshenko modified the milestones: October 2017, November 2017 Nov 1, 2017
@magento-team magento-team merged commit ec08353 into magento:2.2-develop Nov 7, 2017
magento-team pushed a commit that referenced this pull request Nov 7, 2017
[EngCom] Public Pull Requests - 2.2-develop
 - MAGETWO-83279: Magento 2.2.0 Solution for Cross-sell product placeholder image size … #12018
 - MAGETWO-83270: 11700: "Something Went Wrong" error for limited access admin user #11993
 - MAGETWO-83085: fix #8846: avoid duplicated attribute option values #11785
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug report bugfix Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog Progress: accept Release Line: 2.2 Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants