I want to add new tab in product edit page and for that i have follow this steps :
-
Create di.xml and add below code:
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <virtualType name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Pool"> <arguments> <argument name="modifiers" xsi:type="array"> <item name="modulename" xsi:type="array"> <item name="class" xsi:type="string">Namespace\Modulename\Ui\DataProvider\Product\Modifier\Customtab</item> <item name="sortOrder" xsi:type="number">200</item> </item> </argument> </arguments> </virtualType> <type name="Namespace\Modulename\Ui\DataProvider\Product\Modifier\Customtab"> <arguments> <argument name="formName" xsi:type="string">product_form</argument> <argument name="dataScopeName" xsi:type="string">product_form.product_form</argument> <argument name="dataSourceName" xsi:type="string">product_form.product_form_data_source</argument> </arguments> </type> </config>
-
Now I want to call custom phtml file to render html. How can I call custom phtml file ?
Best Answer
Create product_form.xml file in app/code/VendorName/NameSpace/view/adminhtml/ui_component
Create Demo.php in app/code/VendorName/NameSpace/Block/Adminhtml/Catalog/Product/Tabs
Create demo.phtml file in app/code/VendorName/NameSpace/view/adminhtml/templates