0

enter image description here

In the above image, I want to add a section like content, configuration, product reviews etc. How can i do it?

And I also want to add my custom drop drop attribute inside the section

3

There is no need for coding. Magento provides the feature to add such new sections by default.

You just need to follow below steps:

  • Login to admin panel and go to Stores -> Attributes (Attribute Set).
  • Click on the attribute set in which you want to add the section.
  • Under Groups, click on Add New button. A new popup window will open. Fill the group name and click on OK button.

Click on Add New button Popup

This will add the section.

Now, to change the position of the newly added section, you can drag and drop up and down and put it to the desired location.

To add attributes under this section, simply drag the attribute under the section.

Please let me know if it worked for you.

| improve this answer | |
  • Yes you are right. No need to write hassle code. Thank you – Avesh Naik Jun 21 '18 at 10:15
0

you can create you own module.

In this module, create a file called view/adminhtml/layout/catalog_product_new.xml with this content

<?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_form">
            <block class="Vendor\Module\Block\Adminhtml\Product\Edit\Tab\Welcome" name="product.welcome" as="custom-tab" >
                <arguments>
                    <argument name="config" xsi:type="array">
                        <item name="label" xsi:type="string" translate="true">Product Welcome</item>
                        <item name="collapsible" xsi:type="boolean">true</item>
                        <item name="opened" xsi:type="boolean">true</item>
                        <item name="sortOrder" xsi:type="string">2</item>
                        <item name="canShow" xsi:type="boolean">true</item>
                        <item name="componentType" xsi:type="string">fieldset</item>
                    </argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
    </page>

In block Vendor/Module/Block/Adminhtml/Product/Edit/Tab/Welcome.php put below code.

<?php

namespace Vendor\Module\Block\Adminhtml\Product\Edit\Tab;
use Magento\Backend\Block\Template\Context;
use Magento\Framework\Registry;

class Welcome extends \Magento\Framework\View\Element\Template
{
    protected $_template = 'catalog/product/edit/welcome.phtml';

    protected $_coreRegistry = null;

    public function __construct(
        Context $context,
        Registry $registry,
        array $data = []
    )
    {
        $this->_coreRegistry = $registry;
        parent::__construct($context, $data);
    }

    public function getProduct()
    {
        return $this->_coreRegistry->registry('current_product');
    }
}

In templates Vendor/Module/view/adminhtml/templates/catalog/product/edit/welcome.phtml put below code.

<div class="welcome">
    <?php echo __('Welcome !'); ?>
</div>

Now Check Product edit page. It's working perfect.

| improve this answer | |
  • No it's not working – Avesh Naik Jun 21 '18 at 9:25
0

create uicomponent form xml Vendor/Module/view/adminhtml/ui_component/product_form.xml put below code. For 2.2.0 and above it's in UI component.

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="testingproduct">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string" translate="true">Testing Group</item>
            <item name="provider" xsi:type="string">product</item>
            <item name="dataScope" xsi:type="string">data.product</item>
            <item name="sortOrder" xsi:type="number">2</item>
            <item name="collapsible" xsi:type="boolean">true</item>
            <item name="opened" xsi:type="boolean">false</item>
            <item name="ns" xsi:type="string">product_form</item>
        </item>
    </argument>
    <container name="testing_group">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="sortOrder" xsi:type="number">1</item>
            </item>
        </argument>
        <htmlContent name="html_content">
            <argument name="block" xsi:type="object">Vendor\Module\Block\Adminhtml\Product\Edit\Tab\CustomData</argument>
        </htmlContent>
    </container>
</fieldset>

| improve this answer | |

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.