Magento 2: Custom Customer Attributes Showing in Customer Grid but Not Admin Account
I'm currently on Magento 2.2.6 and I created a multiple select attribute as well as a yes/no attribute for customers in the admin page, however I'm not seeing them show up and not sure where I went wrong.
../Vendor/Module/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Vendor_Module" schema_version="0.0.1" setup_version="0.0.1" active="true"/>
</config>
Next I have my Setup/InstallData.php
which calls my Setup/CustomerSetup.php
file
InstallData.php
<?php
namespace VendorModuleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.0.0') < 0){
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$customerSetup = $objectManager->create('VendorModuleSetupCustomerSetup');
$customerSetup->installAttributes($customerSetup);
}
}
}
CustomerSetup.php
<?php
namespace VendorModuleSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup {
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
) {
$this->eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
}
public function installAttributes($customerSetup) {
$this->installCustomerAttributes($customerSetup);
$this->installCustomerAddressAttributes($customerSetup);
}
public function installCustomerAttributes($customerSetup) {
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding',
[
'label' => 'Branding',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'int',
'input' => 'boolean',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','0')->setData('used_in_forms', ['adminhtml_customer'])->save();
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding_type',
[
'label' => 'Branding Type',
'system' => 0,
'position' => 101,
'sort_order' =>101,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'VendorModuleModelEntityAttributeSourceOptions',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding_type')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer'])->save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
And then lastly, I have my Multi Select options here:
VendorModuleModelEntityAttributeSourceOptions.php
Options.php
<?php
namespace VendorModuleModelEntityAttributeSource;
use MagentoEavModelEntityAttributeSourceAbstractSource;
class Options extends AbstractSource
{
public function getAllOptions()
{
return [
'option1' => [
'label' => 'Custom Model Numbers',
'value' => 'custom_model_numbers'
],
'option2' => [
'label' => 'Camera Logo Stamp',
'value' => 'camera_stamp'
],
'option3' => [
'label' => 'Camera GUI',
'value' => 'camera_gui'
],
'option4' => [
'label' => 'Recorder Faceplate Decals',
'value' => 'recorder_decals'
],
'option5' => [
'label' => 'Recorder GUI',
'value' => 'recorder_gui'
],
'option6' => [
'label' => '2GIG Faceplate Stamp',
'value' => '2gig_faceplate'
]
];
}
}
After this I ran php bin/magento s:up
and php bin/magento s:s:d -f
and made sure to clear cache and reindex but nothing is showing up.
Any ideas?
EDIT, I should add that I can actually see my attributes in the admin customer grid, however they are not visible when I view the customer's account in the admin.
magento2 php attributes magento2.2.6 customer-attribute
add a comment |
I'm currently on Magento 2.2.6 and I created a multiple select attribute as well as a yes/no attribute for customers in the admin page, however I'm not seeing them show up and not sure where I went wrong.
../Vendor/Module/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Vendor_Module" schema_version="0.0.1" setup_version="0.0.1" active="true"/>
</config>
Next I have my Setup/InstallData.php
which calls my Setup/CustomerSetup.php
file
InstallData.php
<?php
namespace VendorModuleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.0.0') < 0){
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$customerSetup = $objectManager->create('VendorModuleSetupCustomerSetup');
$customerSetup->installAttributes($customerSetup);
}
}
}
CustomerSetup.php
<?php
namespace VendorModuleSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup {
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
) {
$this->eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
}
public function installAttributes($customerSetup) {
$this->installCustomerAttributes($customerSetup);
$this->installCustomerAddressAttributes($customerSetup);
}
public function installCustomerAttributes($customerSetup) {
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding',
[
'label' => 'Branding',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'int',
'input' => 'boolean',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','0')->setData('used_in_forms', ['adminhtml_customer'])->save();
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding_type',
[
'label' => 'Branding Type',
'system' => 0,
'position' => 101,
'sort_order' =>101,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'VendorModuleModelEntityAttributeSourceOptions',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding_type')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer'])->save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
And then lastly, I have my Multi Select options here:
VendorModuleModelEntityAttributeSourceOptions.php
Options.php
<?php
namespace VendorModuleModelEntityAttributeSource;
use MagentoEavModelEntityAttributeSourceAbstractSource;
class Options extends AbstractSource
{
public function getAllOptions()
{
return [
'option1' => [
'label' => 'Custom Model Numbers',
'value' => 'custom_model_numbers'
],
'option2' => [
'label' => 'Camera Logo Stamp',
'value' => 'camera_stamp'
],
'option3' => [
'label' => 'Camera GUI',
'value' => 'camera_gui'
],
'option4' => [
'label' => 'Recorder Faceplate Decals',
'value' => 'recorder_decals'
],
'option5' => [
'label' => 'Recorder GUI',
'value' => 'recorder_gui'
],
'option6' => [
'label' => '2GIG Faceplate Stamp',
'value' => '2gig_faceplate'
]
];
}
}
After this I ran php bin/magento s:up
and php bin/magento s:s:d -f
and made sure to clear cache and reindex but nothing is showing up.
Any ideas?
EDIT, I should add that I can actually see my attributes in the admin customer grid, however they are not visible when I view the customer's account in the admin.
magento2 php attributes magento2.2.6 customer-attribute
are you able to see those attribute in admin ?
– Pawan
Dec 14 '18 at 17:46
I can see them in the admin customer grid, however when I click into the customer I do not see them anywhere
– AJ47
Dec 14 '18 at 17:48
add a comment |
I'm currently on Magento 2.2.6 and I created a multiple select attribute as well as a yes/no attribute for customers in the admin page, however I'm not seeing them show up and not sure where I went wrong.
../Vendor/Module/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Vendor_Module" schema_version="0.0.1" setup_version="0.0.1" active="true"/>
</config>
Next I have my Setup/InstallData.php
which calls my Setup/CustomerSetup.php
file
InstallData.php
<?php
namespace VendorModuleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.0.0') < 0){
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$customerSetup = $objectManager->create('VendorModuleSetupCustomerSetup');
$customerSetup->installAttributes($customerSetup);
}
}
}
CustomerSetup.php
<?php
namespace VendorModuleSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup {
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
) {
$this->eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
}
public function installAttributes($customerSetup) {
$this->installCustomerAttributes($customerSetup);
$this->installCustomerAddressAttributes($customerSetup);
}
public function installCustomerAttributes($customerSetup) {
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding',
[
'label' => 'Branding',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'int',
'input' => 'boolean',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','0')->setData('used_in_forms', ['adminhtml_customer'])->save();
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding_type',
[
'label' => 'Branding Type',
'system' => 0,
'position' => 101,
'sort_order' =>101,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'VendorModuleModelEntityAttributeSourceOptions',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding_type')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer'])->save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
And then lastly, I have my Multi Select options here:
VendorModuleModelEntityAttributeSourceOptions.php
Options.php
<?php
namespace VendorModuleModelEntityAttributeSource;
use MagentoEavModelEntityAttributeSourceAbstractSource;
class Options extends AbstractSource
{
public function getAllOptions()
{
return [
'option1' => [
'label' => 'Custom Model Numbers',
'value' => 'custom_model_numbers'
],
'option2' => [
'label' => 'Camera Logo Stamp',
'value' => 'camera_stamp'
],
'option3' => [
'label' => 'Camera GUI',
'value' => 'camera_gui'
],
'option4' => [
'label' => 'Recorder Faceplate Decals',
'value' => 'recorder_decals'
],
'option5' => [
'label' => 'Recorder GUI',
'value' => 'recorder_gui'
],
'option6' => [
'label' => '2GIG Faceplate Stamp',
'value' => '2gig_faceplate'
]
];
}
}
After this I ran php bin/magento s:up
and php bin/magento s:s:d -f
and made sure to clear cache and reindex but nothing is showing up.
Any ideas?
EDIT, I should add that I can actually see my attributes in the admin customer grid, however they are not visible when I view the customer's account in the admin.
magento2 php attributes magento2.2.6 customer-attribute
I'm currently on Magento 2.2.6 and I created a multiple select attribute as well as a yes/no attribute for customers in the admin page, however I'm not seeing them show up and not sure where I went wrong.
../Vendor/Module/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Vendor_Module" schema_version="0.0.1" setup_version="0.0.1" active="true"/>
</config>
Next I have my Setup/InstallData.php
which calls my Setup/CustomerSetup.php
file
InstallData.php
<?php
namespace VendorModuleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.0.0') < 0){
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$customerSetup = $objectManager->create('VendorModuleSetupCustomerSetup');
$customerSetup->installAttributes($customerSetup);
}
}
}
CustomerSetup.php
<?php
namespace VendorModuleSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup {
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
) {
$this->eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
}
public function installAttributes($customerSetup) {
$this->installCustomerAttributes($customerSetup);
$this->installCustomerAddressAttributes($customerSetup);
}
public function installCustomerAttributes($customerSetup) {
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding',
[
'label' => 'Branding',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'int',
'input' => 'boolean',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','0')->setData('used_in_forms', ['adminhtml_customer'])->save();
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding_type',
[
'label' => 'Branding Type',
'system' => 0,
'position' => 101,
'sort_order' =>101,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'VendorModuleModelEntityAttributeSourceOptions',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding_type')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer'])->save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
And then lastly, I have my Multi Select options here:
VendorModuleModelEntityAttributeSourceOptions.php
Options.php
<?php
namespace VendorModuleModelEntityAttributeSource;
use MagentoEavModelEntityAttributeSourceAbstractSource;
class Options extends AbstractSource
{
public function getAllOptions()
{
return [
'option1' => [
'label' => 'Custom Model Numbers',
'value' => 'custom_model_numbers'
],
'option2' => [
'label' => 'Camera Logo Stamp',
'value' => 'camera_stamp'
],
'option3' => [
'label' => 'Camera GUI',
'value' => 'camera_gui'
],
'option4' => [
'label' => 'Recorder Faceplate Decals',
'value' => 'recorder_decals'
],
'option5' => [
'label' => 'Recorder GUI',
'value' => 'recorder_gui'
],
'option6' => [
'label' => '2GIG Faceplate Stamp',
'value' => '2gig_faceplate'
]
];
}
}
After this I ran php bin/magento s:up
and php bin/magento s:s:d -f
and made sure to clear cache and reindex but nothing is showing up.
Any ideas?
EDIT, I should add that I can actually see my attributes in the admin customer grid, however they are not visible when I view the customer's account in the admin.
magento2 php attributes magento2.2.6 customer-attribute
magento2 php attributes magento2.2.6 customer-attribute
edited Dec 14 '18 at 17:55
AJ47
asked Dec 14 '18 at 17:34
AJ47AJ47
186113
186113
are you able to see those attribute in admin ?
– Pawan
Dec 14 '18 at 17:46
I can see them in the admin customer grid, however when I click into the customer I do not see them anywhere
– AJ47
Dec 14 '18 at 17:48
add a comment |
are you able to see those attribute in admin ?
– Pawan
Dec 14 '18 at 17:46
I can see them in the admin customer grid, however when I click into the customer I do not see them anywhere
– AJ47
Dec 14 '18 at 17:48
are you able to see those attribute in admin ?
– Pawan
Dec 14 '18 at 17:46
are you able to see those attribute in admin ?
– Pawan
Dec 14 '18 at 17:46
I can see them in the admin customer grid, however when I click into the customer I do not see them anywhere
– AJ47
Dec 14 '18 at 17:48
I can see them in the admin customer grid, however when I click into the customer I do not see them anywhere
– AJ47
Dec 14 '18 at 17:48
add a comment |
2 Answers
2
active
oldest
votes
Used_in_forms are of these types you can use forms key according to your need
['adminhtml_checkout'
,'adminhtml_customer'
,'adminhtml_customer_address'
,'customer_account_edit'
,'customer_address_edit'
,'customer_register_address'
, 'customer_account_create'
]
In your case, just set customer_account_edit
where you already set adminhtml_customer
.
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')
->setData('is_user_defined', 0)
->setData('is_required', 0)
->setData('default_value', '0')
->setData('used_in_forms', ['adminhtml_customer', 'customer_account_edit'])
->save();
CustomerSetup.php
namespace VendorModuleSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup {
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
) {
$this->eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
}
public function installAttributes($customerSetup) {
$this->installCustomerAttributes($customerSetup);
$this->installCustomerAddressAttributes($customerSetup);
}
public function installCustomerAttributes($customerSetup) {
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding',
[
'label' => 'Branding',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'int',
'input' => 'boolean',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','0')->setData('used_in_forms', ['adminhtml_customer', 'customer_account_edit'])->save();
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding_type',
[
'label' => 'Branding Type',
'system' => 0,
'position' => 101,
'sort_order' =>101,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'VendorModuleModelEntityAttributeSourceOptions',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding_type')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer'])->save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
Mind explaining what issue you found? I edited my original question -- I'm actually able to see my attributes in the admin customer grid, but not when I click into a customer's account.
– AJ47
Dec 14 '18 at 17:56
Find my updated answer.
– Supravat M
Dec 14 '18 at 18:03
Thanks for your reply, I actually have that line in my code. I want these only visible in the admin account area and not on the front-end. However they are not showing my admin account area.
– AJ47
Dec 14 '18 at 18:08
You did not setcustomer_account_edit
inused_in_forms
. It will display created attribute in admin area.
– Supravat M
Dec 14 '18 at 18:23
Thanks! I tried updating that line.. I removed Vender_Module from the setup_module in the db and re-ranbin/magento s:up
cleared cache and all that but still not showing in the admin customer pages
– AJ47
Dec 14 '18 at 21:47
|
show 1 more comment
ended up solving this by just needing to set 'visible' => false
to true
on my attribute.
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%2f253713%2fmagento-2-custom-customer-attributes-showing-in-customer-grid-but-not-admin-acc%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
Used_in_forms are of these types you can use forms key according to your need
['adminhtml_checkout'
,'adminhtml_customer'
,'adminhtml_customer_address'
,'customer_account_edit'
,'customer_address_edit'
,'customer_register_address'
, 'customer_account_create'
]
In your case, just set customer_account_edit
where you already set adminhtml_customer
.
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')
->setData('is_user_defined', 0)
->setData('is_required', 0)
->setData('default_value', '0')
->setData('used_in_forms', ['adminhtml_customer', 'customer_account_edit'])
->save();
CustomerSetup.php
namespace VendorModuleSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup {
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
) {
$this->eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
}
public function installAttributes($customerSetup) {
$this->installCustomerAttributes($customerSetup);
$this->installCustomerAddressAttributes($customerSetup);
}
public function installCustomerAttributes($customerSetup) {
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding',
[
'label' => 'Branding',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'int',
'input' => 'boolean',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','0')->setData('used_in_forms', ['adminhtml_customer', 'customer_account_edit'])->save();
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding_type',
[
'label' => 'Branding Type',
'system' => 0,
'position' => 101,
'sort_order' =>101,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'VendorModuleModelEntityAttributeSourceOptions',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding_type')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer'])->save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
Mind explaining what issue you found? I edited my original question -- I'm actually able to see my attributes in the admin customer grid, but not when I click into a customer's account.
– AJ47
Dec 14 '18 at 17:56
Find my updated answer.
– Supravat M
Dec 14 '18 at 18:03
Thanks for your reply, I actually have that line in my code. I want these only visible in the admin account area and not on the front-end. However they are not showing my admin account area.
– AJ47
Dec 14 '18 at 18:08
You did not setcustomer_account_edit
inused_in_forms
. It will display created attribute in admin area.
– Supravat M
Dec 14 '18 at 18:23
Thanks! I tried updating that line.. I removed Vender_Module from the setup_module in the db and re-ranbin/magento s:up
cleared cache and all that but still not showing in the admin customer pages
– AJ47
Dec 14 '18 at 21:47
|
show 1 more comment
Used_in_forms are of these types you can use forms key according to your need
['adminhtml_checkout'
,'adminhtml_customer'
,'adminhtml_customer_address'
,'customer_account_edit'
,'customer_address_edit'
,'customer_register_address'
, 'customer_account_create'
]
In your case, just set customer_account_edit
where you already set adminhtml_customer
.
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')
->setData('is_user_defined', 0)
->setData('is_required', 0)
->setData('default_value', '0')
->setData('used_in_forms', ['adminhtml_customer', 'customer_account_edit'])
->save();
CustomerSetup.php
namespace VendorModuleSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup {
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
) {
$this->eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
}
public function installAttributes($customerSetup) {
$this->installCustomerAttributes($customerSetup);
$this->installCustomerAddressAttributes($customerSetup);
}
public function installCustomerAttributes($customerSetup) {
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding',
[
'label' => 'Branding',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'int',
'input' => 'boolean',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','0')->setData('used_in_forms', ['adminhtml_customer', 'customer_account_edit'])->save();
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding_type',
[
'label' => 'Branding Type',
'system' => 0,
'position' => 101,
'sort_order' =>101,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'VendorModuleModelEntityAttributeSourceOptions',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding_type')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer'])->save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
Mind explaining what issue you found? I edited my original question -- I'm actually able to see my attributes in the admin customer grid, but not when I click into a customer's account.
– AJ47
Dec 14 '18 at 17:56
Find my updated answer.
– Supravat M
Dec 14 '18 at 18:03
Thanks for your reply, I actually have that line in my code. I want these only visible in the admin account area and not on the front-end. However they are not showing my admin account area.
– AJ47
Dec 14 '18 at 18:08
You did not setcustomer_account_edit
inused_in_forms
. It will display created attribute in admin area.
– Supravat M
Dec 14 '18 at 18:23
Thanks! I tried updating that line.. I removed Vender_Module from the setup_module in the db and re-ranbin/magento s:up
cleared cache and all that but still not showing in the admin customer pages
– AJ47
Dec 14 '18 at 21:47
|
show 1 more comment
Used_in_forms are of these types you can use forms key according to your need
['adminhtml_checkout'
,'adminhtml_customer'
,'adminhtml_customer_address'
,'customer_account_edit'
,'customer_address_edit'
,'customer_register_address'
, 'customer_account_create'
]
In your case, just set customer_account_edit
where you already set adminhtml_customer
.
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')
->setData('is_user_defined', 0)
->setData('is_required', 0)
->setData('default_value', '0')
->setData('used_in_forms', ['adminhtml_customer', 'customer_account_edit'])
->save();
CustomerSetup.php
namespace VendorModuleSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup {
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
) {
$this->eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
}
public function installAttributes($customerSetup) {
$this->installCustomerAttributes($customerSetup);
$this->installCustomerAddressAttributes($customerSetup);
}
public function installCustomerAttributes($customerSetup) {
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding',
[
'label' => 'Branding',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'int',
'input' => 'boolean',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','0')->setData('used_in_forms', ['adminhtml_customer', 'customer_account_edit'])->save();
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding_type',
[
'label' => 'Branding Type',
'system' => 0,
'position' => 101,
'sort_order' =>101,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'VendorModuleModelEntityAttributeSourceOptions',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding_type')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer'])->save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
Used_in_forms are of these types you can use forms key according to your need
['adminhtml_checkout'
,'adminhtml_customer'
,'adminhtml_customer_address'
,'customer_account_edit'
,'customer_address_edit'
,'customer_register_address'
, 'customer_account_create'
]
In your case, just set customer_account_edit
where you already set adminhtml_customer
.
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')
->setData('is_user_defined', 0)
->setData('is_required', 0)
->setData('default_value', '0')
->setData('used_in_forms', ['adminhtml_customer', 'customer_account_edit'])
->save();
CustomerSetup.php
namespace VendorModuleSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup {
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
) {
$this->eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
}
public function installAttributes($customerSetup) {
$this->installCustomerAttributes($customerSetup);
$this->installCustomerAddressAttributes($customerSetup);
}
public function installCustomerAttributes($customerSetup) {
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding',
[
'label' => 'Branding',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'int',
'input' => 'boolean',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','0')->setData('used_in_forms', ['adminhtml_customer', 'customer_account_edit'])->save();
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY,
'branding_type',
[
'label' => 'Branding Type',
'system' => 0,
'position' => 101,
'sort_order' =>101,
'visible' => false,
'note' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'VendorModuleModelEntityAttributeSourceOptions',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup->getEavConfig()->getAttribute('customer', 'branding_type')->setData('is_user_defined',0)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer'])->save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
edited Dec 14 '18 at 18:32
answered Dec 14 '18 at 17:52
Supravat MSupravat M
1,14611626
1,14611626
Mind explaining what issue you found? I edited my original question -- I'm actually able to see my attributes in the admin customer grid, but not when I click into a customer's account.
– AJ47
Dec 14 '18 at 17:56
Find my updated answer.
– Supravat M
Dec 14 '18 at 18:03
Thanks for your reply, I actually have that line in my code. I want these only visible in the admin account area and not on the front-end. However they are not showing my admin account area.
– AJ47
Dec 14 '18 at 18:08
You did not setcustomer_account_edit
inused_in_forms
. It will display created attribute in admin area.
– Supravat M
Dec 14 '18 at 18:23
Thanks! I tried updating that line.. I removed Vender_Module from the setup_module in the db and re-ranbin/magento s:up
cleared cache and all that but still not showing in the admin customer pages
– AJ47
Dec 14 '18 at 21:47
|
show 1 more comment
Mind explaining what issue you found? I edited my original question -- I'm actually able to see my attributes in the admin customer grid, but not when I click into a customer's account.
– AJ47
Dec 14 '18 at 17:56
Find my updated answer.
– Supravat M
Dec 14 '18 at 18:03
Thanks for your reply, I actually have that line in my code. I want these only visible in the admin account area and not on the front-end. However they are not showing my admin account area.
– AJ47
Dec 14 '18 at 18:08
You did not setcustomer_account_edit
inused_in_forms
. It will display created attribute in admin area.
– Supravat M
Dec 14 '18 at 18:23
Thanks! I tried updating that line.. I removed Vender_Module from the setup_module in the db and re-ranbin/magento s:up
cleared cache and all that but still not showing in the admin customer pages
– AJ47
Dec 14 '18 at 21:47
Mind explaining what issue you found? I edited my original question -- I'm actually able to see my attributes in the admin customer grid, but not when I click into a customer's account.
– AJ47
Dec 14 '18 at 17:56
Mind explaining what issue you found? I edited my original question -- I'm actually able to see my attributes in the admin customer grid, but not when I click into a customer's account.
– AJ47
Dec 14 '18 at 17:56
Find my updated answer.
– Supravat M
Dec 14 '18 at 18:03
Find my updated answer.
– Supravat M
Dec 14 '18 at 18:03
Thanks for your reply, I actually have that line in my code. I want these only visible in the admin account area and not on the front-end. However they are not showing my admin account area.
– AJ47
Dec 14 '18 at 18:08
Thanks for your reply, I actually have that line in my code. I want these only visible in the admin account area and not on the front-end. However they are not showing my admin account area.
– AJ47
Dec 14 '18 at 18:08
You did not set
customer_account_edit
in used_in_forms
. It will display created attribute in admin area.– Supravat M
Dec 14 '18 at 18:23
You did not set
customer_account_edit
in used_in_forms
. It will display created attribute in admin area.– Supravat M
Dec 14 '18 at 18:23
Thanks! I tried updating that line.. I removed Vender_Module from the setup_module in the db and re-ran
bin/magento s:up
cleared cache and all that but still not showing in the admin customer pages– AJ47
Dec 14 '18 at 21:47
Thanks! I tried updating that line.. I removed Vender_Module from the setup_module in the db and re-ran
bin/magento s:up
cleared cache and all that but still not showing in the admin customer pages– AJ47
Dec 14 '18 at 21:47
|
show 1 more comment
ended up solving this by just needing to set 'visible' => false
to true
on my attribute.
add a comment |
ended up solving this by just needing to set 'visible' => false
to true
on my attribute.
add a comment |
ended up solving this by just needing to set 'visible' => false
to true
on my attribute.
ended up solving this by just needing to set 'visible' => false
to true
on my attribute.
answered 3 mins ago
AJ47AJ47
186113
186113
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%2f253713%2fmagento-2-custom-customer-attributes-showing-in-customer-grid-but-not-admin-acc%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
are you able to see those attribute in admin ?
– Pawan
Dec 14 '18 at 17:46
I can see them in the admin customer grid, however when I click into the customer I do not see them anywhere
– AJ47
Dec 14 '18 at 17:48