Skip to content

M2.1.1 : Re-saving a product attribute with a different name than it's code results in an error #6770

Closed
@kanduvisla

Description

@kanduvisla

Preconditions

  1. Magento 2.1.1
  2. I have product attribute of the type 'dropdown', which name is 'Afmetingen uitwendig (BxDxH) in mm' and it's code is 'afmetingen_uitwendig'.

Steps to reproduce

  1. Add a couple of options
  2. Save the attribute
  3. Add a couple of options more
  4. Re-save the attribute

Expected result

  1. Options should be added
  2. No errors should be shown

Actual result

Upon re-saving, Magento tries to re-create the attribute code:

screen shot 2016-09-27 at 15 33 34

As you can see, it seems that the existing attribute code is ignored. Further inspection of the form confirms this:

screen shot 2016-09-27 at 15 34 19

screen shot 2016-09-27 at 15 34 27

The problem here is obvious: setting the form to disabled="disabled" disables the form value from submitting. You can check this in the form data send in the request. The field attribute_code is missing here, thus Magento will generate a new attribute code.

The solution in my opinion is to change disabled="disabled" to readonly="readonly". This makes sure the field isn't editable, but it's value is still submitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CatalogFixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions