I have created Product image attribute in Backend in Magento2.2.5.

Refer my screenshot

enter image description here

But I am not able to see in Product detail page in Admin side.

Is there any other way to do this or I am missing something.

Any help would be appreciated.

  • Have you assigned the attribute to the attribute set ? – Ylgen Guxholli Feb 22 '19 at 13:53
  • I have assigned. But not showing in Product page.. – Amy Feb 22 '19 at 13:56
  • Did you run reindex ? – Ylgen Guxholli Feb 22 '19 at 13:59
  • Yup I have done everything..But it's not reflecting in Product page. – Amy Feb 22 '19 at 14:01
  • can you update in the question the install script ? – Ylgen Guxholli Feb 22 '19 at 14:02

For example you have created custom image attribute.

attribute code is test_img.

attribute label is Test Image.

You can upload the image in "Images And Videos" tab. Then click on the image you will see new role "Test Image" select only that. And check "Hide from Product Page".

And then if you want to display it on product page. Just to test I have placed this code in core file addtocart.pthml after this line <?php $_product = $block->getProduct(); ?>

<img src="<?php echo $block->getBaseUrl().'pub/media/catalog/product'.$_product->getResource()->getAttribute('test_img')->getFrontend()->getValue($_product); ?>">
| improve this answer | |

Now i got it , creating an attribute as Media Image , does create it as a role . You will see it when you click Add Video enter image description here when editing a product in admin https://d.pr/free/i/KRUV0J .

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.