Magento2 How to add a “Dynamic Rows” in to the Product Insert areaMagento2 How to add row pattern/dynamic rows to the custom product attributeMagento: insert new productHow to add Dynamic Rows Component to my custom module?How to add custom Js code in a “dynamic-rows” component?Hide dynamic-rows column via jsMagento 2 - How to add dynamic-rows grid on catalog productMagento2 How to add row pattern/dynamic rows to the custom product attributeDynamic Rows can not delete in edit form in admin magento 2load data into dynamic rows from database on edit actionMagento 2 Backend Product Insertion area customizationM2 | How to set limit of dynamic rows?
Alternatives to Overleaf
Is thermodynamics only applicable to systems in equilibrium?
French for 'It must be my imagination'?
Binary Numbers Magic Trick
Does this extra sentence in the description of the warlock's Eyes of the Rune Keeper eldritch invocation appear in any official reference?
Providence Pentominoes Puzzle By Andrew Bradburn (Jigsaw)
What is the most expensive material in the world that could be used to create Pun-Pun's lute?
US visa is under administrative processing, I need the passport back ASAP
How to pronounce 'C++' in Spanish
Question relating to a number theoretic function
Why is current rating for multicore cable lower than single core with the same cross section?
Stop and Take a Breath!
Short story about a planet with two sentient species
Trainer for recumbent bikes
Packing rectangles: Does rotation ever help?
Pulling the rope with one hand is as heavy as with two hands?
function to receive a character input and return date format (with incorrect input)
Is there any limitation with Arduino Nano serial communication distance?
Are Boeing 737-800’s grounded?
How to verbalise code in Mathematica?
Can solid acids and bases have pH values? If not, how are they classified as acids or bases?
Error message with tabularx
Will tsunami waves travel forever if there was no land?
Any examples of headwear for races with animal ears?
Magento2 How to add a “Dynamic Rows” in to the Product Insert area
Magento2 How to add row pattern/dynamic rows to the custom product attributeMagento: insert new productHow to add Dynamic Rows Component to my custom module?How to add custom Js code in a “dynamic-rows” component?Hide dynamic-rows column via jsMagento 2 - How to add dynamic-rows grid on catalog productMagento2 How to add row pattern/dynamic rows to the custom product attributeDynamic Rows can not delete in edit form in admin magento 2load data into dynamic rows from database on edit actionMagento 2 Backend Product Insertion area customizationM2 | How to set limit of dynamic rows?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to add dynamic rows with a dropdown field.how to add into the catalog product insert area thanks in a advance.
magento2 products
|
show 1 more comment
I want to add dynamic rows with a dropdown field.how to add into the catalog product insert area thanks in a advance.
magento2 products
what you want ? your question is not clear. from where you want to add these rows? and where you want to show them ? give complete information.
– Hassan Ali Shahzad
Sep 30 '18 at 19:50
Hello@HassanAliShahzad I want this fields into the backend catalog -> product new section
– Hardik Makwana
Oct 1 '18 at 5:06
You mean you want one drop-down in Admin section. Can you let me know the Label and values you want to add for this section? Also Is this field required ?
– Hassan Ali Shahzad
Oct 1 '18 at 5:15
Hurry up man .....
– Hassan Ali Shahzad
Oct 1 '18 at 5:21
Please see question,.i want this dynamic rows component
– Hardik Makwana
Oct 1 '18 at 6:45
|
show 1 more comment
I want to add dynamic rows with a dropdown field.how to add into the catalog product insert area thanks in a advance.
magento2 products
I want to add dynamic rows with a dropdown field.how to add into the catalog product insert area thanks in a advance.
magento2 products
magento2 products
edited Oct 28 '18 at 13:58
sv3n
10.1k62557
10.1k62557
asked Sep 29 '18 at 8:59
Hardik MakwanaHardik Makwana
15111
15111
what you want ? your question is not clear. from where you want to add these rows? and where you want to show them ? give complete information.
– Hassan Ali Shahzad
Sep 30 '18 at 19:50
Hello@HassanAliShahzad I want this fields into the backend catalog -> product new section
– Hardik Makwana
Oct 1 '18 at 5:06
You mean you want one drop-down in Admin section. Can you let me know the Label and values you want to add for this section? Also Is this field required ?
– Hassan Ali Shahzad
Oct 1 '18 at 5:15
Hurry up man .....
– Hassan Ali Shahzad
Oct 1 '18 at 5:21
Please see question,.i want this dynamic rows component
– Hardik Makwana
Oct 1 '18 at 6:45
|
show 1 more comment
what you want ? your question is not clear. from where you want to add these rows? and where you want to show them ? give complete information.
– Hassan Ali Shahzad
Sep 30 '18 at 19:50
Hello@HassanAliShahzad I want this fields into the backend catalog -> product new section
– Hardik Makwana
Oct 1 '18 at 5:06
You mean you want one drop-down in Admin section. Can you let me know the Label and values you want to add for this section? Also Is this field required ?
– Hassan Ali Shahzad
Oct 1 '18 at 5:15
Hurry up man .....
– Hassan Ali Shahzad
Oct 1 '18 at 5:21
Please see question,.i want this dynamic rows component
– Hardik Makwana
Oct 1 '18 at 6:45
what you want ? your question is not clear. from where you want to add these rows? and where you want to show them ? give complete information.
– Hassan Ali Shahzad
Sep 30 '18 at 19:50
what you want ? your question is not clear. from where you want to add these rows? and where you want to show them ? give complete information.
– Hassan Ali Shahzad
Sep 30 '18 at 19:50
Hello@HassanAliShahzad I want this fields into the backend catalog -> product new section
– Hardik Makwana
Oct 1 '18 at 5:06
Hello@HassanAliShahzad I want this fields into the backend catalog -> product new section
– Hardik Makwana
Oct 1 '18 at 5:06
You mean you want one drop-down in Admin section. Can you let me know the Label and values you want to add for this section? Also Is this field required ?
– Hassan Ali Shahzad
Oct 1 '18 at 5:15
You mean you want one drop-down in Admin section. Can you let me know the Label and values you want to add for this section? Also Is this field required ?
– Hassan Ali Shahzad
Oct 1 '18 at 5:15
Hurry up man .....
– Hassan Ali Shahzad
Oct 1 '18 at 5:21
Hurry up man .....
– Hassan Ali Shahzad
Oct 1 '18 at 5:21
Please see question,.i want this dynamic rows component
– Hardik Makwana
Oct 1 '18 at 6:45
Please see question,.i want this dynamic rows component
– Hardik Makwana
Oct 1 '18 at 6:45
|
show 1 more comment
2 Answers
2
active
oldest
votes
You had not provided any information for the fields So i had taken supposed values:
You need to create one Module which will add product attributes for you, for current requirement and can be updated for future requirements:
Create directories as followings:
registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Progos_CustomProductAttributes',
__DIR__
);
etc/module.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Progos_CustomProductAttributes" setup_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>
Setup/InstallData.php
<?php
namespace ProgosCustomProductAttributesSetup;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
/**
* Constructor
*
* @param MagentoEavSetupEavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* @inheritdoc
*/
public function install(
ModuleDataSetupInterface $setup,
ModuleContextInterface $context
)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'test_custom_attr',
[
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Custom Label',
'input' => 'select',
'class' => '',
'source' => ,
'global' => 1,
'visible' => true,
'required' => true,
'user_defined' => true,
'default' => null,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => false,
'unique' => false,
'apply_to' => '',
'system' => 1,
'group' => 'General',
'option' => array('values' => array("Nike","Puma","Adidas"))
]
);
Please see question,.i want this dynamic rows component.
– Hardik Makwana
Oct 1 '18 at 6:46
I already avare with how to add a attribute programmatically
– Hardik Makwana
Oct 1 '18 at 6:47
@HardikMakwana If you have added dynamic rows in product edit form please tell us how to do this
– Ajwad Taqvi
4 hours ago
add a comment |
Here is how dynamic rows can be added by DataProvider.
Add DataProvider class as:
etcadminhtmldi.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="customTab" xsi:type="array">
<item name="class" xsi:type="string">VendorModuleUiDataProviderProductFormModifierNewField</item>
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
</arguments>
</virtualType>
And add DataProvider at:
VendorModuleUiDataProviderProductFormModifier:
namespace VendorModuleUiDataProviderProductFormModifier;
use MagentoCatalogModelLocatorLocatorInterface;
use MagentoCatalogUiDataProviderProductFormModifierAbstractModifier;
use MagentoUiComponentFormFieldset;
use MagentoUiComponentFormField;
use MagentoUiComponentFormElementInput;
use MagentoUiComponentDynamicRows;
use MagentoUiComponentContainer;
use MagentoUiComponentFormElementActionDelete;
use MagentoUiComponentFormElementSelect;
use MagentoUiComponentFormElementDataTypeText;
class NewField extends AbstractModifier
const FIELD_IS_DELETE = 'is_delete';
const FIELD_SORT_ORDER_NAME = 'sort_order';
const FIELD_NAME_SELECT = 'select_field';
private $locator;
public function __construct(
LocatorInterface $locator
)
$this->locator = $locator;
public function modifyData(array $data)
return $data;
public function modifyMeta(array $meta)
$meta = array_replace_recursive(
$meta,
[
'custom_fieldset' => [
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Group'),
'componentType' => Fieldset::NAME,
'dataScope' => 'data.product.custom_fieldset',
'collapsible' => true,
'sortOrder' => 5,
],
],
],
'children' => [
"custom_field" => $this->getSelectTypeGridConfig(10)
],
]
]
);
return $meta;
protected function getSelectTypeGridConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'addButtonLabel' => __('Add Value'),
'componentType' => DynamicRows::NAME,
'component' => 'Magento_Ui/js/dynamic-rows/dynamic-rows',
'additionalClasses' => 'admin__field-wide',
'deleteProperty' => static::FIELD_IS_DELETE,
'deleteValue' => '1',
'renderDefaultRecord' => false,
'sortOrder' => $sortOrder,
],
],
],
'children' => [
'record' => [
'arguments' => [
'data' => [
'config' => [
'componentType' => Container::NAME,
'component' => 'Magento_Ui/js/dynamic-rows/record',
'positionProvider' => static::FIELD_SORT_ORDER_NAME,
'isTemplate' => true,
'is_collection' => true,
],
],
],
'children' => [
static::FIELD_NAME_SELECT => $this->getSelectFieldConfig(1),
static::FIELD_IS_DELETE => $this->getIsDeleteFieldConfig(3)
//Add as many fields as you want
]
]
]
];
protected function getSelectFieldConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'label' => __('Options Select'),
'componentType' => Field::NAME,
'formElement' => Select::NAME,
'component' => 'Magento_Catalog/js/custom-options-type',
'elementTmpl' => 'ui/grid/filters/elements/ui-select',
// 'selectType' => 'optgroup',
'dataScope' => static::FIELD_NAME_SELECT,
'dataType' => Text::NAME,
'sortOrder' => $sortOrder,
'options' => $this->_getOptions(),
'visible' => true,
'disabled' => false,
],
],
],
];
protected function _getOptions()
$options = [
1 => [
'label' => __('Option 1'),
'value' => 1
],
2 => [
'label' => __('Option 2'),
'value' => 2
],
3 => [
'label' => __('Option 3'),
'value' => 3
],
];
return $options;
protected function getIsDeleteFieldConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'componentType' => ActionDelete::NAME,
'fit' => true,
'sortOrder' => $sortOrder
],
],
],
];
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f244397%2fmagento2-how-to-add-a-dynamic-rows-in-to-the-product-insert-area%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You had not provided any information for the fields So i had taken supposed values:
You need to create one Module which will add product attributes for you, for current requirement and can be updated for future requirements:
Create directories as followings:
registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Progos_CustomProductAttributes',
__DIR__
);
etc/module.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Progos_CustomProductAttributes" setup_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>
Setup/InstallData.php
<?php
namespace ProgosCustomProductAttributesSetup;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
/**
* Constructor
*
* @param MagentoEavSetupEavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* @inheritdoc
*/
public function install(
ModuleDataSetupInterface $setup,
ModuleContextInterface $context
)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'test_custom_attr',
[
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Custom Label',
'input' => 'select',
'class' => '',
'source' => ,
'global' => 1,
'visible' => true,
'required' => true,
'user_defined' => true,
'default' => null,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => false,
'unique' => false,
'apply_to' => '',
'system' => 1,
'group' => 'General',
'option' => array('values' => array("Nike","Puma","Adidas"))
]
);
Please see question,.i want this dynamic rows component.
– Hardik Makwana
Oct 1 '18 at 6:46
I already avare with how to add a attribute programmatically
– Hardik Makwana
Oct 1 '18 at 6:47
@HardikMakwana If you have added dynamic rows in product edit form please tell us how to do this
– Ajwad Taqvi
4 hours ago
add a comment |
You had not provided any information for the fields So i had taken supposed values:
You need to create one Module which will add product attributes for you, for current requirement and can be updated for future requirements:
Create directories as followings:
registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Progos_CustomProductAttributes',
__DIR__
);
etc/module.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Progos_CustomProductAttributes" setup_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>
Setup/InstallData.php
<?php
namespace ProgosCustomProductAttributesSetup;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
/**
* Constructor
*
* @param MagentoEavSetupEavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* @inheritdoc
*/
public function install(
ModuleDataSetupInterface $setup,
ModuleContextInterface $context
)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'test_custom_attr',
[
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Custom Label',
'input' => 'select',
'class' => '',
'source' => ,
'global' => 1,
'visible' => true,
'required' => true,
'user_defined' => true,
'default' => null,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => false,
'unique' => false,
'apply_to' => '',
'system' => 1,
'group' => 'General',
'option' => array('values' => array("Nike","Puma","Adidas"))
]
);
Please see question,.i want this dynamic rows component.
– Hardik Makwana
Oct 1 '18 at 6:46
I already avare with how to add a attribute programmatically
– Hardik Makwana
Oct 1 '18 at 6:47
@HardikMakwana If you have added dynamic rows in product edit form please tell us how to do this
– Ajwad Taqvi
4 hours ago
add a comment |
You had not provided any information for the fields So i had taken supposed values:
You need to create one Module which will add product attributes for you, for current requirement and can be updated for future requirements:
Create directories as followings:
registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Progos_CustomProductAttributes',
__DIR__
);
etc/module.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Progos_CustomProductAttributes" setup_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>
Setup/InstallData.php
<?php
namespace ProgosCustomProductAttributesSetup;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
/**
* Constructor
*
* @param MagentoEavSetupEavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* @inheritdoc
*/
public function install(
ModuleDataSetupInterface $setup,
ModuleContextInterface $context
)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'test_custom_attr',
[
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Custom Label',
'input' => 'select',
'class' => '',
'source' => ,
'global' => 1,
'visible' => true,
'required' => true,
'user_defined' => true,
'default' => null,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => false,
'unique' => false,
'apply_to' => '',
'system' => 1,
'group' => 'General',
'option' => array('values' => array("Nike","Puma","Adidas"))
]
);
You had not provided any information for the fields So i had taken supposed values:
You need to create one Module which will add product attributes for you, for current requirement and can be updated for future requirements:
Create directories as followings:
registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Progos_CustomProductAttributes',
__DIR__
);
etc/module.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Progos_CustomProductAttributes" setup_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>
Setup/InstallData.php
<?php
namespace ProgosCustomProductAttributesSetup;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
/**
* Constructor
*
* @param MagentoEavSetupEavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* @inheritdoc
*/
public function install(
ModuleDataSetupInterface $setup,
ModuleContextInterface $context
)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'test_custom_attr',
[
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Custom Label',
'input' => 'select',
'class' => '',
'source' => ,
'global' => 1,
'visible' => true,
'required' => true,
'user_defined' => true,
'default' => null,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => false,
'unique' => false,
'apply_to' => '',
'system' => 1,
'group' => 'General',
'option' => array('values' => array("Nike","Puma","Adidas"))
]
);
answered Oct 1 '18 at 5:38
Hassan Ali ShahzadHassan Ali Shahzad
754317
754317
Please see question,.i want this dynamic rows component.
– Hardik Makwana
Oct 1 '18 at 6:46
I already avare with how to add a attribute programmatically
– Hardik Makwana
Oct 1 '18 at 6:47
@HardikMakwana If you have added dynamic rows in product edit form please tell us how to do this
– Ajwad Taqvi
4 hours ago
add a comment |
Please see question,.i want this dynamic rows component.
– Hardik Makwana
Oct 1 '18 at 6:46
I already avare with how to add a attribute programmatically
– Hardik Makwana
Oct 1 '18 at 6:47
@HardikMakwana If you have added dynamic rows in product edit form please tell us how to do this
– Ajwad Taqvi
4 hours ago
Please see question,.i want this dynamic rows component.
– Hardik Makwana
Oct 1 '18 at 6:46
Please see question,.i want this dynamic rows component.
– Hardik Makwana
Oct 1 '18 at 6:46
I already avare with how to add a attribute programmatically
– Hardik Makwana
Oct 1 '18 at 6:47
I already avare with how to add a attribute programmatically
– Hardik Makwana
Oct 1 '18 at 6:47
@HardikMakwana If you have added dynamic rows in product edit form please tell us how to do this
– Ajwad Taqvi
4 hours ago
@HardikMakwana If you have added dynamic rows in product edit form please tell us how to do this
– Ajwad Taqvi
4 hours ago
add a comment |
Here is how dynamic rows can be added by DataProvider.
Add DataProvider class as:
etcadminhtmldi.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="customTab" xsi:type="array">
<item name="class" xsi:type="string">VendorModuleUiDataProviderProductFormModifierNewField</item>
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
</arguments>
</virtualType>
And add DataProvider at:
VendorModuleUiDataProviderProductFormModifier:
namespace VendorModuleUiDataProviderProductFormModifier;
use MagentoCatalogModelLocatorLocatorInterface;
use MagentoCatalogUiDataProviderProductFormModifierAbstractModifier;
use MagentoUiComponentFormFieldset;
use MagentoUiComponentFormField;
use MagentoUiComponentFormElementInput;
use MagentoUiComponentDynamicRows;
use MagentoUiComponentContainer;
use MagentoUiComponentFormElementActionDelete;
use MagentoUiComponentFormElementSelect;
use MagentoUiComponentFormElementDataTypeText;
class NewField extends AbstractModifier
const FIELD_IS_DELETE = 'is_delete';
const FIELD_SORT_ORDER_NAME = 'sort_order';
const FIELD_NAME_SELECT = 'select_field';
private $locator;
public function __construct(
LocatorInterface $locator
)
$this->locator = $locator;
public function modifyData(array $data)
return $data;
public function modifyMeta(array $meta)
$meta = array_replace_recursive(
$meta,
[
'custom_fieldset' => [
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Group'),
'componentType' => Fieldset::NAME,
'dataScope' => 'data.product.custom_fieldset',
'collapsible' => true,
'sortOrder' => 5,
],
],
],
'children' => [
"custom_field" => $this->getSelectTypeGridConfig(10)
],
]
]
);
return $meta;
protected function getSelectTypeGridConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'addButtonLabel' => __('Add Value'),
'componentType' => DynamicRows::NAME,
'component' => 'Magento_Ui/js/dynamic-rows/dynamic-rows',
'additionalClasses' => 'admin__field-wide',
'deleteProperty' => static::FIELD_IS_DELETE,
'deleteValue' => '1',
'renderDefaultRecord' => false,
'sortOrder' => $sortOrder,
],
],
],
'children' => [
'record' => [
'arguments' => [
'data' => [
'config' => [
'componentType' => Container::NAME,
'component' => 'Magento_Ui/js/dynamic-rows/record',
'positionProvider' => static::FIELD_SORT_ORDER_NAME,
'isTemplate' => true,
'is_collection' => true,
],
],
],
'children' => [
static::FIELD_NAME_SELECT => $this->getSelectFieldConfig(1),
static::FIELD_IS_DELETE => $this->getIsDeleteFieldConfig(3)
//Add as many fields as you want
]
]
]
];
protected function getSelectFieldConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'label' => __('Options Select'),
'componentType' => Field::NAME,
'formElement' => Select::NAME,
'component' => 'Magento_Catalog/js/custom-options-type',
'elementTmpl' => 'ui/grid/filters/elements/ui-select',
// 'selectType' => 'optgroup',
'dataScope' => static::FIELD_NAME_SELECT,
'dataType' => Text::NAME,
'sortOrder' => $sortOrder,
'options' => $this->_getOptions(),
'visible' => true,
'disabled' => false,
],
],
],
];
protected function _getOptions()
$options = [
1 => [
'label' => __('Option 1'),
'value' => 1
],
2 => [
'label' => __('Option 2'),
'value' => 2
],
3 => [
'label' => __('Option 3'),
'value' => 3
],
];
return $options;
protected function getIsDeleteFieldConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'componentType' => ActionDelete::NAME,
'fit' => true,
'sortOrder' => $sortOrder
],
],
],
];
add a comment |
Here is how dynamic rows can be added by DataProvider.
Add DataProvider class as:
etcadminhtmldi.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="customTab" xsi:type="array">
<item name="class" xsi:type="string">VendorModuleUiDataProviderProductFormModifierNewField</item>
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
</arguments>
</virtualType>
And add DataProvider at:
VendorModuleUiDataProviderProductFormModifier:
namespace VendorModuleUiDataProviderProductFormModifier;
use MagentoCatalogModelLocatorLocatorInterface;
use MagentoCatalogUiDataProviderProductFormModifierAbstractModifier;
use MagentoUiComponentFormFieldset;
use MagentoUiComponentFormField;
use MagentoUiComponentFormElementInput;
use MagentoUiComponentDynamicRows;
use MagentoUiComponentContainer;
use MagentoUiComponentFormElementActionDelete;
use MagentoUiComponentFormElementSelect;
use MagentoUiComponentFormElementDataTypeText;
class NewField extends AbstractModifier
const FIELD_IS_DELETE = 'is_delete';
const FIELD_SORT_ORDER_NAME = 'sort_order';
const FIELD_NAME_SELECT = 'select_field';
private $locator;
public function __construct(
LocatorInterface $locator
)
$this->locator = $locator;
public function modifyData(array $data)
return $data;
public function modifyMeta(array $meta)
$meta = array_replace_recursive(
$meta,
[
'custom_fieldset' => [
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Group'),
'componentType' => Fieldset::NAME,
'dataScope' => 'data.product.custom_fieldset',
'collapsible' => true,
'sortOrder' => 5,
],
],
],
'children' => [
"custom_field" => $this->getSelectTypeGridConfig(10)
],
]
]
);
return $meta;
protected function getSelectTypeGridConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'addButtonLabel' => __('Add Value'),
'componentType' => DynamicRows::NAME,
'component' => 'Magento_Ui/js/dynamic-rows/dynamic-rows',
'additionalClasses' => 'admin__field-wide',
'deleteProperty' => static::FIELD_IS_DELETE,
'deleteValue' => '1',
'renderDefaultRecord' => false,
'sortOrder' => $sortOrder,
],
],
],
'children' => [
'record' => [
'arguments' => [
'data' => [
'config' => [
'componentType' => Container::NAME,
'component' => 'Magento_Ui/js/dynamic-rows/record',
'positionProvider' => static::FIELD_SORT_ORDER_NAME,
'isTemplate' => true,
'is_collection' => true,
],
],
],
'children' => [
static::FIELD_NAME_SELECT => $this->getSelectFieldConfig(1),
static::FIELD_IS_DELETE => $this->getIsDeleteFieldConfig(3)
//Add as many fields as you want
]
]
]
];
protected function getSelectFieldConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'label' => __('Options Select'),
'componentType' => Field::NAME,
'formElement' => Select::NAME,
'component' => 'Magento_Catalog/js/custom-options-type',
'elementTmpl' => 'ui/grid/filters/elements/ui-select',
// 'selectType' => 'optgroup',
'dataScope' => static::FIELD_NAME_SELECT,
'dataType' => Text::NAME,
'sortOrder' => $sortOrder,
'options' => $this->_getOptions(),
'visible' => true,
'disabled' => false,
],
],
],
];
protected function _getOptions()
$options = [
1 => [
'label' => __('Option 1'),
'value' => 1
],
2 => [
'label' => __('Option 2'),
'value' => 2
],
3 => [
'label' => __('Option 3'),
'value' => 3
],
];
return $options;
protected function getIsDeleteFieldConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'componentType' => ActionDelete::NAME,
'fit' => true,
'sortOrder' => $sortOrder
],
],
],
];
add a comment |
Here is how dynamic rows can be added by DataProvider.
Add DataProvider class as:
etcadminhtmldi.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="customTab" xsi:type="array">
<item name="class" xsi:type="string">VendorModuleUiDataProviderProductFormModifierNewField</item>
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
</arguments>
</virtualType>
And add DataProvider at:
VendorModuleUiDataProviderProductFormModifier:
namespace VendorModuleUiDataProviderProductFormModifier;
use MagentoCatalogModelLocatorLocatorInterface;
use MagentoCatalogUiDataProviderProductFormModifierAbstractModifier;
use MagentoUiComponentFormFieldset;
use MagentoUiComponentFormField;
use MagentoUiComponentFormElementInput;
use MagentoUiComponentDynamicRows;
use MagentoUiComponentContainer;
use MagentoUiComponentFormElementActionDelete;
use MagentoUiComponentFormElementSelect;
use MagentoUiComponentFormElementDataTypeText;
class NewField extends AbstractModifier
const FIELD_IS_DELETE = 'is_delete';
const FIELD_SORT_ORDER_NAME = 'sort_order';
const FIELD_NAME_SELECT = 'select_field';
private $locator;
public function __construct(
LocatorInterface $locator
)
$this->locator = $locator;
public function modifyData(array $data)
return $data;
public function modifyMeta(array $meta)
$meta = array_replace_recursive(
$meta,
[
'custom_fieldset' => [
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Group'),
'componentType' => Fieldset::NAME,
'dataScope' => 'data.product.custom_fieldset',
'collapsible' => true,
'sortOrder' => 5,
],
],
],
'children' => [
"custom_field" => $this->getSelectTypeGridConfig(10)
],
]
]
);
return $meta;
protected function getSelectTypeGridConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'addButtonLabel' => __('Add Value'),
'componentType' => DynamicRows::NAME,
'component' => 'Magento_Ui/js/dynamic-rows/dynamic-rows',
'additionalClasses' => 'admin__field-wide',
'deleteProperty' => static::FIELD_IS_DELETE,
'deleteValue' => '1',
'renderDefaultRecord' => false,
'sortOrder' => $sortOrder,
],
],
],
'children' => [
'record' => [
'arguments' => [
'data' => [
'config' => [
'componentType' => Container::NAME,
'component' => 'Magento_Ui/js/dynamic-rows/record',
'positionProvider' => static::FIELD_SORT_ORDER_NAME,
'isTemplate' => true,
'is_collection' => true,
],
],
],
'children' => [
static::FIELD_NAME_SELECT => $this->getSelectFieldConfig(1),
static::FIELD_IS_DELETE => $this->getIsDeleteFieldConfig(3)
//Add as many fields as you want
]
]
]
];
protected function getSelectFieldConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'label' => __('Options Select'),
'componentType' => Field::NAME,
'formElement' => Select::NAME,
'component' => 'Magento_Catalog/js/custom-options-type',
'elementTmpl' => 'ui/grid/filters/elements/ui-select',
// 'selectType' => 'optgroup',
'dataScope' => static::FIELD_NAME_SELECT,
'dataType' => Text::NAME,
'sortOrder' => $sortOrder,
'options' => $this->_getOptions(),
'visible' => true,
'disabled' => false,
],
],
],
];
protected function _getOptions()
$options = [
1 => [
'label' => __('Option 1'),
'value' => 1
],
2 => [
'label' => __('Option 2'),
'value' => 2
],
3 => [
'label' => __('Option 3'),
'value' => 3
],
];
return $options;
protected function getIsDeleteFieldConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'componentType' => ActionDelete::NAME,
'fit' => true,
'sortOrder' => $sortOrder
],
],
],
];
Here is how dynamic rows can be added by DataProvider.
Add DataProvider class as:
etcadminhtmldi.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="customTab" xsi:type="array">
<item name="class" xsi:type="string">VendorModuleUiDataProviderProductFormModifierNewField</item>
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
</arguments>
</virtualType>
And add DataProvider at:
VendorModuleUiDataProviderProductFormModifier:
namespace VendorModuleUiDataProviderProductFormModifier;
use MagentoCatalogModelLocatorLocatorInterface;
use MagentoCatalogUiDataProviderProductFormModifierAbstractModifier;
use MagentoUiComponentFormFieldset;
use MagentoUiComponentFormField;
use MagentoUiComponentFormElementInput;
use MagentoUiComponentDynamicRows;
use MagentoUiComponentContainer;
use MagentoUiComponentFormElementActionDelete;
use MagentoUiComponentFormElementSelect;
use MagentoUiComponentFormElementDataTypeText;
class NewField extends AbstractModifier
const FIELD_IS_DELETE = 'is_delete';
const FIELD_SORT_ORDER_NAME = 'sort_order';
const FIELD_NAME_SELECT = 'select_field';
private $locator;
public function __construct(
LocatorInterface $locator
)
$this->locator = $locator;
public function modifyData(array $data)
return $data;
public function modifyMeta(array $meta)
$meta = array_replace_recursive(
$meta,
[
'custom_fieldset' => [
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Group'),
'componentType' => Fieldset::NAME,
'dataScope' => 'data.product.custom_fieldset',
'collapsible' => true,
'sortOrder' => 5,
],
],
],
'children' => [
"custom_field" => $this->getSelectTypeGridConfig(10)
],
]
]
);
return $meta;
protected function getSelectTypeGridConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'addButtonLabel' => __('Add Value'),
'componentType' => DynamicRows::NAME,
'component' => 'Magento_Ui/js/dynamic-rows/dynamic-rows',
'additionalClasses' => 'admin__field-wide',
'deleteProperty' => static::FIELD_IS_DELETE,
'deleteValue' => '1',
'renderDefaultRecord' => false,
'sortOrder' => $sortOrder,
],
],
],
'children' => [
'record' => [
'arguments' => [
'data' => [
'config' => [
'componentType' => Container::NAME,
'component' => 'Magento_Ui/js/dynamic-rows/record',
'positionProvider' => static::FIELD_SORT_ORDER_NAME,
'isTemplate' => true,
'is_collection' => true,
],
],
],
'children' => [
static::FIELD_NAME_SELECT => $this->getSelectFieldConfig(1),
static::FIELD_IS_DELETE => $this->getIsDeleteFieldConfig(3)
//Add as many fields as you want
]
]
]
];
protected function getSelectFieldConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'label' => __('Options Select'),
'componentType' => Field::NAME,
'formElement' => Select::NAME,
'component' => 'Magento_Catalog/js/custom-options-type',
'elementTmpl' => 'ui/grid/filters/elements/ui-select',
// 'selectType' => 'optgroup',
'dataScope' => static::FIELD_NAME_SELECT,
'dataType' => Text::NAME,
'sortOrder' => $sortOrder,
'options' => $this->_getOptions(),
'visible' => true,
'disabled' => false,
],
],
],
];
protected function _getOptions()
$options = [
1 => [
'label' => __('Option 1'),
'value' => 1
],
2 => [
'label' => __('Option 2'),
'value' => 2
],
3 => [
'label' => __('Option 3'),
'value' => 3
],
];
return $options;
protected function getIsDeleteFieldConfig($sortOrder)
return [
'arguments' => [
'data' => [
'config' => [
'componentType' => ActionDelete::NAME,
'fit' => true,
'sortOrder' => $sortOrder
],
],
],
];
answered 7 mins ago
Ajwad TaqviAjwad Taqvi
417116
417116
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f244397%2fmagento2-how-to-add-a-dynamic-rows-in-to-the-product-insert-area%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what you want ? your question is not clear. from where you want to add these rows? and where you want to show them ? give complete information.
– Hassan Ali Shahzad
Sep 30 '18 at 19:50
Hello@HassanAliShahzad I want this fields into the backend catalog -> product new section
– Hardik Makwana
Oct 1 '18 at 5:06
You mean you want one drop-down in Admin section. Can you let me know the Label and values you want to add for this section? Also Is this field required ?
– Hassan Ali Shahzad
Oct 1 '18 at 5:15
Hurry up man .....
– Hassan Ali Shahzad
Oct 1 '18 at 5:21
Please see question,.i want this dynamic rows component
– Hardik Makwana
Oct 1 '18 at 6:45