I have created a custom tab on product view page , but i don't know how to call a phtml file into custom tab.
1 Answer
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 Commented Sep 1, 2018 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 Commented Sep 1, 2018 at 13:21