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
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityIn 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
There is no need for coding. Magento provides the feature to add such new sections by default.
You just need to follow below steps:
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.
you can create you own module.
In this module, create a file called view/adminhtml/layout/catalog_product_new.xm
l 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.ph
p 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.
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>