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

Custom category attributes don't show after upgrading to Magento 2.1.0 #5942

Closed
JacobDrummond opened this issue Aug 2, 2016 · 14 comments
Closed
Labels
bug report Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@JacobDrummond
Copy link

Preconditions

  1. PHP 5.6.16
  2. MySQL 5.6.21-log
  3. Magento 2.1.0
  4. Nginx 1.4.6

Steps to reproduce

  1. Install Magento 2.0.2
  2. Create custom category attributes using in an InstallData/UpgradeData class.
  3. Confirm custom attributes show in the category form in Magento 2.0.2
  4. Upgrade to Magento 2.1.0

Expected result

  1. Custom category attributes show in the category admin form, as they did in 2.0.2

Actual result

  1. The custom attributes still appear in the eav_attribute_* tables
  2. However, custom category attributes don't show in the category admin form. Only the Magento attributes show.
@mhauri
Copy link

mhauri commented Aug 4, 2016

Same here.

Creating custom attributes for Products and Categories, only show up for Products but not in Categories. As some imports will create both Product and Category attributes, it will be painful if they aren't visible in the admin backend.

@JacobDrummond
Copy link
Author

JacobDrummond commented Aug 4, 2016

Thank you for confirming, @mhauri.

Did your custom attributes show in admin forms in earlier versions of Magento 2?

@mhauri
Copy link

mhauri commented Aug 4, 2016

@JacobDrummond yes they did, it wasn't a problem in 2.0.7.

@mrkhoa99
Copy link
Contributor

mrkhoa99 commented Aug 4, 2016

@mhauri
Copy link

mhauri commented Aug 4, 2016

@mrkhoa99 saw that to, but this can't be the way to go, how do you handle attributes created by an import. This would mean every time the import creates an attribute I have to update my codebase to make them visible. Also it works fine in Products, so why handle them differently.

For me this is still a bug and not a feature.

@JacobDrummond
Copy link
Author

I agree with @mhauri: the whole point of EAV attributes is they can be determined at runtime.

What is the rationale for using hardcoded UIComponents to build EAV forms?

@JacobDrummond
Copy link
Author

Hi @veloraven,

After reading @mrkhoa99's comment, it appears this bug is intended as a feature.

Two things:

  • This feature breaks mission-critical functionality for those upgrading to Magento 2.1.0
  • It does not appear to be in the 2.1 release notes.

Are release notes intended to be exhaustive? If not, how would you recommend third-party developers become aware of changes like this?

@alankent
Copy link

alankent commented Aug 6, 2016

I am not an expert here, but that has never stopped me responding before! I would expect you should be able to upgrade from 2.0 to 2.1 without stuff disappearing. I don't know the details of why this one was changed. Either something was broken, or if we changed something then the upgrade script should migrate the data. In either case having things disappear from the form "sounds like a bug". But I don't know the details here so I may have to eat my hat.

@JacobDrummond
Copy link
Author

JacobDrummond commented Aug 6, 2016

Hi @alankent,

Adding Category attributes pre-2.1.0

  1. Create category attribute in an UpgradeData file, just like Magento_Catalog does.
  2. New attribute shows in admin forms simply by being present in Magento_Eav's tables.

Adding Category attributes post-2.1.0

  1. Create category attribute in an UpgradeData file, just like Magento_Catalog does.
  2. Register the new attribute in module's XML, by extending category_form.xml.
  3. New category attribute shows in admin forms.

Upgrade problems

  1. Pre 2.1, third-party developers created category attributes the first way. Client's input data, and everyone was happy.
  2. Magento 2.1 introduced category_form.xml, yet it didn't appear to be in the 2.1 release notes. There was no XML-generation script to automatically publish custom EAV definitions to the right XML files in php magento setup:upgrade.
  3. All custom category attributes disappeared from admin forms. Clients complained that they couldn't edit custom attributes anymore.

Architecture problems

  • The whole point of EAV is you can change attribute definitions at run-time, as opposed to write-time.
  • Product admin forms implement EAV perfectly. When you alter a product attribute definitions, the changes propagate immediately.
  • By contrast, category attributes must be hard-coded in category_form.xml. This goes against EAV's ethos.
  • Many people have complained about this architectural decision. For example, here and Magento CE 2.1 Not able to add attribute to category #5438.

As VP of Architecture, what do you think Magento's EAV strategy should be?

@andimov andimov removed the PROD label Aug 8, 2016
@tanberry
Copy link

tanberry commented Aug 10, 2016

Hi @mhauri et all. The Magento DevDocs team can look into what info we can add to the docs around attributes and UI Components and elsewhere for handling some of these specific questions. @JacobDrummond , the write-up you have immediately above this comment is a helpful guide to what we missed explaining in docs, thanks for that.

I'm sorry that this change from 2.0.x was reflected in the 2.1 Rel Notes, nor in the Backward Incompatible Changes doc.

Great question, @JacobDrummond about how the community should be told of such changes. This one should have been in the Rel Notes and the Backwards Incompatible Changes document. It is quite likely reflected in the changelog.md file (I haven't yet looked). But maybe there are other ways? Let us know your thoughts, please?

@JacobDrummond
Copy link
Author

@tanberry,

Magento 2.1.1 has been released. There is no accompanying "Backwards Incompatible Changes" document. Is this a documentation gap, or are there truly no backwards incompatibilities?

@tanberry
Copy link

tanberry commented Sep 4, 2016

Hi @JacobDrummond, we are fixing a break in our bamboo builds that stopped the auto-generation of docs covering our backwards incompatible changes... currently they are not published for 2.1.x. ;-( The fix should be ready next week! Along with our recent realization that even patch releases need a "Highlights" section, we will look at how to call out important backwards incompatible changes in patches, ad not just rely on the auto-generated docs.

@magento-engcom-team magento-engcom-team added bug report DOC Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Sep 11, 2017
@ishakhsuvarov
Copy link
Contributor

@JacobDrummond Looks like a solution has been found for the issue a long time ago and this ticket is not active anymore.
I'm closing this report now.

Thank you for collaboration.

@JacobDrummond
Copy link
Author

@ishakhsuvarov,

Looks like a solution has been found

category_form.xml is not a good solution, given that attributes are configurable at run-time (not just write-time).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests

9 participants