0

I am using Magento 2.2.4. I need to add a block for product detail outside from the main 'Details', 'Review' tabs. I need this block to be separated after the main description of the product. I have started doing this with a custom theme but no idea how to do this. I need to add something like a blog post end of the description of the product with images. How can I do this?

1 Answer 1

0

In your custom module you can add catalog_product_view.xml

app/code/[Vendor]/[Module]/view/frontend/layout/catalog_product_view.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="content"> <block class="[Vendor]/[Module]\Block\Product\View\Faq" name="product.info.faq" template="Vendor_Module::product/faq.phtml" after="product.info.details"> <arguments><argument translate="true" name="title" xsi:type="string">FAQ</argument></arguments> </block> </referenceContainer> </body> </page> 

Than write your custom template.

app/code[Vendor]/[Module]/view/frontend/templates/product/faq.phtml

<?php echo $block->getProduct(); ?> 

I hope this answer helps you. If you found it useful please accept it.

2
  • I have added a custom theme extended from luma. But I have no idea of what really to use whether a module or theme or both. Can you please tell me? Commented Jul 6, 2018 at 7:53
  • You can use any one of them. If you have created a custom module you can use it else in your custom theme you can also place files in layout and template folders. Commented Jul 6, 2018 at 8:24

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.