From aee4431d38b8e66c3fe7f60accc4acce2742c392 Mon Sep 17 00:00:00 2001 From: NazarKlovanych Date: Mon, 5 Nov 2018 18:39:01 +0200 Subject: [PATCH] Fix issue - Image custom attribute type could not display on frontend. --- app/code/Magento/Eav/Model/Entity/Attribute.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php index c605f3ce17e30..998a2d208c4e7 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute.php @@ -295,6 +295,12 @@ public function beforeSave() } } + if ($this->getFrontendInput() == 'media_image') { + if (!$this->getFrontendModel()) { + $this->setFrontendModel(\Magento\Catalog\Model\Product\Attribute\Frontend\Image::class); + } + } + if ($this->getBackendType() == 'gallery') { if (!$this->getBackendModel()) { $this->setBackendModel(\Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend::class);