How to add a custom field depends on back order option in product edit page(under advance inventory) in magento 2 adminHow to save advance inventory custom field value in db in Magento 2Magento2 : How to add Custom button in product edit formmagento2 - How to add Details field for Custom option in admin?magento2 admin panel product edit page Quantity text field is disabled for bundle productHow to add custom field in magento 2?Custom Field in Product Edit form in magento2 admincustom field value not showing in product edit page in magento 2How to add a custom field under shipping method in magento 2?Magento 2 admin product custom option page add customer group dropdownHow to add custom option field added to every created product in Magento 2 added to products under specific category?In magento 2 admin product-catalog page how to add a additional option in back orders select field under advance Inventory
Can I use my laptop, which says 100-240V, in the USA?
What food production methods would allow a metropolis like New York to become self sufficient
Are there variations of the regular runtimes of the Big-O-Notation?
Ex-manager wants to stay in touch, I don't want to
Why was Endgame Thanos so different than Infinity War Thanos?
How can a layman easily get the consensus view of what academia *thinks* about a subject?
Plastic-on-plastic lubricant that wont leave a residue?
Word for being out at night during curfew
What is the significance of 4200 BCE in context of farming replacing foraging in Europe?
How to minimise the cost of guessing a number in a high/low guess game?
How are Core iX names like Core i5, i7 related to Haswell, Ivy Bridge?
What happens if a creature that would fight isn't on the battlefield anymore?
Why did the ICC decide not to probe alleged US atrocities in Afghanistan?
Is the schwa sound consistent?
Why do Thanos's punches not kill Captain America or at least cause some mortal injuries?
Extrude the faces of a cube symmetrically along XYZ
How can a Lich look like a human without magic?
Make all the squares explode
Why was Thor doubtful about his worthiness to Mjolnir?
How are one-time password generators like Google Authenticator different from having two passwords?
Is it a bad idea to replace pull-up resistors with hard pull-ups?
When a land becomes a creature, is it untapped?
How does noise-cancellation work in Mac laptops?
Meaning of「〜てみたいと思います」
How to add a custom field depends on back order option in product edit page(under advance inventory) in magento 2 admin
How to save advance inventory custom field value in db in Magento 2Magento2 : How to add Custom button in product edit formmagento2 - How to add Details field for Custom option in admin?magento2 admin panel product edit page Quantity text field is disabled for bundle productHow to add custom field in magento 2?Custom Field in Product Edit form in magento2 admincustom field value not showing in product edit page in magento 2How to add a custom field under shipping method in magento 2?Magento 2 admin product custom option page add customer group dropdownHow to add custom option field added to every created product in Magento 2 added to products under specific category?In magento 2 admin product-catalog page how to add a additional option in back orders select field under advance Inventory
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How to add a custom field depends on back order option in product edit page(under advance inventory) in magento 2 admin
magento2 product-edit-page
add a comment |
How to add a custom field depends on back order option in product edit page(under advance inventory) in magento 2 admin
magento2 product-edit-page
add a comment |
How to add a custom field depends on back order option in product edit page(under advance inventory) in magento 2 admin
magento2 product-edit-page
How to add a custom field depends on back order option in product edit page(under advance inventory) in magento 2 admin
magento2 product-edit-page
magento2 product-edit-page
edited May 8 at 10:38
divya sekar
asked May 8 at 9:40
divya sekardivya sekar
42817
42817
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try following way:
app/code/SR/MagentoCommunity/view/adminhtml/ui_component/product_form.xml
<?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">
<modal name="advanced_inventory_modal">
<fieldset name="stock_data">
<container name="container_backorders">
<field name="backorders" formElement="select" component="SR_MagentoCommunity/js/backorders"/>
<field name="custom_input" formElement="input">
<settings>
<scopeLabel>[GLOBAL]</scopeLabel>
<label translate="true">Custom Input</label>
<dataScope>custom_input</dataScope>
</settings>
</field>
</container>
</fieldset>
</modal>
</form>
app/code/SR/MagentoCommunity/view/adminhtml/web/js/backorders.js
define([
'underscore',
'uiRegistry',
'Magento_Ui/js/form/element/select'
], function (_, uiRegistry, select)
'use strict';
return select.extend(
initialize: function ()
this._super();
var customInput = uiRegistry.get('index = custom_input');
if (this.value() == 1)
customInput.show();
else
customInput.hide();
return this;
,
/**
* On value change handler.
*
* @param String value
*/
onUpdate: function (value)
var customInput = uiRegistry.get('index = custom_input');
if (value == 1)
customInput.show();
else
customInput.hide();
return this._super();
);
);
Now this new field will visible if you select Allow Qty Below 0 from backorder dropdown.
[Update]
You need to change xml for M2.1
app/code/SR/MagentoCommunity/view/adminhtml/ui_component/product_form.xml
<?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">
<modal name="advanced_inventory_modal">
<fieldset name="stock_data">
<container name="container_backorders">
<field name="backorders">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">SR_MagentoCommunity/js/backorders</item>
</item>
</argument>
</field>
</container>
<field name="custom_input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">input</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Custom Input</item>
<item name="dataScope" xsi:type="string">custom_input</item>
</item>
</argument>
</field>
</fieldset>
</modal>
</form>
It shows Exception #0 (MagentoFrameworkExceptionLocalizedException): Element 'field', attribute 'formElement': The attribute 'formElement' is not allowed.
– divya sekar
May 9 at 5:09
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
May 9 at 5:15
my magento version is 2.1.3
– divya sekar
May 9 at 5:15
Check updated answer.
– Sohel Rana
May 9 at 5:33
i will check and update you
– divya sekar
May 9 at 5:34
|
show 2 more comments
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%2f273818%2fhow-to-add-a-custom-field-depends-on-back-order-option-in-product-edit-pageunde%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try following way:
app/code/SR/MagentoCommunity/view/adminhtml/ui_component/product_form.xml
<?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">
<modal name="advanced_inventory_modal">
<fieldset name="stock_data">
<container name="container_backorders">
<field name="backorders" formElement="select" component="SR_MagentoCommunity/js/backorders"/>
<field name="custom_input" formElement="input">
<settings>
<scopeLabel>[GLOBAL]</scopeLabel>
<label translate="true">Custom Input</label>
<dataScope>custom_input</dataScope>
</settings>
</field>
</container>
</fieldset>
</modal>
</form>
app/code/SR/MagentoCommunity/view/adminhtml/web/js/backorders.js
define([
'underscore',
'uiRegistry',
'Magento_Ui/js/form/element/select'
], function (_, uiRegistry, select)
'use strict';
return select.extend(
initialize: function ()
this._super();
var customInput = uiRegistry.get('index = custom_input');
if (this.value() == 1)
customInput.show();
else
customInput.hide();
return this;
,
/**
* On value change handler.
*
* @param String value
*/
onUpdate: function (value)
var customInput = uiRegistry.get('index = custom_input');
if (value == 1)
customInput.show();
else
customInput.hide();
return this._super();
);
);
Now this new field will visible if you select Allow Qty Below 0 from backorder dropdown.
[Update]
You need to change xml for M2.1
app/code/SR/MagentoCommunity/view/adminhtml/ui_component/product_form.xml
<?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">
<modal name="advanced_inventory_modal">
<fieldset name="stock_data">
<container name="container_backorders">
<field name="backorders">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">SR_MagentoCommunity/js/backorders</item>
</item>
</argument>
</field>
</container>
<field name="custom_input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">input</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Custom Input</item>
<item name="dataScope" xsi:type="string">custom_input</item>
</item>
</argument>
</field>
</fieldset>
</modal>
</form>
It shows Exception #0 (MagentoFrameworkExceptionLocalizedException): Element 'field', attribute 'formElement': The attribute 'formElement' is not allowed.
– divya sekar
May 9 at 5:09
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
May 9 at 5:15
my magento version is 2.1.3
– divya sekar
May 9 at 5:15
Check updated answer.
– Sohel Rana
May 9 at 5:33
i will check and update you
– divya sekar
May 9 at 5:34
|
show 2 more comments
Try following way:
app/code/SR/MagentoCommunity/view/adminhtml/ui_component/product_form.xml
<?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">
<modal name="advanced_inventory_modal">
<fieldset name="stock_data">
<container name="container_backorders">
<field name="backorders" formElement="select" component="SR_MagentoCommunity/js/backorders"/>
<field name="custom_input" formElement="input">
<settings>
<scopeLabel>[GLOBAL]</scopeLabel>
<label translate="true">Custom Input</label>
<dataScope>custom_input</dataScope>
</settings>
</field>
</container>
</fieldset>
</modal>
</form>
app/code/SR/MagentoCommunity/view/adminhtml/web/js/backorders.js
define([
'underscore',
'uiRegistry',
'Magento_Ui/js/form/element/select'
], function (_, uiRegistry, select)
'use strict';
return select.extend(
initialize: function ()
this._super();
var customInput = uiRegistry.get('index = custom_input');
if (this.value() == 1)
customInput.show();
else
customInput.hide();
return this;
,
/**
* On value change handler.
*
* @param String value
*/
onUpdate: function (value)
var customInput = uiRegistry.get('index = custom_input');
if (value == 1)
customInput.show();
else
customInput.hide();
return this._super();
);
);
Now this new field will visible if you select Allow Qty Below 0 from backorder dropdown.
[Update]
You need to change xml for M2.1
app/code/SR/MagentoCommunity/view/adminhtml/ui_component/product_form.xml
<?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">
<modal name="advanced_inventory_modal">
<fieldset name="stock_data">
<container name="container_backorders">
<field name="backorders">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">SR_MagentoCommunity/js/backorders</item>
</item>
</argument>
</field>
</container>
<field name="custom_input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">input</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Custom Input</item>
<item name="dataScope" xsi:type="string">custom_input</item>
</item>
</argument>
</field>
</fieldset>
</modal>
</form>
It shows Exception #0 (MagentoFrameworkExceptionLocalizedException): Element 'field', attribute 'formElement': The attribute 'formElement' is not allowed.
– divya sekar
May 9 at 5:09
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
May 9 at 5:15
my magento version is 2.1.3
– divya sekar
May 9 at 5:15
Check updated answer.
– Sohel Rana
May 9 at 5:33
i will check and update you
– divya sekar
May 9 at 5:34
|
show 2 more comments
Try following way:
app/code/SR/MagentoCommunity/view/adminhtml/ui_component/product_form.xml
<?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">
<modal name="advanced_inventory_modal">
<fieldset name="stock_data">
<container name="container_backorders">
<field name="backorders" formElement="select" component="SR_MagentoCommunity/js/backorders"/>
<field name="custom_input" formElement="input">
<settings>
<scopeLabel>[GLOBAL]</scopeLabel>
<label translate="true">Custom Input</label>
<dataScope>custom_input</dataScope>
</settings>
</field>
</container>
</fieldset>
</modal>
</form>
app/code/SR/MagentoCommunity/view/adminhtml/web/js/backorders.js
define([
'underscore',
'uiRegistry',
'Magento_Ui/js/form/element/select'
], function (_, uiRegistry, select)
'use strict';
return select.extend(
initialize: function ()
this._super();
var customInput = uiRegistry.get('index = custom_input');
if (this.value() == 1)
customInput.show();
else
customInput.hide();
return this;
,
/**
* On value change handler.
*
* @param String value
*/
onUpdate: function (value)
var customInput = uiRegistry.get('index = custom_input');
if (value == 1)
customInput.show();
else
customInput.hide();
return this._super();
);
);
Now this new field will visible if you select Allow Qty Below 0 from backorder dropdown.
[Update]
You need to change xml for M2.1
app/code/SR/MagentoCommunity/view/adminhtml/ui_component/product_form.xml
<?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">
<modal name="advanced_inventory_modal">
<fieldset name="stock_data">
<container name="container_backorders">
<field name="backorders">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">SR_MagentoCommunity/js/backorders</item>
</item>
</argument>
</field>
</container>
<field name="custom_input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">input</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Custom Input</item>
<item name="dataScope" xsi:type="string">custom_input</item>
</item>
</argument>
</field>
</fieldset>
</modal>
</form>
Try following way:
app/code/SR/MagentoCommunity/view/adminhtml/ui_component/product_form.xml
<?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">
<modal name="advanced_inventory_modal">
<fieldset name="stock_data">
<container name="container_backorders">
<field name="backorders" formElement="select" component="SR_MagentoCommunity/js/backorders"/>
<field name="custom_input" formElement="input">
<settings>
<scopeLabel>[GLOBAL]</scopeLabel>
<label translate="true">Custom Input</label>
<dataScope>custom_input</dataScope>
</settings>
</field>
</container>
</fieldset>
</modal>
</form>
app/code/SR/MagentoCommunity/view/adminhtml/web/js/backorders.js
define([
'underscore',
'uiRegistry',
'Magento_Ui/js/form/element/select'
], function (_, uiRegistry, select)
'use strict';
return select.extend(
initialize: function ()
this._super();
var customInput = uiRegistry.get('index = custom_input');
if (this.value() == 1)
customInput.show();
else
customInput.hide();
return this;
,
/**
* On value change handler.
*
* @param String value
*/
onUpdate: function (value)
var customInput = uiRegistry.get('index = custom_input');
if (value == 1)
customInput.show();
else
customInput.hide();
return this._super();
);
);
Now this new field will visible if you select Allow Qty Below 0 from backorder dropdown.
[Update]
You need to change xml for M2.1
app/code/SR/MagentoCommunity/view/adminhtml/ui_component/product_form.xml
<?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">
<modal name="advanced_inventory_modal">
<fieldset name="stock_data">
<container name="container_backorders">
<field name="backorders">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">SR_MagentoCommunity/js/backorders</item>
</item>
</argument>
</field>
</container>
<field name="custom_input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">number</item>
<item name="formElement" xsi:type="string">input</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Custom Input</item>
<item name="dataScope" xsi:type="string">custom_input</item>
</item>
</argument>
</field>
</fieldset>
</modal>
</form>
edited 2 days ago
divya sekar
42817
42817
answered May 8 at 15:45
Sohel RanaSohel Rana
24.4k34562
24.4k34562
It shows Exception #0 (MagentoFrameworkExceptionLocalizedException): Element 'field', attribute 'formElement': The attribute 'formElement' is not allowed.
– divya sekar
May 9 at 5:09
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
May 9 at 5:15
my magento version is 2.1.3
– divya sekar
May 9 at 5:15
Check updated answer.
– Sohel Rana
May 9 at 5:33
i will check and update you
– divya sekar
May 9 at 5:34
|
show 2 more comments
It shows Exception #0 (MagentoFrameworkExceptionLocalizedException): Element 'field', attribute 'formElement': The attribute 'formElement' is not allowed.
– divya sekar
May 9 at 5:09
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
May 9 at 5:15
my magento version is 2.1.3
– divya sekar
May 9 at 5:15
Check updated answer.
– Sohel Rana
May 9 at 5:33
i will check and update you
– divya sekar
May 9 at 5:34
It shows Exception #0 (MagentoFrameworkExceptionLocalizedException): Element 'field', attribute 'formElement': The attribute 'formElement' is not allowed.
– divya sekar
May 9 at 5:09
It shows Exception #0 (MagentoFrameworkExceptionLocalizedException): Element 'field', attribute 'formElement': The attribute 'formElement' is not allowed.
– divya sekar
May 9 at 5:09
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
May 9 at 5:15
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
May 9 at 5:15
my magento version is 2.1.3
– divya sekar
May 9 at 5:15
my magento version is 2.1.3
– divya sekar
May 9 at 5:15
Check updated answer.
– Sohel Rana
May 9 at 5:33
Check updated answer.
– Sohel Rana
May 9 at 5:33
i will check and update you
– divya sekar
May 9 at 5:34
i will check and update you
– divya sekar
May 9 at 5:34
|
show 2 more comments
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%2f273818%2fhow-to-add-a-custom-field-depends-on-back-order-option-in-product-edit-pageunde%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