2

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.

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

2 Answers 2

0

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); ?>">
0

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 .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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