2

I have created a custom tab on product view page , but i don't know how to call a phtml file into custom tab.

  • Did you get a solution ? – Pawan Sep 2 '18 at 5:31
2

You can use the following code for custom tab. I have created one module with name Vendor_Module and created it like below.

Paste the below content to catalog_product_view.xml file.

<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="product.info.details"> <block class="Magento\Catalog\Block\Product\View" name="test.tab" template="Vendor_Module::custom_tab.phtml" group="detailed_info" > <arguments> <argument translate="true" name="title" xsi:type="string">Your Tab</argument> </arguments> </block> </referenceBlock> </body> </page>
  • thank you for answer! but I want how to call another phtml file in that tab , means in your vendor_module phtml file i want call another phtml file – kim na na Sep 1 '18 at 13:09
  • You can call your own phtml. Like if phtml is under Magento_Catalog/templates then you need to call Magento_Catalog::your_phtml.phtml – Sukumar Gorai Sep 1 '18 at 13:21

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.