Media image attribute bugged in frontend

by Wales   Last Updated January 12, 2018 15:09 PM

Reposting my question from another forum: I want to add a picture as attribute on product and category page but encountered a problem.

Using Media Image custom attribute type I could not display it on frontend and backend.

After that I use Google and found that the storefront properties in Media Image attribute is bugged and hidden.

Made them visisble, set the image for attribute using aaaand i got the end of image link as text in attribute field in frontend (Image 1)

also i use my code

$attributeName = $_product->getResource()->getAttribute('color_unc'); if ($attributeName) { $labelValue = $attributeName->getFrontend()->getValue($_product); $labelName = $attributeName->getFrontend()->getLabel($_product); }

echo $labelName; echo ' ';echo $labelValue;

in category phtml file and expectedly received the same text (Image 2)

Maybe anyone know how to fix this and get the image instead of text? I will say right away: i want use this for configurable product which have only one color (i can't use swathes for obvious reasons)

Related Questions

Magento 2 pub/media/catalog folder size too big

Updated May 22, 2017 09:09 AM

Sql query for select all medias in magento 2

Updated September 08, 2018 08:09 AM

Magento 1.9 homepage image all missing

Updated April 29, 2017 11:09 AM