0

I have tried to upload image in block using wysiwyg editor.

1.click the Insert/Edit image
2.choose a image
3.save

but image not showing in preview.

1 Answer 1

0

for Custom Product text type Attribute: Inject Magento\Catalog\Helper\Output class in you Block Class.

use Magento\Catalog\Helper\Output as ProductAttribute;
class Planlist extends DataObject
{
/**
 * @var ProductAttribute 
 */
private $_productAttribute;
public function __construct(
...
ProductAttribute $productAttribute,
...
) {
...
$this->_productAttribute = $productAttribute;
...
}

/**
     * Prepare product attribute html output
     *
     * @param ModelProduct $product
     * @param string $attributeHtml
     * @param string $attributeName
     * @return string
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     */
    public function getAdditionalData($product, $attributeHtml, $attributeName)
    {
        return $this->_productAttribute->productAttribute($product, $attributeHtml, $attributeName);
    }
}

Call this Function where the need

$this->getAdditionalData($item,$item->getData('service_packages'),'service_packages'),

Your Answer

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

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