Magento 2 add new custom option text fieldmagento 2.1 product custom option extra field like Quantity?Magento 2 Add Custom options to Bundle Product add optionsMagento2: Add class or id to product in bundleMagento2 - Add new field to new step in magento 2!Magento2 : How to add a new product custom option type?magento2 - How to add Details field for Custom option in admin?Magento 2 how to add new custom price type in the Customizable Options?Magento 2 add new text filed at custom options section?Add a generic field in admin formAdd new custom field in magento 2 contact formHow to save a custom field value in DB for add new customers in backend magento2.2.5?Add a custom fields account information section magento2 dashboardMagento 2 add custom(comment text) field in checkout shipping method
Do publishers care if submitted work has already been copyrighted?
Is “snitty” a popular American English term? What is its origin?
Dangerous workplace travelling
Why does sound not move through a wall?
Is 'contemporary' ambiguous and if so is there a better word?
How can Internet speed be 10 times slower without a router than when using the same connection with a router?
To kill a cuckoo
Trigonometry substitution issue with sign
How long would it take for people to notice a mass disappearance?
Copy previous line to current line from text file
Which sphere is fastest?
Why didn't this character get a funeral at the end of Avengers: Endgame?
Should I mention being denied entry to UK due to a confusion in my Visa and Ticket bookings?
What do I do if my advisor made a mistake?
How do I, as a DM, handle a party that decides to set up an ambush in a dungeon?
Hostile Divisor Numbers
What are the advantages of luxury car brands like Acura/Lexus over their sibling non-luxury brands Honda/Toyota?
Why did WWI include Japan?
A factorization game
Should I simplify my writing in a foreign country?
Install LibreOffice-Writer Only not LibreOffice whole package
Voltage Balun 1:1
Handling Null values (and equivalents) routinely in Python
SOQL query WHERE filter by specific months
Magento 2 add new custom option text field
magento 2.1 product custom option extra field like Quantity?Magento 2 Add Custom options to Bundle Product add optionsMagento2: Add class or id to product in bundleMagento2 - Add new field to new step in magento 2!Magento2 : How to add a new product custom option type?magento2 - How to add Details field for Custom option in admin?Magento 2 how to add new custom price type in the Customizable Options?Magento 2 add new text filed at custom options section?Add a generic field in admin formAdd new custom field in magento 2 contact formHow to save a custom field value in DB for add new customers in backend magento2.2.5?Add a custom fields account information section magento2 dashboardMagento 2 add custom(comment text) field in checkout shipping method
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I would like to add new custom option text field like 'New Text Field Title' in the magento 2.x 'Customizable Options' section could you please suggest me and guide me how to add please refer my screenshot.
magento2
add a comment |
I would like to add new custom option text field like 'New Text Field Title' in the magento 2.x 'Customizable Options' section could you please suggest me and guide me how to add please refer my screenshot.
magento2
I got this plugin working properly and saving, etc. I have also created a plugin which allows me to override Select.php. That said, Can someone tell me how to display the new custom options field in Select.php? I need my custom option titles/labels to look like this: <label class="label" for="select_4567" class="my_custom_options_text"> <span>My Custom Options Title</span> </label>
– user3254623
Apr 30 at 22:25
If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
– Jai
May 1 at 1:23
add a comment |
I would like to add new custom option text field like 'New Text Field Title' in the magento 2.x 'Customizable Options' section could you please suggest me and guide me how to add please refer my screenshot.
magento2
I would like to add new custom option text field like 'New Text Field Title' in the magento 2.x 'Customizable Options' section could you please suggest me and guide me how to add please refer my screenshot.
magento2
magento2
edited Feb 28 '17 at 6:38
Teja Bhagavan Kollepara
2,99442050
2,99442050
asked Jan 17 '17 at 13:30
Nagaraju KasaNagaraju Kasa
2,81121742
2,81121742
I got this plugin working properly and saving, etc. I have also created a plugin which allows me to override Select.php. That said, Can someone tell me how to display the new custom options field in Select.php? I need my custom option titles/labels to look like this: <label class="label" for="select_4567" class="my_custom_options_text"> <span>My Custom Options Title</span> </label>
– user3254623
Apr 30 at 22:25
If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
– Jai
May 1 at 1:23
add a comment |
I got this plugin working properly and saving, etc. I have also created a plugin which allows me to override Select.php. That said, Can someone tell me how to display the new custom options field in Select.php? I need my custom option titles/labels to look like this: <label class="label" for="select_4567" class="my_custom_options_text"> <span>My Custom Options Title</span> </label>
– user3254623
Apr 30 at 22:25
If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
– Jai
May 1 at 1:23
I got this plugin working properly and saving, etc. I have also created a plugin which allows me to override Select.php. That said, Can someone tell me how to display the new custom options field in Select.php? I need my custom option titles/labels to look like this: <label class="label" for="select_4567" class="my_custom_options_text"> <span>My Custom Options Title</span> </label>
– user3254623
Apr 30 at 22:25
I got this plugin working properly and saving, etc. I have also created a plugin which allows me to override Select.php. That said, Can someone tell me how to display the new custom options field in Select.php? I need my custom option titles/labels to look like this: <label class="label" for="select_4567" class="my_custom_options_text"> <span>My Custom Options Title</span> </label>
– user3254623
Apr 30 at 22:25
If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
– Jai
May 1 at 1:23
If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
– Jai
May 1 at 1:23
add a comment |
1 Answer
1
active
oldest
votes
Create a plugin for that. Try following way:
SR/StackExchange/etc/adminhtml/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCatalogUiDataProviderProductFormModifierCustomOptions">
<plugin name="sr_stackexchange_custom_option" type="SRStackExchangePluginCatalogUiDataProviderProductFormModifierCustomOptions" sortOrder="1"/>
</type>
</config>
SR/StackExchange/Plugin/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php
namespace SRStackExchangePluginCatalogUiDataProviderProductFormModifier;
class CustomOptions
public function afterModifyMeta(
MagentoCatalogUiDataProviderProductFormModifierCustomOptions $subject,
$meta
)
$meta['custom_options']['children']['options']['children']['record']['children']['container_option']['children']['container_common']['children']['custom_text'] =
$this->getTitleFieldConfig(
200,
[
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Text'),
'component' => 'Magento_Catalog/component/static-type-input',
'valueUpdate' => 'input',
'imports' => [
'optionId' => '$ $.provider :$ $.parentScope .option_id'
]
],
],
],
]
);
return $meta;
/**
* Get config for "Title" fields
*
* @param int $sortOrder
* @param array $options
* @return array
*/
protected function getTitleFieldConfig($sortOrder, array $options = [])
return array_replace_recursive(
[
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Text'),
'componentType' => MagentoUiComponentFormField::NAME,
'formElement' => MagentoUiComponentFormElementInput::NAME,
'dataScope' => 'custom_text',
'dataType' => MagentoUiComponentFormElementDataTypeText::NAME,
'sortOrder' => $sortOrder,
'validation' => [
'required-entry' => false
],
],
],
],
],
$options
);
Clear Magento cache.
NB: This solution only for M2.1.x. and greater.
[Update]
How to save?
-> create a column 'catalog_product_option' table same as field name. e.g: custom_text
-> clear cache.
Thanks its showing in the admin side custom options section now but the value unable to save whether we have to do anything ?
– Nagaraju Kasa
Jan 19 '17 at 6:08
Check here -> github.com/magento/magento2/blob/2.1/app/code/Magento/Catalog/…
– Sohel Rana
Jan 19 '17 at 6:21
we followed the link but we were unable to save the value whether we have to do any database changes? could you plz explain in detail thanks
– Nagaraju Kasa
Jan 19 '17 at 8:43
Check last update code.
– Sohel Rana
Jan 19 '17 at 9:12
1
I have create custom field for bundle options, Save successfully intocatelog_product_bundle_options
table but not loading it after save while edit product. any idea?
– Ronak Chauhan
Jul 25 '17 at 10:11
|
show 4 more comments
protected by Community♦ May 1 at 5:40
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Create a plugin for that. Try following way:
SR/StackExchange/etc/adminhtml/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCatalogUiDataProviderProductFormModifierCustomOptions">
<plugin name="sr_stackexchange_custom_option" type="SRStackExchangePluginCatalogUiDataProviderProductFormModifierCustomOptions" sortOrder="1"/>
</type>
</config>
SR/StackExchange/Plugin/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php
namespace SRStackExchangePluginCatalogUiDataProviderProductFormModifier;
class CustomOptions
public function afterModifyMeta(
MagentoCatalogUiDataProviderProductFormModifierCustomOptions $subject,
$meta
)
$meta['custom_options']['children']['options']['children']['record']['children']['container_option']['children']['container_common']['children']['custom_text'] =
$this->getTitleFieldConfig(
200,
[
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Text'),
'component' => 'Magento_Catalog/component/static-type-input',
'valueUpdate' => 'input',
'imports' => [
'optionId' => '$ $.provider :$ $.parentScope .option_id'
]
],
],
],
]
);
return $meta;
/**
* Get config for "Title" fields
*
* @param int $sortOrder
* @param array $options
* @return array
*/
protected function getTitleFieldConfig($sortOrder, array $options = [])
return array_replace_recursive(
[
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Text'),
'componentType' => MagentoUiComponentFormField::NAME,
'formElement' => MagentoUiComponentFormElementInput::NAME,
'dataScope' => 'custom_text',
'dataType' => MagentoUiComponentFormElementDataTypeText::NAME,
'sortOrder' => $sortOrder,
'validation' => [
'required-entry' => false
],
],
],
],
],
$options
);
Clear Magento cache.
NB: This solution only for M2.1.x. and greater.
[Update]
How to save?
-> create a column 'catalog_product_option' table same as field name. e.g: custom_text
-> clear cache.
Thanks its showing in the admin side custom options section now but the value unable to save whether we have to do anything ?
– Nagaraju Kasa
Jan 19 '17 at 6:08
Check here -> github.com/magento/magento2/blob/2.1/app/code/Magento/Catalog/…
– Sohel Rana
Jan 19 '17 at 6:21
we followed the link but we were unable to save the value whether we have to do any database changes? could you plz explain in detail thanks
– Nagaraju Kasa
Jan 19 '17 at 8:43
Check last update code.
– Sohel Rana
Jan 19 '17 at 9:12
1
I have create custom field for bundle options, Save successfully intocatelog_product_bundle_options
table but not loading it after save while edit product. any idea?
– Ronak Chauhan
Jul 25 '17 at 10:11
|
show 4 more comments
Create a plugin for that. Try following way:
SR/StackExchange/etc/adminhtml/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCatalogUiDataProviderProductFormModifierCustomOptions">
<plugin name="sr_stackexchange_custom_option" type="SRStackExchangePluginCatalogUiDataProviderProductFormModifierCustomOptions" sortOrder="1"/>
</type>
</config>
SR/StackExchange/Plugin/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php
namespace SRStackExchangePluginCatalogUiDataProviderProductFormModifier;
class CustomOptions
public function afterModifyMeta(
MagentoCatalogUiDataProviderProductFormModifierCustomOptions $subject,
$meta
)
$meta['custom_options']['children']['options']['children']['record']['children']['container_option']['children']['container_common']['children']['custom_text'] =
$this->getTitleFieldConfig(
200,
[
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Text'),
'component' => 'Magento_Catalog/component/static-type-input',
'valueUpdate' => 'input',
'imports' => [
'optionId' => '$ $.provider :$ $.parentScope .option_id'
]
],
],
],
]
);
return $meta;
/**
* Get config for "Title" fields
*
* @param int $sortOrder
* @param array $options
* @return array
*/
protected function getTitleFieldConfig($sortOrder, array $options = [])
return array_replace_recursive(
[
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Text'),
'componentType' => MagentoUiComponentFormField::NAME,
'formElement' => MagentoUiComponentFormElementInput::NAME,
'dataScope' => 'custom_text',
'dataType' => MagentoUiComponentFormElementDataTypeText::NAME,
'sortOrder' => $sortOrder,
'validation' => [
'required-entry' => false
],
],
],
],
],
$options
);
Clear Magento cache.
NB: This solution only for M2.1.x. and greater.
[Update]
How to save?
-> create a column 'catalog_product_option' table same as field name. e.g: custom_text
-> clear cache.
Thanks its showing in the admin side custom options section now but the value unable to save whether we have to do anything ?
– Nagaraju Kasa
Jan 19 '17 at 6:08
Check here -> github.com/magento/magento2/blob/2.1/app/code/Magento/Catalog/…
– Sohel Rana
Jan 19 '17 at 6:21
we followed the link but we were unable to save the value whether we have to do any database changes? could you plz explain in detail thanks
– Nagaraju Kasa
Jan 19 '17 at 8:43
Check last update code.
– Sohel Rana
Jan 19 '17 at 9:12
1
I have create custom field for bundle options, Save successfully intocatelog_product_bundle_options
table but not loading it after save while edit product. any idea?
– Ronak Chauhan
Jul 25 '17 at 10:11
|
show 4 more comments
Create a plugin for that. Try following way:
SR/StackExchange/etc/adminhtml/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCatalogUiDataProviderProductFormModifierCustomOptions">
<plugin name="sr_stackexchange_custom_option" type="SRStackExchangePluginCatalogUiDataProviderProductFormModifierCustomOptions" sortOrder="1"/>
</type>
</config>
SR/StackExchange/Plugin/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php
namespace SRStackExchangePluginCatalogUiDataProviderProductFormModifier;
class CustomOptions
public function afterModifyMeta(
MagentoCatalogUiDataProviderProductFormModifierCustomOptions $subject,
$meta
)
$meta['custom_options']['children']['options']['children']['record']['children']['container_option']['children']['container_common']['children']['custom_text'] =
$this->getTitleFieldConfig(
200,
[
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Text'),
'component' => 'Magento_Catalog/component/static-type-input',
'valueUpdate' => 'input',
'imports' => [
'optionId' => '$ $.provider :$ $.parentScope .option_id'
]
],
],
],
]
);
return $meta;
/**
* Get config for "Title" fields
*
* @param int $sortOrder
* @param array $options
* @return array
*/
protected function getTitleFieldConfig($sortOrder, array $options = [])
return array_replace_recursive(
[
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Text'),
'componentType' => MagentoUiComponentFormField::NAME,
'formElement' => MagentoUiComponentFormElementInput::NAME,
'dataScope' => 'custom_text',
'dataType' => MagentoUiComponentFormElementDataTypeText::NAME,
'sortOrder' => $sortOrder,
'validation' => [
'required-entry' => false
],
],
],
],
],
$options
);
Clear Magento cache.
NB: This solution only for M2.1.x. and greater.
[Update]
How to save?
-> create a column 'catalog_product_option' table same as field name. e.g: custom_text
-> clear cache.
Create a plugin for that. Try following way:
SR/StackExchange/etc/adminhtml/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCatalogUiDataProviderProductFormModifierCustomOptions">
<plugin name="sr_stackexchange_custom_option" type="SRStackExchangePluginCatalogUiDataProviderProductFormModifierCustomOptions" sortOrder="1"/>
</type>
</config>
SR/StackExchange/Plugin/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php
namespace SRStackExchangePluginCatalogUiDataProviderProductFormModifier;
class CustomOptions
public function afterModifyMeta(
MagentoCatalogUiDataProviderProductFormModifierCustomOptions $subject,
$meta
)
$meta['custom_options']['children']['options']['children']['record']['children']['container_option']['children']['container_common']['children']['custom_text'] =
$this->getTitleFieldConfig(
200,
[
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Text'),
'component' => 'Magento_Catalog/component/static-type-input',
'valueUpdate' => 'input',
'imports' => [
'optionId' => '$ $.provider :$ $.parentScope .option_id'
]
],
],
],
]
);
return $meta;
/**
* Get config for "Title" fields
*
* @param int $sortOrder
* @param array $options
* @return array
*/
protected function getTitleFieldConfig($sortOrder, array $options = [])
return array_replace_recursive(
[
'arguments' => [
'data' => [
'config' => [
'label' => __('Custom Text'),
'componentType' => MagentoUiComponentFormField::NAME,
'formElement' => MagentoUiComponentFormElementInput::NAME,
'dataScope' => 'custom_text',
'dataType' => MagentoUiComponentFormElementDataTypeText::NAME,
'sortOrder' => $sortOrder,
'validation' => [
'required-entry' => false
],
],
],
],
],
$options
);
Clear Magento cache.
NB: This solution only for M2.1.x. and greater.
[Update]
How to save?
-> create a column 'catalog_product_option' table same as field name. e.g: custom_text
-> clear cache.
edited Jan 19 '17 at 9:12
answered Jan 18 '17 at 16:23
Sohel RanaSohel Rana
23.9k34461
23.9k34461
Thanks its showing in the admin side custom options section now but the value unable to save whether we have to do anything ?
– Nagaraju Kasa
Jan 19 '17 at 6:08
Check here -> github.com/magento/magento2/blob/2.1/app/code/Magento/Catalog/…
– Sohel Rana
Jan 19 '17 at 6:21
we followed the link but we were unable to save the value whether we have to do any database changes? could you plz explain in detail thanks
– Nagaraju Kasa
Jan 19 '17 at 8:43
Check last update code.
– Sohel Rana
Jan 19 '17 at 9:12
1
I have create custom field for bundle options, Save successfully intocatelog_product_bundle_options
table but not loading it after save while edit product. any idea?
– Ronak Chauhan
Jul 25 '17 at 10:11
|
show 4 more comments
Thanks its showing in the admin side custom options section now but the value unable to save whether we have to do anything ?
– Nagaraju Kasa
Jan 19 '17 at 6:08
Check here -> github.com/magento/magento2/blob/2.1/app/code/Magento/Catalog/…
– Sohel Rana
Jan 19 '17 at 6:21
we followed the link but we were unable to save the value whether we have to do any database changes? could you plz explain in detail thanks
– Nagaraju Kasa
Jan 19 '17 at 8:43
Check last update code.
– Sohel Rana
Jan 19 '17 at 9:12
1
I have create custom field for bundle options, Save successfully intocatelog_product_bundle_options
table but not loading it after save while edit product. any idea?
– Ronak Chauhan
Jul 25 '17 at 10:11
Thanks its showing in the admin side custom options section now but the value unable to save whether we have to do anything ?
– Nagaraju Kasa
Jan 19 '17 at 6:08
Thanks its showing in the admin side custom options section now but the value unable to save whether we have to do anything ?
– Nagaraju Kasa
Jan 19 '17 at 6:08
Check here -> github.com/magento/magento2/blob/2.1/app/code/Magento/Catalog/…
– Sohel Rana
Jan 19 '17 at 6:21
Check here -> github.com/magento/magento2/blob/2.1/app/code/Magento/Catalog/…
– Sohel Rana
Jan 19 '17 at 6:21
we followed the link but we were unable to save the value whether we have to do any database changes? could you plz explain in detail thanks
– Nagaraju Kasa
Jan 19 '17 at 8:43
we followed the link but we were unable to save the value whether we have to do any database changes? could you plz explain in detail thanks
– Nagaraju Kasa
Jan 19 '17 at 8:43
Check last update code.
– Sohel Rana
Jan 19 '17 at 9:12
Check last update code.
– Sohel Rana
Jan 19 '17 at 9:12
1
1
I have create custom field for bundle options, Save successfully into
catelog_product_bundle_options
table but not loading it after save while edit product. any idea?– Ronak Chauhan
Jul 25 '17 at 10:11
I have create custom field for bundle options, Save successfully into
catelog_product_bundle_options
table but not loading it after save while edit product. any idea?– Ronak Chauhan
Jul 25 '17 at 10:11
|
show 4 more comments
protected by Community♦ May 1 at 5:40
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
I got this plugin working properly and saving, etc. I have also created a plugin which allows me to override Select.php. That said, Can someone tell me how to display the new custom options field in Select.php? I need my custom option titles/labels to look like this: <label class="label" for="select_4567" class="my_custom_options_text"> <span>My Custom Options Title</span> </label>
– user3254623
Apr 30 at 22:25
If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
– Jai
May 1 at 1:23