magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.53k stars 9.31k forks source link

[Issue] set image rolls only if is_required is true #38695

Open in-session opened 5 months ago

in-session commented 5 months ago

Preconditions and environment

Especially when managing many product images with different functions, it often happens that the wrong image roles are used when creating products. Here the field is_required should be used to control which roles are necessary by default. An image role does not mean that it has to be filled, as long as it is not an is_required.

Magento version 2.4.6-p5

Steps to reproduce

  1. create a new product attributes media/images
  2. then create a new article and upload the image

Expected result

all roles are assigned to the first picture

Actual result

only necessary roles should be assigned to the first image

Additional information

No response

Release note

No response

Triage and priority

https://github.com/magento/magento2/assets/16542619/acfc304e-71f2-4351-a98f-7c54347f257a

Productt attribute media / image should be available is_required to automatically assign the image role when creating a product:

image

m2-assistant[bot] commented 5 months ago

Hi @in-session. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

in-session commented 5 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 5 months ago

Hi @in-session. Thank you for your request. I'm working on Magento instance for you.

m2-assistant[bot] commented 5 months ago

Hi @engcom-Bravo. 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:

magento-deployment-service[bot] commented 5 months ago

Hi @in-session, here is your Magento Instance: https://d92b638996c3eec19ceb974d4b9b09d9.instances-prod.magento-community.engineering Admin access: https://d92b638996c3eec19ceb974d4b9b09d9.instances-prod.magento-community.engineering/admin_cf94 Login: 4fad2615 Password: ea9f59be9111

engcom-Bravo commented 5 months ago

Hi @in-session,

Thanks for your reporting and collaboration.

We have checked the issue in Latest 2.4-develop instance we are not able to see the Values Required option for the Media image attribute type.

Screenshot 2024-05-03 at 12 32 07 Screenshot 2024-05-03 at 12 31 10

As per the Magento dedocs https://docs.magento.com/user-guide/v2.3/stores/attributes-input-types.html when we create media image type attribute it becomes an additional image type, along with Base, Small, and Thumbnail.

Could you please let us know if we are missing anything.

Thanks.

in-session commented 5 months ago

@engcom-Bravo That's not quite what I mean, even if I can exclude it from the product gallery. Is the newly created role always automatically assigned to the first image:

Wrong: image

So the field is_required yes/no should be used to determine whether the image role should be assigned automatically. Or a new field in which you can say which role should automatically be assigned to the first image. image

Because all roles are always set to the first image, the images would be all over the place and that is not effective:

$product->getResource()->getAttribute('key_point_1')->getFrontend()->getValue($product);
$product->getResource()->getAttribute('key_point_2')->getFrontend()->getValue($product);
$product->getResource()->getAttribute('key_point_3')->getFrontend()->getValue($product);
engcom-Bravo commented 5 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 5 months ago

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 5 months ago

Hi @engcom-Bravo, here is your Magento Instance: https://d92b638996c3eec19ceb974d4b9b09d9.instances-prod.magento-community.engineering Admin access: https://d92b638996c3eec19ceb974d4b9b09d9.instances-prod.magento-community.engineering/admin_4b84 Login: 01c693e7 Password: bfbaf2b5bcf5

in-session commented 5 months ago

This only makes sense if they are necessary fields, an image role should be set by default when you assign it to the image role. https://docs.magento.com/user-guide/v2.3/catalog/product-image-upload.html#assign-roles

image

engcom-Bravo commented 5 months ago

Hi @in-session,

Thanks for your update.

For the Media image type attribute there will be no is_required field hence we are not able to set whether it is required or not As per the Magento devdocs when we create Media image type attribute it will be an additional image type and it is an expected behaviour.is_required field is required for image attribute.

Hence to proceed further we are marking this as a feature request.

Thanks.