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
How can a Lich look like a human without magic?
How to minimise the cost of guessing a number in a high/low guess game?
Was this character’s old age look CGI or make-up?
Are there variations of the regular runtimes of the Big-O-Notation?
How did Thanos not realise this had happened at the end of Endgame?
Run script for 10 times until meets the condition, but break the loop if it meets the condition during iteration
What food production methods would allow a metropolis like New York to become self sufficient
Who was this character from the Tomb of Annihilation adventure before they became a monster?
Exclude loop* snap devices from lsblk output?
Why can't RGB or bicolour LEDs produce a decent yellow?
How do I compare the result of "1d20+x, with advantage" to "1d20+y, without advantage", assuming x < y?
How can I answer high-school writing prompts without sounding weird and fake?
What is the best way for a skeleton to impersonate human without using magic?
SSD - Disk is OK, one bad sector
On studying Computer Science vs. Software Engineering to become a proficient coder
What is Plautus’s pun about frustum and frustrum?
Exception propagation: When should I catch exceptions?
51% attack - apparently very easy? refering to CZ's "rollback btc chain" - How to make sure such corruptible scenario can never happen so easily?
How to cope with regret and shame about not fully utilizing opportunities during PhD?
Do atomic orbitals "pulse" in time?
What does the expression "right on the tip of my tongue" mean?
Light Switch Terminals
Why was the Ancient One so hesitant to teach Dr. Strange the art of sorcery?
Does kinetic energy warp spacetime?
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
2 days ago
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
2 days ago
my magento version is 2.1.3
– divya sekar
2 days ago
Check updated answer.
– Sohel Rana
2 days ago
i will check and update you
– divya sekar
2 days ago
|
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
2 days ago
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
2 days ago
my magento version is 2.1.3
– divya sekar
2 days ago
Check updated answer.
– Sohel Rana
2 days ago
i will check and update you
– divya sekar
2 days ago
|
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
2 days ago
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
2 days ago
my magento version is 2.1.3
– divya sekar
2 days ago
Check updated answer.
– Sohel Rana
2 days ago
i will check and update you
– divya sekar
2 days ago
|
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
2 days ago
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
2 days ago
my magento version is 2.1.3
– divya sekar
2 days ago
Check updated answer.
– Sohel Rana
2 days ago
i will check and update you
– divya sekar
2 days ago
|
show 2 more comments
It shows Exception #0 (MagentoFrameworkExceptionLocalizedException): Element 'field', attribute 'formElement': The attribute 'formElement' is not allowed.
– divya sekar
2 days ago
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
2 days ago
my magento version is 2.1.3
– divya sekar
2 days ago
Check updated answer.
– Sohel Rana
2 days ago
i will check and update you
– divya sekar
2 days ago
It shows Exception #0 (MagentoFrameworkExceptionLocalizedException): Element 'field', attribute 'formElement': The attribute 'formElement' is not allowed.
– divya sekar
2 days ago
It shows Exception #0 (MagentoFrameworkExceptionLocalizedException): Element 'field', attribute 'formElement': The attribute 'formElement' is not allowed.
– divya sekar
2 days ago
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
2 days ago
Is your magento version > M2.3? I tested with M2.3
– Sohel Rana
2 days ago
my magento version is 2.1.3
– divya sekar
2 days ago
my magento version is 2.1.3
– divya sekar
2 days ago
Check updated answer.
– Sohel Rana
2 days ago
Check updated answer.
– Sohel Rana
2 days ago
i will check and update you
– divya sekar
2 days ago
i will check and update you
– divya sekar
2 days ago
|
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