Disabling a UI component field while add new product in Magento 2How can i rewrite TierPrice Block in...
What Does the Heart In Gyms Mean?
Citing contemporaneous (interlaced?) preprints
Why is working on the same position for more than 15 years not a red flag?
Is the withholding of funding notice allowed?
What is this waxed root vegetable?
Rationale to prefer local variables over instance variables?
In iTunes 12 on macOS, how can I reset the skip count of a song?
Don't know what I’m looking for regarding removable HDDs?
Roots of 6th chords on the guitar for different inversions/voicings
Difference between 'stomach' and 'uterus'
Is there a full canon version of Tyrion's jackass/honeycomb joke?
Why is it "take a leak?"
Inverse of the covariance matrix of a multivariate normal distribution
Are paired adjectives bad style?
When was drinking water recognized as crucial in marathon running?
Is it possible to make a clamp function shorter than a ternary in JS?
For a 1-action spell, do I need to take a turn to ready the spell before I can cast it, or can I cast it immediately?
How to substitute values from a list into a function?
What could trigger powerful quakes on icy world?
Achieving MPPT of a solar panel with LM2596
The need of reserving one's ability in job interviews
What is a term for a function that when called repeatedly, has the same effect as calling once?
In Adventurer's League, is it possible to keep the Ring of Winter if you manage to acquire it in the Tomb of Annihilation adventure?
Giving a talk in my old university, how prominently should I tell students my salary?
Disabling a UI component field while add new product in Magento 2
How can i rewrite TierPrice Block in Magento2Error Add Result page breadcrumbMagento 2 Add new field to Magento_User admin formMagento2 add new field in bundle item (in option selection)Add an extension to edit the product name quickly in admin. Magento 2How Magento 2 serialize Configurable Product data, while savingMagento 2 Grid serialization : not getting selected product idMagento 2 sales order grid custom column export csv issueMagento 2 : Error when Add WYSIWYG Editor to Block FormMagento 2.2.5: Add, Update and Delete existing products Custom Options
I have a UI component defining field, I want to display this field while edit existing product, and hide this field when add new product.
NamespaceModulenameviewadminhtmlui_componentproduct_form
<fieldset name="vendorproduct">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Seller Sell This Product</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">65</item>
</item>
</argument>
<container name="vendor_data" >
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
<htmlContent name="html_content">
<argument name="block" xsi:type="object">NamespaceModulenameBlockAdminhtmlCatalogProductEditTabSeller</argument>
</htmlContent>
</container>
</fieldset>
Using <item name="disabled" xsi:type="boolean">true</item>
I can disable fields but I want to disable them while adding new product only. how can I achieve this.
Any help is appreciated. Thanks.
magento2 xml uicomponent
add a comment |
I have a UI component defining field, I want to display this field while edit existing product, and hide this field when add new product.
NamespaceModulenameviewadminhtmlui_componentproduct_form
<fieldset name="vendorproduct">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Seller Sell This Product</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">65</item>
</item>
</argument>
<container name="vendor_data" >
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
<htmlContent name="html_content">
<argument name="block" xsi:type="object">NamespaceModulenameBlockAdminhtmlCatalogProductEditTabSeller</argument>
</htmlContent>
</container>
</fieldset>
Using <item name="disabled" xsi:type="boolean">true</item>
I can disable fields but I want to disable them while adding new product only. how can I achieve this.
Any help is appreciated. Thanks.
magento2 xml uicomponent
add a comment |
I have a UI component defining field, I want to display this field while edit existing product, and hide this field when add new product.
NamespaceModulenameviewadminhtmlui_componentproduct_form
<fieldset name="vendorproduct">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Seller Sell This Product</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">65</item>
</item>
</argument>
<container name="vendor_data" >
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
<htmlContent name="html_content">
<argument name="block" xsi:type="object">NamespaceModulenameBlockAdminhtmlCatalogProductEditTabSeller</argument>
</htmlContent>
</container>
</fieldset>
Using <item name="disabled" xsi:type="boolean">true</item>
I can disable fields but I want to disable them while adding new product only. how can I achieve this.
Any help is appreciated. Thanks.
magento2 xml uicomponent
I have a UI component defining field, I want to display this field while edit existing product, and hide this field when add new product.
NamespaceModulenameviewadminhtmlui_componentproduct_form
<fieldset name="vendorproduct">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Seller Sell This Product</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">65</item>
</item>
</argument>
<container name="vendor_data" >
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
<htmlContent name="html_content">
<argument name="block" xsi:type="object">NamespaceModulenameBlockAdminhtmlCatalogProductEditTabSeller</argument>
</htmlContent>
</container>
</fieldset>
Using <item name="disabled" xsi:type="boolean">true</item>
I can disable fields but I want to disable them while adding new product only. how can I achieve this.
Any help is appreciated. Thanks.
magento2 xml uicomponent
magento2 xml uicomponent
edited Jul 17 '18 at 5:34
Chirag Patel
asked May 8 '18 at 5:50
Chirag PatelChirag Patel
2,200321
2,200321
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="name" xsi:type="array">
<item name="class" xsi:type="string">NamespaceModuleNamUiDataProviderProductFormModifierAttributes</item>
<item name="sortOrder" xsi:type="number">1000</item>
</item>
</argument>
</arguments>
</virtualType>
public function modifyMeta(array $meta)
{
// check to disable attributes on product new
if ($this->lumaData->getGeneralConfig('lockattributes') == 1) {
// attributes need to be disabled
$attributes = array();
} else {
$attributes = array();
}
if ($this->httpRequest->getActionName() == 'new' ) {
// code to make the attribute disable
foreach($attributes as $attribute){
$path = $this->arrayManager->findPath($attribute, $meta, null, 'children');
if ($path) {
$meta = $this->arrayManager->set(
"{$path}/arguments/data/config/disabled",
$meta,
true
);
}
}
}
return $meta;
}
If you use this you will get solution
add a comment |
According to the official docs Modifier classes should be used when you need to add validations to display only certain fields for certain product types and also when static declaration is not applicable. Which I think is the case you are describing here.
https://devdocs.magento.com/guides/v2.3/howdoi/customize-modifier-class.html
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%2f225057%2fdisabling-a-ui-component-field-while-add-new-product-in-magento-2%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
<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="name" xsi:type="array">
<item name="class" xsi:type="string">NamespaceModuleNamUiDataProviderProductFormModifierAttributes</item>
<item name="sortOrder" xsi:type="number">1000</item>
</item>
</argument>
</arguments>
</virtualType>
public function modifyMeta(array $meta)
{
// check to disable attributes on product new
if ($this->lumaData->getGeneralConfig('lockattributes') == 1) {
// attributes need to be disabled
$attributes = array();
} else {
$attributes = array();
}
if ($this->httpRequest->getActionName() == 'new' ) {
// code to make the attribute disable
foreach($attributes as $attribute){
$path = $this->arrayManager->findPath($attribute, $meta, null, 'children');
if ($path) {
$meta = $this->arrayManager->set(
"{$path}/arguments/data/config/disabled",
$meta,
true
);
}
}
}
return $meta;
}
If you use this you will get solution
add a comment |
<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="name" xsi:type="array">
<item name="class" xsi:type="string">NamespaceModuleNamUiDataProviderProductFormModifierAttributes</item>
<item name="sortOrder" xsi:type="number">1000</item>
</item>
</argument>
</arguments>
</virtualType>
public function modifyMeta(array $meta)
{
// check to disable attributes on product new
if ($this->lumaData->getGeneralConfig('lockattributes') == 1) {
// attributes need to be disabled
$attributes = array();
} else {
$attributes = array();
}
if ($this->httpRequest->getActionName() == 'new' ) {
// code to make the attribute disable
foreach($attributes as $attribute){
$path = $this->arrayManager->findPath($attribute, $meta, null, 'children');
if ($path) {
$meta = $this->arrayManager->set(
"{$path}/arguments/data/config/disabled",
$meta,
true
);
}
}
}
return $meta;
}
If you use this you will get solution
add a comment |
<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="name" xsi:type="array">
<item name="class" xsi:type="string">NamespaceModuleNamUiDataProviderProductFormModifierAttributes</item>
<item name="sortOrder" xsi:type="number">1000</item>
</item>
</argument>
</arguments>
</virtualType>
public function modifyMeta(array $meta)
{
// check to disable attributes on product new
if ($this->lumaData->getGeneralConfig('lockattributes') == 1) {
// attributes need to be disabled
$attributes = array();
} else {
$attributes = array();
}
if ($this->httpRequest->getActionName() == 'new' ) {
// code to make the attribute disable
foreach($attributes as $attribute){
$path = $this->arrayManager->findPath($attribute, $meta, null, 'children');
if ($path) {
$meta = $this->arrayManager->set(
"{$path}/arguments/data/config/disabled",
$meta,
true
);
}
}
}
return $meta;
}
If you use this you will get solution
<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool">
<arguments>
<argument name="modifiers" xsi:type="array">
<item name="name" xsi:type="array">
<item name="class" xsi:type="string">NamespaceModuleNamUiDataProviderProductFormModifierAttributes</item>
<item name="sortOrder" xsi:type="number">1000</item>
</item>
</argument>
</arguments>
</virtualType>
public function modifyMeta(array $meta)
{
// check to disable attributes on product new
if ($this->lumaData->getGeneralConfig('lockattributes') == 1) {
// attributes need to be disabled
$attributes = array();
} else {
$attributes = array();
}
if ($this->httpRequest->getActionName() == 'new' ) {
// code to make the attribute disable
foreach($attributes as $attribute){
$path = $this->arrayManager->findPath($attribute, $meta, null, 'children');
if ($path) {
$meta = $this->arrayManager->set(
"{$path}/arguments/data/config/disabled",
$meta,
true
);
}
}
}
return $meta;
}
If you use this you will get solution
answered May 9 '18 at 10:49
Sairam SigirisettySairam Sigirisetty
2616
2616
add a comment |
add a comment |
According to the official docs Modifier classes should be used when you need to add validations to display only certain fields for certain product types and also when static declaration is not applicable. Which I think is the case you are describing here.
https://devdocs.magento.com/guides/v2.3/howdoi/customize-modifier-class.html
add a comment |
According to the official docs Modifier classes should be used when you need to add validations to display only certain fields for certain product types and also when static declaration is not applicable. Which I think is the case you are describing here.
https://devdocs.magento.com/guides/v2.3/howdoi/customize-modifier-class.html
add a comment |
According to the official docs Modifier classes should be used when you need to add validations to display only certain fields for certain product types and also when static declaration is not applicable. Which I think is the case you are describing here.
https://devdocs.magento.com/guides/v2.3/howdoi/customize-modifier-class.html
According to the official docs Modifier classes should be used when you need to add validations to display only certain fields for certain product types and also when static declaration is not applicable. Which I think is the case you are describing here.
https://devdocs.magento.com/guides/v2.3/howdoi/customize-modifier-class.html
answered 10 mins ago
diazwatsondiazwatson
1,53011425
1,53011425
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%2f225057%2fdisabling-a-ui-component-field-while-add-new-product-in-magento-2%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