Add a custom attribute in grid customer magento 2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty{ margin-bottom:0;
}
up vote
3
down vote
favorite
I have created an attribute type: select but i can't display it in the grid customer.
the code of my customer_listing.xml
<column name="customer_status">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">select</item>
<item name="editor" xsi:type="string">select</item>
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item>
<item name="dataType" xsi:type="string">select</item>
<item name="label" xsi:type="string" translate="true">Customer Status</item>
<item name="sortOrder" xsi:type="number">190</item>
</item>
</argument>
</column>
the code of the UpgradeData.php
$attributeCode7 = "customer_status";
$customerSetup->addAttribute(Customer::ENTITY, $attributeCode7, [
'type' => 'varchar',
'label' => 'Customer Status',
'input' => 'select',
'source' => 'StackCustomerModelAttributeSourceCustomerStatus',
'required' => true,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => false,
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
]);
$attribute7 = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, $attributeCode7)
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer', 'customer_account_create', 'customer_account_edit']
]);
$attribute7->save();
also i created indexer.xml under etc of my module here is the code:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Indexer/etc/indexer.xsd">
<indexer id="customer_grid">
<fieldset name="customer">
<field name="customer_status" xsi:type="filterable" dataType="int"/>
</fieldset>
</indexer>
please help me and thanks in advance
magento2 customer-attribute customer-grid
add a comment |
up vote
3
down vote
favorite
I have created an attribute type: select but i can't display it in the grid customer.
the code of my customer_listing.xml
<column name="customer_status">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">select</item>
<item name="editor" xsi:type="string">select</item>
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item>
<item name="dataType" xsi:type="string">select</item>
<item name="label" xsi:type="string" translate="true">Customer Status</item>
<item name="sortOrder" xsi:type="number">190</item>
</item>
</argument>
</column>
the code of the UpgradeData.php
$attributeCode7 = "customer_status";
$customerSetup->addAttribute(Customer::ENTITY, $attributeCode7, [
'type' => 'varchar',
'label' => 'Customer Status',
'input' => 'select',
'source' => 'StackCustomerModelAttributeSourceCustomerStatus',
'required' => true,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => false,
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
]);
$attribute7 = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, $attributeCode7)
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer', 'customer_account_create', 'customer_account_edit']
]);
$attribute7->save();
also i created indexer.xml under etc of my module here is the code:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Indexer/etc/indexer.xsd">
<indexer id="customer_grid">
<fieldset name="customer">
<field name="customer_status" xsi:type="filterable" dataType="int"/>
</fieldset>
</indexer>
please help me and thanks in advance
magento2 customer-attribute customer-grid
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I have created an attribute type: select but i can't display it in the grid customer.
the code of my customer_listing.xml
<column name="customer_status">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">select</item>
<item name="editor" xsi:type="string">select</item>
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item>
<item name="dataType" xsi:type="string">select</item>
<item name="label" xsi:type="string" translate="true">Customer Status</item>
<item name="sortOrder" xsi:type="number">190</item>
</item>
</argument>
</column>
the code of the UpgradeData.php
$attributeCode7 = "customer_status";
$customerSetup->addAttribute(Customer::ENTITY, $attributeCode7, [
'type' => 'varchar',
'label' => 'Customer Status',
'input' => 'select',
'source' => 'StackCustomerModelAttributeSourceCustomerStatus',
'required' => true,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => false,
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
]);
$attribute7 = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, $attributeCode7)
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer', 'customer_account_create', 'customer_account_edit']
]);
$attribute7->save();
also i created indexer.xml under etc of my module here is the code:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Indexer/etc/indexer.xsd">
<indexer id="customer_grid">
<fieldset name="customer">
<field name="customer_status" xsi:type="filterable" dataType="int"/>
</fieldset>
</indexer>
please help me and thanks in advance
magento2 customer-attribute customer-grid
I have created an attribute type: select but i can't display it in the grid customer.
the code of my customer_listing.xml
<column name="customer_status">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">select</item>
<item name="editor" xsi:type="string">select</item>
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item>
<item name="dataType" xsi:type="string">select</item>
<item name="label" xsi:type="string" translate="true">Customer Status</item>
<item name="sortOrder" xsi:type="number">190</item>
</item>
</argument>
</column>
the code of the UpgradeData.php
$attributeCode7 = "customer_status";
$customerSetup->addAttribute(Customer::ENTITY, $attributeCode7, [
'type' => 'varchar',
'label' => 'Customer Status',
'input' => 'select',
'source' => 'StackCustomerModelAttributeSourceCustomerStatus',
'required' => true,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => false,
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
]);
$attribute7 = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, $attributeCode7)
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer', 'customer_account_create', 'customer_account_edit']
]);
$attribute7->save();
also i created indexer.xml under etc of my module here is the code:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Indexer/etc/indexer.xsd">
<indexer id="customer_grid">
<fieldset name="customer">
<field name="customer_status" xsi:type="filterable" dataType="int"/>
</fieldset>
</indexer>
please help me and thanks in advance
magento2 customer-attribute customer-grid
magento2 customer-attribute customer-grid
edited 2 days ago
Qaisar Satti
25.9k1255105
25.9k1255105
asked 2 days ago
Developper Magento
43010
43010
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
6
down vote
accepted
You don't need customer_listing.xml
or indexer.xml
to show customer attribute in gird. these line will do it for you
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
Just run the following command. This will show your column in grid.
php bin/magento indexer:reindex
Make sure Customer Grid index rebuilt Customer Grid index has been rebuilt successfully
New column of customer_status
will be created customer_grid_flat
table
thanks for your replay but i really put those two in the upgrade but nothing displayed
– Developper Magento
2 days ago
@DevelopperMagento did you run the command? make sure your you have entry in tableeav_attribute
and respectivelycustomer_eav_attribute
– Qaisar Satti
2 days ago
yes i have the entry in customer_entity_varchar and the attribute is displayed in eav_attribute and when i click on add new user in BO
– Developper Magento
2 days ago
2
@DevelopperMagento, Did you select to show your custom attribute collumn ??!! From all collumn list at customer Grid.
– Vivek
2 days ago
1
@Vivek forgot about that thanks for reminding me.
– Qaisar Satti
2 days ago
|
show 10 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
You don't need customer_listing.xml
or indexer.xml
to show customer attribute in gird. these line will do it for you
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
Just run the following command. This will show your column in grid.
php bin/magento indexer:reindex
Make sure Customer Grid index rebuilt Customer Grid index has been rebuilt successfully
New column of customer_status
will be created customer_grid_flat
table
thanks for your replay but i really put those two in the upgrade but nothing displayed
– Developper Magento
2 days ago
@DevelopperMagento did you run the command? make sure your you have entry in tableeav_attribute
and respectivelycustomer_eav_attribute
– Qaisar Satti
2 days ago
yes i have the entry in customer_entity_varchar and the attribute is displayed in eav_attribute and when i click on add new user in BO
– Developper Magento
2 days ago
2
@DevelopperMagento, Did you select to show your custom attribute collumn ??!! From all collumn list at customer Grid.
– Vivek
2 days ago
1
@Vivek forgot about that thanks for reminding me.
– Qaisar Satti
2 days ago
|
show 10 more comments
up vote
6
down vote
accepted
You don't need customer_listing.xml
or indexer.xml
to show customer attribute in gird. these line will do it for you
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
Just run the following command. This will show your column in grid.
php bin/magento indexer:reindex
Make sure Customer Grid index rebuilt Customer Grid index has been rebuilt successfully
New column of customer_status
will be created customer_grid_flat
table
thanks for your replay but i really put those two in the upgrade but nothing displayed
– Developper Magento
2 days ago
@DevelopperMagento did you run the command? make sure your you have entry in tableeav_attribute
and respectivelycustomer_eav_attribute
– Qaisar Satti
2 days ago
yes i have the entry in customer_entity_varchar and the attribute is displayed in eav_attribute and when i click on add new user in BO
– Developper Magento
2 days ago
2
@DevelopperMagento, Did you select to show your custom attribute collumn ??!! From all collumn list at customer Grid.
– Vivek
2 days ago
1
@Vivek forgot about that thanks for reminding me.
– Qaisar Satti
2 days ago
|
show 10 more comments
up vote
6
down vote
accepted
up vote
6
down vote
accepted
You don't need customer_listing.xml
or indexer.xml
to show customer attribute in gird. these line will do it for you
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
Just run the following command. This will show your column in grid.
php bin/magento indexer:reindex
Make sure Customer Grid index rebuilt Customer Grid index has been rebuilt successfully
New column of customer_status
will be created customer_grid_flat
table
You don't need customer_listing.xml
or indexer.xml
to show customer attribute in gird. these line will do it for you
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
Just run the following command. This will show your column in grid.
php bin/magento indexer:reindex
Make sure Customer Grid index rebuilt Customer Grid index has been rebuilt successfully
New column of customer_status
will be created customer_grid_flat
table
edited 2 days ago
Vivek
963324
963324
answered 2 days ago
Qaisar Satti
25.9k1255105
25.9k1255105
thanks for your replay but i really put those two in the upgrade but nothing displayed
– Developper Magento
2 days ago
@DevelopperMagento did you run the command? make sure your you have entry in tableeav_attribute
and respectivelycustomer_eav_attribute
– Qaisar Satti
2 days ago
yes i have the entry in customer_entity_varchar and the attribute is displayed in eav_attribute and when i click on add new user in BO
– Developper Magento
2 days ago
2
@DevelopperMagento, Did you select to show your custom attribute collumn ??!! From all collumn list at customer Grid.
– Vivek
2 days ago
1
@Vivek forgot about that thanks for reminding me.
– Qaisar Satti
2 days ago
|
show 10 more comments
thanks for your replay but i really put those two in the upgrade but nothing displayed
– Developper Magento
2 days ago
@DevelopperMagento did you run the command? make sure your you have entry in tableeav_attribute
and respectivelycustomer_eav_attribute
– Qaisar Satti
2 days ago
yes i have the entry in customer_entity_varchar and the attribute is displayed in eav_attribute and when i click on add new user in BO
– Developper Magento
2 days ago
2
@DevelopperMagento, Did you select to show your custom attribute collumn ??!! From all collumn list at customer Grid.
– Vivek
2 days ago
1
@Vivek forgot about that thanks for reminding me.
– Qaisar Satti
2 days ago
thanks for your replay but i really put those two in the upgrade but nothing displayed
– Developper Magento
2 days ago
thanks for your replay but i really put those two in the upgrade but nothing displayed
– Developper Magento
2 days ago
@DevelopperMagento did you run the command? make sure your you have entry in table
eav_attribute
and respectively customer_eav_attribute
– Qaisar Satti
2 days ago
@DevelopperMagento did you run the command? make sure your you have entry in table
eav_attribute
and respectively customer_eav_attribute
– Qaisar Satti
2 days ago
yes i have the entry in customer_entity_varchar and the attribute is displayed in eav_attribute and when i click on add new user in BO
– Developper Magento
2 days ago
yes i have the entry in customer_entity_varchar and the attribute is displayed in eav_attribute and when i click on add new user in BO
– Developper Magento
2 days ago
2
2
@DevelopperMagento, Did you select to show your custom attribute collumn ??!! From all collumn list at customer Grid.
– Vivek
2 days ago
@DevelopperMagento, Did you select to show your custom attribute collumn ??!! From all collumn list at customer Grid.
– Vivek
2 days ago
1
1
@Vivek forgot about that thanks for reminding me.
– Qaisar Satti
2 days ago
@Vivek forgot about that thanks for reminding me.
– Qaisar Satti
2 days ago
|
show 10 more comments
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%2f250944%2fadd-a-custom-attribute-in-grid-customer-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