custom text area wysiwyg attribute product in magento2

by Yogita   Last Updated June 21, 2018 08:09 AM

When I am getting the value of text area type attribute WYSIWYG enabled will not show images or media content in phtml.

I am using below code in my theme's product's addtocart.phtml file:

<?php
$_product = $block->getProduct();
$demoStore = $_product->getResource()-getAttribute('extension_demo_details')->getFrontend()->getValue($_product);
$attr_label_for_demo =$_product->getResource()->getAttribute('extension_demo_details')->getStoreLabel();
?>

<p><?php echo $demoStore; ?></p>

//Will not show media related data



Answers 1


Please try like this one:

<?php
$_product = $block->getProduct();
$demoStore = $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getExtensionDemoDetails(), 'extension_demo_details');
?>

<p><?php echo $demoStore; ?></p>
Mohit Kumar Arora
Mohit Kumar Arora
June 21, 2018 08:03 AM

Related Questions






Check if attribute equals specific value

Updated March 29, 2017 11:09 AM