Open Nuranto opened 3 years ago
Hi @Nuranto. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
Please, add a comment to assign the issue: @magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
If you want a fast way to confirm issue, you can, on a fresh instance :
INSERT
query above. OR create your own way any media_image
attribute with attribute_code = base_image
(or anything that is not image
/small_image
/thumbnail
), on any entity type but product's one.This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!
Still relevant
Hi @engcom-Golf. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).Details
If the issue has a valid description, the label Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.4-develop
branchDetails
- Add the comment @magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 5. Add label Issue: Confirmed
once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
(Note : Bug still there on 2.4.2)
@Nuranto You are creating a new attribute_code base_image for Customer entity having Input Type as Media Image. As per Magento documentation, Media Image is only associated with Product entity rather Customer. Given below Input Types are available for creating Customer's attribute codes.
Note: As per existing Logic, getMediaAttributeCodes() will show attribute codes having input type as media_image. That's why It is showing newly created Customer's attribute code having Input Type as Media Image.
Also It is not recommended to create custom attribute via Insert query.
@Nuranto You are creating a new attribute_code i.e base_image for Customer entity having Input Type as Media Image. As per Magento documentation, Media Image is only associated with Product entity rather Customer.
Customer was only for error-reproducing purpose. My real goal is to use a media gallery for a custom entity type (Actually, It's already done - and working - on the Magento1 that I want to migrate). However, if someone want to add a media gallery to Customer entity type, I don't see the reason why he couldn't.
I don't understand why a media gallery input type should be hardly linked to product entity type only.
In my understanding, it just needs an additionnal filter on "entity_type_id", to get only attributes from Product entity type.
Note: As per existing Logic, getMediaAttributeCodes() will show attribute codes having input type as media_image. That's why It is showing newly created Customer's attribute code having Input Type as Media Image.
Ok but getMediaAttributeCodes() is a Product method (Magento\Catalog\Model\Product
), so it would make sense to also filter on Product entity type.
Also It is not recommended to create custom attribute via Insert query.
That was only for reproducing the error quickly
@Nuranto As of now, Input type Media Image is only associated with Product entity rather Customer. If you want Customer specific Media Gallery then Please create Customer's Custom Column having Input Type as Image File.
Image File | A field that allows an image to be uploaded to the gallery and associated with the customer attribute.
I don't need an image attribute only, but a media gallery also.
But ok, I will do this differently then..
If someone else struggle with this, here is a patch : https://github.com/magento/magento2/pull/33150 You can use it through composer patch system.
Preconditions (*)
Magento 2.4.1
Steps to reproduce (*)
Add a media attribute for a non-product entity type. The attribute_code should not be an attribute_code used by product (like 'image'. Use 'base_image' for example). For instance, to do the quick test we could do :
Debug the return of method :
Magento\Catalog\Model\Product\Media\Config::getMediaAttributeCodes()
Expected result (*)
The method only returns product media attribute codes. (without 'base_image')
Actual result (*)
The method returns all entity types media attribute codes. (with 'base_image')
Magento\Catalog\Model\Product\Media\Config::getMediaAttributeCodes()
is used in many parts of the code, so I think it will create problems on differents locations. One of them is that you cannot save a product having images anymore :getMediaAttributeCodes
is called byprocessMediaAttributes()
inProduct\Gallery\CreateHandler
which is called on product save - when there is images) => That gives a 500 error (try to call getBackend() on null
). Which makes sense since it tries to load product attribute 'base_image' which don't exist.Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.