1

I'd like to add a custom block in description tab just after long description field.

I Tried

<referenceBlock name="product.info.description">
<block class="Magento\Catalog\Block\Product\View\Description" name="product.subdescription" template="product/view/subdescription.phtml" />
</referenceBlock>

but it did not work.

0

Try to change template name like below: (change Vendor_Module according to your custom module)

<referenceBlock name="product.info.details">
    <block class="Magento\Catalog\Block\Product\View" name="product.subdescription" template="Vendor_Module::product/view/subdescription.phtml" group="detailed_info"/>
</referenceBlock>
  • Tried this, but there's an exception 1 exception(s): Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Magento_Catalog::product/view/subdescription.phtml' in module: 'Magento_Catalog' block's name: 'product.subdescription' – domfitty May 7 at 8:23
  • This is subdescription.phtml content <?php $_helper = $this->helper('Magento\Catalog\Helper\Output'); $_product = $block->getProduct(); ?> <h1>SUBDESCRIZIONE</h1> <?php if ($_product->getData('downloadable')): ?> <div class="product-collateral-itunes" id="downloadable" > <div class="innerdownloadable"><?php echo $_product->getData('downloadable') ?></div> </div> <?php endif; ?> – domfitty May 7 at 8:24
  • @domfitty is your template stored like this app/code/Vendor/Module/view/frontend/templates/product/view/subdescription.phtml ? – fmsthird May 7 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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