Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hilrob opened this issue Mar 10, 2017 · 8 comments
Closed
Assignees
Labels
bug report Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development 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

Comments

@hilrob
Copy link

hilrob commented Mar 10, 2017

Preconditions

  1. Magento CE 2.1.4
  2. PHP 7.x
  3. MySQL 5.7

Steps to reproduce

  1. Send the same call to create an option twice
    URL: /rest/V1/products/attributes/color/options
    POST:
{
    "option": {
      "label": "Black1",
      "sort_order": 9999,
      "is_default": false
    }
}
  1. Get the attribute via API or check the backend
    Response:
[
  {
    "label": "offwhite/schwarz gestreift",
    "value": "281"
  },
  {
    "label": "red1",
    "value": "286"
  },
  {
    "label": "schwarz/mehrfarbig",
    "value": "282"
  },
  {
    "label": "Black1",
    "value": "287"
  },
  {
    "label": "Black1",
    "value": "288"
  },
  {
    "label": "Black1",
    "value": "289"
  }
]

Expected result

  1. Only one option value is created
  2. Second call must fail with exception

Actual result

  1. Option values are created more than once.
@veloraven veloraven added 2.1.x bug report Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog labels Jun 29, 2017
@VasylShvorak
Copy link
Contributor

@hilrob Thanks for reporting this issue. Created internal issue MAGETWO-70441 to investigate and track this issue.

@veloraven veloraven added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jul 4, 2017
@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Oct 3, 2017
@magento-engcom-team
Copy link
Contributor

@hilrob, thank you for your report.
We've created internal ticket(s) MAGETWO-70441 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.2.x Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed 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 labels Oct 11, 2017
gomencal added a commit to gomencal/magento2 that referenced this issue Oct 26, 2017
gomencal added a commit to gomencal/magento2 that referenced this issue Oct 26, 2017
gomencal added a commit to gomencal/magento2 that referenced this issue Oct 26, 2017
@gomencal
Copy link
Contributor

Working on that :)

@okorshenko
Copy link
Contributor

Hi @gomencal please, accept the invite

@okorshenko okorshenko self-assigned this Nov 1, 2017
@gomencal
Copy link
Contributor

gomencal commented Nov 1, 2017

Hi! Accepted :)

@okorshenko okorshenko assigned gomencal and unassigned okorshenko Nov 1, 2017
magento-team pushed a commit that referenced this issue Nov 7, 2017
…ribute option values #11786

 - Merge Pull Request #11786 from gomencal/magento2:8846_21
 - Merged commits:
   1. ea7e66c
magento-team pushed a commit that referenced this issue Nov 7, 2017
magento-team pushed a commit that referenced this issue Nov 7, 2017
[EngCom] Public Pull Requests - 2.1-develop
 - MAGETWO-83320: #7903 correct the position of the datepicker when you scroll #12045
 - MAGETWO-83319: [backport 2.1] Magento 2 Store Code validation regex: doesn't support uppercase letters in store code #12040
 - MAGETWO-82948: fix #8846 [Backport 2.1-develop]: avoid duplicated attribute option values #11786
 - MAGETWO-81328: [Fix:5439] Send email to subscribers only when are new 2.1 #11316
magento-team pushed a commit that referenced this issue Nov 7, 2017
…1785

 - Merge Pull Request #11785 from gomencal/magento2:8846_22
 - Merged commits:
   1. ec08353
magento-team pushed a commit that referenced this issue 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
@okorshenko okorshenko added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Nov 7, 2017
@magento-team
Copy link
Contributor

Hi @hilrob. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1286 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

@magento-team magento-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Jan 26, 2018
@robsoned
Copy link

Hi! I can see here that it is fixed at 2.3.x. But should it duplicate as well if I make a PUT request to

V1/products/attributes/{attribute_code}

Where I have the options listened on the request. For example, if I have an attribute with an option that has the label "Option Label" and makes the put request with the following options inside the attribute Json request:

{ "options": [ { "label": "Option Label" } ] }

I get these options inside the attribute.

"options": [ { "label": " ", "value": "" }, { "label": "Option Label", "value": "82" }, { "label": "Option Label", "value": "83" } ],

With the duplicated label.
Is it the right behave?
Should I forget updating the options on the attribute request and instead do it on

/rest/V1/products/attributes/{attribute_code}/options

Thanks a lot!

@oefterdal
Copy link

We experience this bug with version 2.3.5-p1

magento-devops-reposync-svc pushed a commit that referenced this issue Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development 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

No branches or pull requests

9 participants