Magento 2 unable to save category custom attribute valueCreate a sortable and filterable custom attribute to stand-alone entityHow can i rewrite TierPrice Block in Magento2Magento2: How to add pre defined data (installData.php) for Custom Modulemain.CRITICAL: Plugin class doesn't existI have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridMagento 2.2.1: Add Custom Upload file attribute in CheckoutMagento offline custom Payment method with drop down listMagento 2 How to upgrade existing custom customer address attribute?Magento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?How to change “input file” storage location in customer account edit form
2 Managed Packages in 1 Dev Org
Is it a bad idea to have a pen name with only an initial for a surname?
How can a flywheel makes engine runs smoothly?
What do I put on my resume to make the company i'm applying to think i'm mature enough to handle a job?
On George Box, Galit Shmueli and the scientific method?
How to make a villain when your PCs are villains?
Is there any effect in D&D 5e that cannot be undone?
How to write a nice frame challenge?
Why is Skinner so awkward in Hot Fuzz?
Huge Heap Table and table compression on SQL Server 2016
How can this shape perfectly cover a cube?
Is the infant mortality rate among African-American babies in Youngstown, Ohio greater than that of babies in Iran?
Is swap gate equivalent to just exchanging the wire of the two qubits?
How can Caller ID be faked?
Using roof rails to set up hammock
What is this plant I saw for sale at a Romanian farmer's market?
I have found ports on my Samsung smart tv running a display service. What can I do with it?
Leveraging cash for buying car
TiKZ won't graph 1/sqrt(x)
How to search for Android apps without ads?
...and then she held the gun
Fill the maze with a wall-following Snake until it gets stuck
Lead the way to this Literary Knight to its final “DESTINATION”
The instant an accelerating object has zero speed, is it speeding up, slowing down, or neither?
Magento 2 unable to save category custom attribute value
Create a sortable and filterable custom attribute to stand-alone entityHow can i rewrite TierPrice Block in Magento2Magento2: How to add pre defined data (installData.php) for Custom Modulemain.CRITICAL: Plugin class doesn't existI have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridMagento 2.2.1: Add Custom Upload file attribute in CheckoutMagento offline custom Payment method with drop down listMagento 2 How to upgrade existing custom customer address attribute?Magento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?How to change “input file” storage location in customer account edit form
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have created below modules to create custom category attributes, but values are not getting saved from admin . below is my module code please with what i am missing
1: Yereone/NewCategoryAttribute/Setup/InstallData.php
namespace YereoneCustomCategoryAttributeSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoCatalogSetupCategorySetupFactory;
class InstallData implements InstallDataInterface
/**
* @var EavSetupFactory
*/
private $eavSetupFactory;
/**
* @param EavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* Installs data for a module
*
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
* @return void
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$setup->startSetup();
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelCategory::ENTITY,
'custom_category_attr',
[
'type' => 'varchar',
'label' => 'Yereone Custom Category Attribute',
'input' => 'text',
'sort_order' => '',
'source' => '',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => null,
'group' => '',
'backend' => ''
]
);
$setup->endSetup();
2: Yereone/NewCategoryAttribute/view/adminhtml/ui_component/category_form.xml
<?xml version="1.0"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="yereone_settings">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Yereone</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="custom_category_attr">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="label" xsi:type="string" translate="true">Yereone Custom Category Attribute</item>
<item name="sortOrder" xsi:type="number">150</item>
<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
</item>
</argument>
</field>
</fieldset>
</form>
magento2 category attributes magento2.3.1
add a comment |
I have created below modules to create custom category attributes, but values are not getting saved from admin . below is my module code please with what i am missing
1: Yereone/NewCategoryAttribute/Setup/InstallData.php
namespace YereoneCustomCategoryAttributeSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoCatalogSetupCategorySetupFactory;
class InstallData implements InstallDataInterface
/**
* @var EavSetupFactory
*/
private $eavSetupFactory;
/**
* @param EavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* Installs data for a module
*
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
* @return void
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$setup->startSetup();
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelCategory::ENTITY,
'custom_category_attr',
[
'type' => 'varchar',
'label' => 'Yereone Custom Category Attribute',
'input' => 'text',
'sort_order' => '',
'source' => '',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => null,
'group' => '',
'backend' => ''
]
);
$setup->endSetup();
2: Yereone/NewCategoryAttribute/view/adminhtml/ui_component/category_form.xml
<?xml version="1.0"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="yereone_settings">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Yereone</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="custom_category_attr">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="label" xsi:type="string" translate="true">Yereone Custom Category Attribute</item>
<item name="sortOrder" xsi:type="number">150</item>
<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
</item>
</argument>
</field>
</fieldset>
</form>
magento2 category attributes magento2.3.1
add a comment |
I have created below modules to create custom category attributes, but values are not getting saved from admin . below is my module code please with what i am missing
1: Yereone/NewCategoryAttribute/Setup/InstallData.php
namespace YereoneCustomCategoryAttributeSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoCatalogSetupCategorySetupFactory;
class InstallData implements InstallDataInterface
/**
* @var EavSetupFactory
*/
private $eavSetupFactory;
/**
* @param EavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* Installs data for a module
*
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
* @return void
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$setup->startSetup();
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelCategory::ENTITY,
'custom_category_attr',
[
'type' => 'varchar',
'label' => 'Yereone Custom Category Attribute',
'input' => 'text',
'sort_order' => '',
'source' => '',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => null,
'group' => '',
'backend' => ''
]
);
$setup->endSetup();
2: Yereone/NewCategoryAttribute/view/adminhtml/ui_component/category_form.xml
<?xml version="1.0"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="yereone_settings">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Yereone</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="custom_category_attr">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="label" xsi:type="string" translate="true">Yereone Custom Category Attribute</item>
<item name="sortOrder" xsi:type="number">150</item>
<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
</item>
</argument>
</field>
</fieldset>
</form>
magento2 category attributes magento2.3.1
I have created below modules to create custom category attributes, but values are not getting saved from admin . below is my module code please with what i am missing
1: Yereone/NewCategoryAttribute/Setup/InstallData.php
namespace YereoneCustomCategoryAttributeSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoCatalogSetupCategorySetupFactory;
class InstallData implements InstallDataInterface
/**
* @var EavSetupFactory
*/
private $eavSetupFactory;
/**
* @param EavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* Installs data for a module
*
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
* @return void
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$setup->startSetup();
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelCategory::ENTITY,
'custom_category_attr',
[
'type' => 'varchar',
'label' => 'Yereone Custom Category Attribute',
'input' => 'text',
'sort_order' => '',
'source' => '',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => null,
'group' => '',
'backend' => ''
]
);
$setup->endSetup();
2: Yereone/NewCategoryAttribute/view/adminhtml/ui_component/category_form.xml
<?xml version="1.0"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="yereone_settings">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Yereone</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="custom_category_attr">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="label" xsi:type="string" translate="true">Yereone Custom Category Attribute</item>
<item name="sortOrder" xsi:type="number">150</item>
<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
</item>
</argument>
</field>
</fieldset>
</form>
magento2 category attributes magento2.3.1
magento2 category attributes magento2.3.1
asked Jun 9 at 7:28
user1799722user1799722
44511646
44511646
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You don't you need to define scopeLabel
(<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
) at here.
<fieldset name="content" sortOrder="100">
<settings>
<collapsible>true</collapsible>
<label translate="true">Yereone</label>
</settings>
<field name="custom_category_attr" sortOrder="30" formElement="input">
<settings>
<dataType>string</dataType>
<label translate="true">Yereone Custom Category Attribute</label>
</settings>
</field>
</fieldset>
still it does not work
– user1799722
Jun 9 at 11:01
add a comment |
I'd do something like
view/adminhtml/ui_component/category_form.xml
<?xml version="1.0" ?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="general">
<field name="test">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="required" xsi:type="boolean">false</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="sortOrder" xsi:type="number">500</item>
<item name="dataType" xsi:type="string">string</item>
<item name="formElement" xsi:type="string">input</item>
<item name="label" translate="true" xsi:type="string">Test</item>
</item>
</argument>
</field>
</fieldset>
</form>
Setup/InstallData.php
namespace XigenCategorySetup;
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(
MagentoCatalogModelCategory::ENTITY,
'test',
[
'type' => 'varchar',
'label' => 'Test',
'input' => 'text',
'sort_order' => 500,
'source' => '',
'global' => 1,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => null,
'group' => 'General Information',
'backend' => ''
]
);
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%2f277719%2fmagento-2-unable-to-save-category-custom-attribute-value%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 don't you need to define scopeLabel
(<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
) at here.
<fieldset name="content" sortOrder="100">
<settings>
<collapsible>true</collapsible>
<label translate="true">Yereone</label>
</settings>
<field name="custom_category_attr" sortOrder="30" formElement="input">
<settings>
<dataType>string</dataType>
<label translate="true">Yereone Custom Category Attribute</label>
</settings>
</field>
</fieldset>
still it does not work
– user1799722
Jun 9 at 11:01
add a comment |
You don't you need to define scopeLabel
(<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
) at here.
<fieldset name="content" sortOrder="100">
<settings>
<collapsible>true</collapsible>
<label translate="true">Yereone</label>
</settings>
<field name="custom_category_attr" sortOrder="30" formElement="input">
<settings>
<dataType>string</dataType>
<label translate="true">Yereone Custom Category Attribute</label>
</settings>
</field>
</fieldset>
still it does not work
– user1799722
Jun 9 at 11:01
add a comment |
You don't you need to define scopeLabel
(<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
) at here.
<fieldset name="content" sortOrder="100">
<settings>
<collapsible>true</collapsible>
<label translate="true">Yereone</label>
</settings>
<field name="custom_category_attr" sortOrder="30" formElement="input">
<settings>
<dataType>string</dataType>
<label translate="true">Yereone Custom Category Attribute</label>
</settings>
</field>
</fieldset>
You don't you need to define scopeLabel
(<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
) at here.
<fieldset name="content" sortOrder="100">
<settings>
<collapsible>true</collapsible>
<label translate="true">Yereone</label>
</settings>
<field name="custom_category_attr" sortOrder="30" formElement="input">
<settings>
<dataType>string</dataType>
<label translate="true">Yereone Custom Category Attribute</label>
</settings>
</field>
</fieldset>
answered Jun 9 at 8:08
Amit Bera♦Amit Bera
61.3k1683182
61.3k1683182
still it does not work
– user1799722
Jun 9 at 11:01
add a comment |
still it does not work
– user1799722
Jun 9 at 11:01
still it does not work
– user1799722
Jun 9 at 11:01
still it does not work
– user1799722
Jun 9 at 11:01
add a comment |
I'd do something like
view/adminhtml/ui_component/category_form.xml
<?xml version="1.0" ?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="general">
<field name="test">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="required" xsi:type="boolean">false</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="sortOrder" xsi:type="number">500</item>
<item name="dataType" xsi:type="string">string</item>
<item name="formElement" xsi:type="string">input</item>
<item name="label" translate="true" xsi:type="string">Test</item>
</item>
</argument>
</field>
</fieldset>
</form>
Setup/InstallData.php
namespace XigenCategorySetup;
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(
MagentoCatalogModelCategory::ENTITY,
'test',
[
'type' => 'varchar',
'label' => 'Test',
'input' => 'text',
'sort_order' => 500,
'source' => '',
'global' => 1,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => null,
'group' => 'General Information',
'backend' => ''
]
);
add a comment |
I'd do something like
view/adminhtml/ui_component/category_form.xml
<?xml version="1.0" ?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="general">
<field name="test">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="required" xsi:type="boolean">false</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="sortOrder" xsi:type="number">500</item>
<item name="dataType" xsi:type="string">string</item>
<item name="formElement" xsi:type="string">input</item>
<item name="label" translate="true" xsi:type="string">Test</item>
</item>
</argument>
</field>
</fieldset>
</form>
Setup/InstallData.php
namespace XigenCategorySetup;
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(
MagentoCatalogModelCategory::ENTITY,
'test',
[
'type' => 'varchar',
'label' => 'Test',
'input' => 'text',
'sort_order' => 500,
'source' => '',
'global' => 1,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => null,
'group' => 'General Information',
'backend' => ''
]
);
add a comment |
I'd do something like
view/adminhtml/ui_component/category_form.xml
<?xml version="1.0" ?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="general">
<field name="test">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="required" xsi:type="boolean">false</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="sortOrder" xsi:type="number">500</item>
<item name="dataType" xsi:type="string">string</item>
<item name="formElement" xsi:type="string">input</item>
<item name="label" translate="true" xsi:type="string">Test</item>
</item>
</argument>
</field>
</fieldset>
</form>
Setup/InstallData.php
namespace XigenCategorySetup;
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(
MagentoCatalogModelCategory::ENTITY,
'test',
[
'type' => 'varchar',
'label' => 'Test',
'input' => 'text',
'sort_order' => 500,
'source' => '',
'global' => 1,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => null,
'group' => 'General Information',
'backend' => ''
]
);
I'd do something like
view/adminhtml/ui_component/category_form.xml
<?xml version="1.0" ?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="general">
<field name="test">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="required" xsi:type="boolean">false</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
<item name="sortOrder" xsi:type="number">500</item>
<item name="dataType" xsi:type="string">string</item>
<item name="formElement" xsi:type="string">input</item>
<item name="label" translate="true" xsi:type="string">Test</item>
</item>
</argument>
</field>
</fieldset>
</form>
Setup/InstallData.php
namespace XigenCategorySetup;
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(
MagentoCatalogModelCategory::ENTITY,
'test',
[
'type' => 'varchar',
'label' => 'Test',
'input' => 'text',
'sort_order' => 500,
'source' => '',
'global' => 1,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => null,
'group' => 'General Information',
'backend' => ''
]
);
edited Jun 9 at 12:52
answered Jun 9 at 12:38
Dominic XigenDominic Xigen
1,6731311
1,6731311
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%2f277719%2fmagento-2-unable-to-save-category-custom-attribute-value%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