Magento 2 customer_grid indexer error after creating new custom customer address attributemagento 2 - How to add new column to table customer_grid_flatCustomer export not working after creating custom attributes in magento 2.2.5Magento Indexer Not Adding Attribute to flat table in custom attributeMagento2 customer/address/newError in creating custom customer attribute in magento 2Error when creating new widgetMagento 2 Reindex failed on customer gridMagento 2 : After Data Migration(Indexer issue)Magento 2, Custom Customer Address Attribute update issueMagento 2 How to upgrade existing custom customer address attribute?Magento2 - New customer address attribute won't save to databaseError after creating boolean attribute magento2
Is it possible to map the firing of neurons in the human brain so as to stimulate artificial memories in someone else?
files created then deleted at every second in tmp directory
Do Iron Man suits sport waste management systems?
Standard deduction V. mortgage interest deduction - is it basically only for the rich?
How badly should I try to prevent a user from XSSing themselves?
Avoiding the "not like other girls" trope?
Forgetting the musical notes while performing in concert
How to coordinate airplane tickets?
Why is the sentence "Das ist eine Nase" correct?
Are British MPs missing the point, with these 'Indicative Votes'?
Machine learning testing data
OP Amp not amplifying audio signal
How to remove border from elements in the last row?
Can compressed videos be decoded back to their uncompresed original format?
How do conventional missiles fly?
Send out email when Apex Queueable fails and test it
Should I tell management that I intend to leave due to bad software development practices?
Processor speed limited at 0.4 Ghz
Does Dispel Magic work on Tiny Hut?
How can a day be of 24 hours?
Is it a bad idea to plug the other end of ESD strap to wall ground?
How to compactly explain secondary and tertiary characters without resorting to stereotypes?
How to show a landlord what we have in savings?
In the UK, is it possible to get a referendum by a court decision?
Magento 2 customer_grid indexer error after creating new custom customer address attribute
magento 2 - How to add new column to table customer_grid_flatCustomer export not working after creating custom attributes in magento 2.2.5Magento Indexer Not Adding Attribute to flat table in custom attributeMagento2 customer/address/newError in creating custom customer attribute in magento 2Error when creating new widgetMagento 2 Reindex failed on customer gridMagento 2 : After Data Migration(Indexer issue)Magento 2, Custom Customer Address Attribute update issueMagento 2 How to upgrade existing custom customer address attribute?Magento2 - New customer address attribute won't save to databaseError after creating boolean attribute magento2
I have created new custom customer address attribute in M2 community edition 2.1.5 using sql setup.
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
//install customer group attributes
$setup->startSetup();
if (version_compare($context->getVersion(), '1.0.1', '<'))
// insert default customer groups
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 4, 'customer_group_code' => 'University / Research Lab Customers', 'tax_class_id' => 3]
);
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 5, 'customer_group_code' => 'Hospitals / Clinical Centers Customers', 'tax_class_id' => 3]
);
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 6, 'customer_group_code' => 'GMP – Pharma / Biotech Customers', 'tax_class_id' => 3]
);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
/** @var $attributeSet AttributeSet */
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$attributesInfo = [
'contact_number' => [
'label' => 'Contact Number',
'type' => 'varchar',
'input' => 'text',
'input_validation' => 'numeric',
'min_text_length' => '0',
'max_text_length' => '10',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '999',
'system' => 0,
],
'customer_company' => [
'label' => 'Customer Company',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '1000',
'system' => 0,
]
];
foreach ($attributesInfo as $attributeCode => $attributeParams)
$customerSetup->addAttribute(Customer::ENTITY, $attributeCode, $attributeParams);
$attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, $attributeCode)
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['customer_account_create','customer_account_edit','adminhtml_customer']
]);
$attribute->save();
unset($attributesInfo);
//create customer address attribute
$attributesInfo = [
'room_no' => [
'label' => 'Room No',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_user_defined' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '999',
'system' => 0,
],
'building' => [
'label' => 'Building',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'is_user_defined' => true,
'sort_order' => '1000',
'system' => 0,
]
];
foreach ($attributesInfo as $attributeCode => $attributeParams)
$customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams);
$setup->endSetup();
}
The customer address attribute is created, I have confirmed in database. But I am getting error after running
php bin/magento indexer:reindex
Below is the error:
Customer Grid indexer process unknown error:
SQLSTATE[42000]: Syntax error or access violation: 1070 Too many key parts specified; max 16 parts allowed, query was: CREATE TABLE IF NOT EXISTS `customer_grid_flat` (
`entity_id` int UNSIGNED NOT NULL COMMENT 'Entity ID' ,
`name` text NULL COMMENT 'Name' ,
`email` varchar(255) NULL COMMENT 'Email' ,
`group_id` int NULL COMMENT 'Group_id' ,
`created_at` timestamp NULL default NULL COMMENT 'Created_at' ,
`website_id` int NULL COMMENT 'Website_id' ,
`confirmation` varchar(255) NULL COMMENT 'Confirmation' ,
`created_in` text NULL COMMENT 'Created_in' ,
`dob` date NULL COMMENT 'Dob' ,
`gender` int NULL COMMENT 'Gender' ,
`taxvat` varchar(255) NULL COMMENT 'Taxvat' ,
`lock_expires` timestamp NULL default NULL COMMENT 'Lock_expires' ,
`contact_number` varchar(255) NULL COMMENT 'Contact_number' ,
`customer_company` varchar(255) NULL COMMENT 'Customer_company' ,
`shipping_full` text NULL COMMENT 'Shipping_full' ,
`billing_full` text NULL COMMENT 'Billing_full' ,
`billing_firstname` varchar(255) NULL COMMENT 'Billing_firstname' ,
`billing_lastname` varchar(255) NULL COMMENT 'Billing_lastname' ,
`billing_telephone` varchar(255) NULL COMMENT 'Billing_telephone' ,
`billing_postcode` varchar(255) NULL COMMENT 'Billing_postcode' ,
`billing_country_id` varchar(255) NULL COMMENT 'Billing_country_id' ,
`billing_region` varchar(255) NULL COMMENT 'Billing_region' ,
`billing_street` varchar(255) NULL COMMENT 'Billing_street' ,
`billing_city` varchar(255) NULL COMMENT 'Billing_city' ,
`billing_fax` varchar(255) NULL COMMENT 'Billing_fax' ,
`billing_vat_id` varchar(255) NULL COMMENT 'Billing_vat_id' ,
`billing_company` varchar(255) NULL COMMENT 'Billing_company' ,
`billing_building` varchar(255) NULL COMMENT 'Billing_building' ,
`billing_room_no` varchar(255) NULL COMMENT 'Billing_room_no' ,
PRIMARY KEY (`entity_id`),
INDEX `CUSTOMER_GRID_FLAT_GROUP_ID` (`group_id`),
INDEX `CUSTOMER_GRID_FLAT_CREATED_AT` (`created_at`),
INDEX `CUSTOMER_GRID_FLAT_WEBSITE_ID` (`website_id`),
INDEX `CUSTOMER_GRID_FLAT_CONFIRMATION` (`confirmation`),
INDEX `CUSTOMER_GRID_FLAT_DOB` (`dob`),
INDEX `CUSTOMER_GRID_FLAT_GENDER` (`gender`),
INDEX `CUSTOMER_GRID_FLAT_BILLING_COUNTRY_ID` (`billing_country_id`),
FULLTEXT `FTI_5DD806E7D7383F9D4376BB41BEB968FC` (`name`, `email`, `created_in`, `taxvat`, `contact_number`, `customer_company`, `shipping_full`, `billing_full`, `billing_firstname`, `billing_lastname`, `billing_telephone`, `billing_postcode`, `billing_region`, `billing_city`, `billing_fax`, `billing_company`, `billing_building`, `billing_room_no`)
) COMMENT='customer_grid_flat' ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci
In the database I tried by changing the indexer status from 'invalid' to 'valid' then also same error is coming.
Plz suggest me any solution.
magento2 indexing
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have created new custom customer address attribute in M2 community edition 2.1.5 using sql setup.
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
//install customer group attributes
$setup->startSetup();
if (version_compare($context->getVersion(), '1.0.1', '<'))
// insert default customer groups
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 4, 'customer_group_code' => 'University / Research Lab Customers', 'tax_class_id' => 3]
);
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 5, 'customer_group_code' => 'Hospitals / Clinical Centers Customers', 'tax_class_id' => 3]
);
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 6, 'customer_group_code' => 'GMP – Pharma / Biotech Customers', 'tax_class_id' => 3]
);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
/** @var $attributeSet AttributeSet */
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$attributesInfo = [
'contact_number' => [
'label' => 'Contact Number',
'type' => 'varchar',
'input' => 'text',
'input_validation' => 'numeric',
'min_text_length' => '0',
'max_text_length' => '10',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '999',
'system' => 0,
],
'customer_company' => [
'label' => 'Customer Company',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '1000',
'system' => 0,
]
];
foreach ($attributesInfo as $attributeCode => $attributeParams)
$customerSetup->addAttribute(Customer::ENTITY, $attributeCode, $attributeParams);
$attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, $attributeCode)
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['customer_account_create','customer_account_edit','adminhtml_customer']
]);
$attribute->save();
unset($attributesInfo);
//create customer address attribute
$attributesInfo = [
'room_no' => [
'label' => 'Room No',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_user_defined' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '999',
'system' => 0,
],
'building' => [
'label' => 'Building',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'is_user_defined' => true,
'sort_order' => '1000',
'system' => 0,
]
];
foreach ($attributesInfo as $attributeCode => $attributeParams)
$customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams);
$setup->endSetup();
}
The customer address attribute is created, I have confirmed in database. But I am getting error after running
php bin/magento indexer:reindex
Below is the error:
Customer Grid indexer process unknown error:
SQLSTATE[42000]: Syntax error or access violation: 1070 Too many key parts specified; max 16 parts allowed, query was: CREATE TABLE IF NOT EXISTS `customer_grid_flat` (
`entity_id` int UNSIGNED NOT NULL COMMENT 'Entity ID' ,
`name` text NULL COMMENT 'Name' ,
`email` varchar(255) NULL COMMENT 'Email' ,
`group_id` int NULL COMMENT 'Group_id' ,
`created_at` timestamp NULL default NULL COMMENT 'Created_at' ,
`website_id` int NULL COMMENT 'Website_id' ,
`confirmation` varchar(255) NULL COMMENT 'Confirmation' ,
`created_in` text NULL COMMENT 'Created_in' ,
`dob` date NULL COMMENT 'Dob' ,
`gender` int NULL COMMENT 'Gender' ,
`taxvat` varchar(255) NULL COMMENT 'Taxvat' ,
`lock_expires` timestamp NULL default NULL COMMENT 'Lock_expires' ,
`contact_number` varchar(255) NULL COMMENT 'Contact_number' ,
`customer_company` varchar(255) NULL COMMENT 'Customer_company' ,
`shipping_full` text NULL COMMENT 'Shipping_full' ,
`billing_full` text NULL COMMENT 'Billing_full' ,
`billing_firstname` varchar(255) NULL COMMENT 'Billing_firstname' ,
`billing_lastname` varchar(255) NULL COMMENT 'Billing_lastname' ,
`billing_telephone` varchar(255) NULL COMMENT 'Billing_telephone' ,
`billing_postcode` varchar(255) NULL COMMENT 'Billing_postcode' ,
`billing_country_id` varchar(255) NULL COMMENT 'Billing_country_id' ,
`billing_region` varchar(255) NULL COMMENT 'Billing_region' ,
`billing_street` varchar(255) NULL COMMENT 'Billing_street' ,
`billing_city` varchar(255) NULL COMMENT 'Billing_city' ,
`billing_fax` varchar(255) NULL COMMENT 'Billing_fax' ,
`billing_vat_id` varchar(255) NULL COMMENT 'Billing_vat_id' ,
`billing_company` varchar(255) NULL COMMENT 'Billing_company' ,
`billing_building` varchar(255) NULL COMMENT 'Billing_building' ,
`billing_room_no` varchar(255) NULL COMMENT 'Billing_room_no' ,
PRIMARY KEY (`entity_id`),
INDEX `CUSTOMER_GRID_FLAT_GROUP_ID` (`group_id`),
INDEX `CUSTOMER_GRID_FLAT_CREATED_AT` (`created_at`),
INDEX `CUSTOMER_GRID_FLAT_WEBSITE_ID` (`website_id`),
INDEX `CUSTOMER_GRID_FLAT_CONFIRMATION` (`confirmation`),
INDEX `CUSTOMER_GRID_FLAT_DOB` (`dob`),
INDEX `CUSTOMER_GRID_FLAT_GENDER` (`gender`),
INDEX `CUSTOMER_GRID_FLAT_BILLING_COUNTRY_ID` (`billing_country_id`),
FULLTEXT `FTI_5DD806E7D7383F9D4376BB41BEB968FC` (`name`, `email`, `created_in`, `taxvat`, `contact_number`, `customer_company`, `shipping_full`, `billing_full`, `billing_firstname`, `billing_lastname`, `billing_telephone`, `billing_postcode`, `billing_region`, `billing_city`, `billing_fax`, `billing_company`, `billing_building`, `billing_room_no`)
) COMMENT='customer_grid_flat' ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci
In the database I tried by changing the indexer status from 'invalid' to 'valid' then also same error is coming.
Plz suggest me any solution.
magento2 indexing
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
did you get any solutions for the post
– senthil
Nov 28 '18 at 8:30
i hope it helps magento.stackexchange.com/questions/241765/…
– Chirag Patel
Feb 26 at 11:18
add a comment |
I have created new custom customer address attribute in M2 community edition 2.1.5 using sql setup.
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
//install customer group attributes
$setup->startSetup();
if (version_compare($context->getVersion(), '1.0.1', '<'))
// insert default customer groups
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 4, 'customer_group_code' => 'University / Research Lab Customers', 'tax_class_id' => 3]
);
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 5, 'customer_group_code' => 'Hospitals / Clinical Centers Customers', 'tax_class_id' => 3]
);
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 6, 'customer_group_code' => 'GMP – Pharma / Biotech Customers', 'tax_class_id' => 3]
);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
/** @var $attributeSet AttributeSet */
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$attributesInfo = [
'contact_number' => [
'label' => 'Contact Number',
'type' => 'varchar',
'input' => 'text',
'input_validation' => 'numeric',
'min_text_length' => '0',
'max_text_length' => '10',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '999',
'system' => 0,
],
'customer_company' => [
'label' => 'Customer Company',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '1000',
'system' => 0,
]
];
foreach ($attributesInfo as $attributeCode => $attributeParams)
$customerSetup->addAttribute(Customer::ENTITY, $attributeCode, $attributeParams);
$attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, $attributeCode)
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['customer_account_create','customer_account_edit','adminhtml_customer']
]);
$attribute->save();
unset($attributesInfo);
//create customer address attribute
$attributesInfo = [
'room_no' => [
'label' => 'Room No',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_user_defined' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '999',
'system' => 0,
],
'building' => [
'label' => 'Building',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'is_user_defined' => true,
'sort_order' => '1000',
'system' => 0,
]
];
foreach ($attributesInfo as $attributeCode => $attributeParams)
$customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams);
$setup->endSetup();
}
The customer address attribute is created, I have confirmed in database. But I am getting error after running
php bin/magento indexer:reindex
Below is the error:
Customer Grid indexer process unknown error:
SQLSTATE[42000]: Syntax error or access violation: 1070 Too many key parts specified; max 16 parts allowed, query was: CREATE TABLE IF NOT EXISTS `customer_grid_flat` (
`entity_id` int UNSIGNED NOT NULL COMMENT 'Entity ID' ,
`name` text NULL COMMENT 'Name' ,
`email` varchar(255) NULL COMMENT 'Email' ,
`group_id` int NULL COMMENT 'Group_id' ,
`created_at` timestamp NULL default NULL COMMENT 'Created_at' ,
`website_id` int NULL COMMENT 'Website_id' ,
`confirmation` varchar(255) NULL COMMENT 'Confirmation' ,
`created_in` text NULL COMMENT 'Created_in' ,
`dob` date NULL COMMENT 'Dob' ,
`gender` int NULL COMMENT 'Gender' ,
`taxvat` varchar(255) NULL COMMENT 'Taxvat' ,
`lock_expires` timestamp NULL default NULL COMMENT 'Lock_expires' ,
`contact_number` varchar(255) NULL COMMENT 'Contact_number' ,
`customer_company` varchar(255) NULL COMMENT 'Customer_company' ,
`shipping_full` text NULL COMMENT 'Shipping_full' ,
`billing_full` text NULL COMMENT 'Billing_full' ,
`billing_firstname` varchar(255) NULL COMMENT 'Billing_firstname' ,
`billing_lastname` varchar(255) NULL COMMENT 'Billing_lastname' ,
`billing_telephone` varchar(255) NULL COMMENT 'Billing_telephone' ,
`billing_postcode` varchar(255) NULL COMMENT 'Billing_postcode' ,
`billing_country_id` varchar(255) NULL COMMENT 'Billing_country_id' ,
`billing_region` varchar(255) NULL COMMENT 'Billing_region' ,
`billing_street` varchar(255) NULL COMMENT 'Billing_street' ,
`billing_city` varchar(255) NULL COMMENT 'Billing_city' ,
`billing_fax` varchar(255) NULL COMMENT 'Billing_fax' ,
`billing_vat_id` varchar(255) NULL COMMENT 'Billing_vat_id' ,
`billing_company` varchar(255) NULL COMMENT 'Billing_company' ,
`billing_building` varchar(255) NULL COMMENT 'Billing_building' ,
`billing_room_no` varchar(255) NULL COMMENT 'Billing_room_no' ,
PRIMARY KEY (`entity_id`),
INDEX `CUSTOMER_GRID_FLAT_GROUP_ID` (`group_id`),
INDEX `CUSTOMER_GRID_FLAT_CREATED_AT` (`created_at`),
INDEX `CUSTOMER_GRID_FLAT_WEBSITE_ID` (`website_id`),
INDEX `CUSTOMER_GRID_FLAT_CONFIRMATION` (`confirmation`),
INDEX `CUSTOMER_GRID_FLAT_DOB` (`dob`),
INDEX `CUSTOMER_GRID_FLAT_GENDER` (`gender`),
INDEX `CUSTOMER_GRID_FLAT_BILLING_COUNTRY_ID` (`billing_country_id`),
FULLTEXT `FTI_5DD806E7D7383F9D4376BB41BEB968FC` (`name`, `email`, `created_in`, `taxvat`, `contact_number`, `customer_company`, `shipping_full`, `billing_full`, `billing_firstname`, `billing_lastname`, `billing_telephone`, `billing_postcode`, `billing_region`, `billing_city`, `billing_fax`, `billing_company`, `billing_building`, `billing_room_no`)
) COMMENT='customer_grid_flat' ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci
In the database I tried by changing the indexer status from 'invalid' to 'valid' then also same error is coming.
Plz suggest me any solution.
magento2 indexing
I have created new custom customer address attribute in M2 community edition 2.1.5 using sql setup.
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
//install customer group attributes
$setup->startSetup();
if (version_compare($context->getVersion(), '1.0.1', '<'))
// insert default customer groups
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 4, 'customer_group_code' => 'University / Research Lab Customers', 'tax_class_id' => 3]
);
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 5, 'customer_group_code' => 'Hospitals / Clinical Centers Customers', 'tax_class_id' => 3]
);
$setup->getConnection()->insert(
$setup->getTable('customer_group'),
['customer_group_id' => 6, 'customer_group_code' => 'GMP – Pharma / Biotech Customers', 'tax_class_id' => 3]
);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
/** @var $attributeSet AttributeSet */
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$attributesInfo = [
'contact_number' => [
'label' => 'Contact Number',
'type' => 'varchar',
'input' => 'text',
'input_validation' => 'numeric',
'min_text_length' => '0',
'max_text_length' => '10',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '999',
'system' => 0,
],
'customer_company' => [
'label' => 'Customer Company',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '1000',
'system' => 0,
]
];
foreach ($attributesInfo as $attributeCode => $attributeParams)
$customerSetup->addAttribute(Customer::ENTITY, $attributeCode, $attributeParams);
$attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, $attributeCode)
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['customer_account_create','customer_account_edit','adminhtml_customer']
]);
$attribute->save();
unset($attributesInfo);
//create customer address attribute
$attributesInfo = [
'room_no' => [
'label' => 'Room No',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_user_defined' => true,
'is_visible' => true,
'is_required' => false,
'sort_order' => '999',
'system' => 0,
],
'building' => [
'label' => 'Building',
'type' => 'varchar',
'input' => 'text',
'is_used_in_grid' => true,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'is_visible' => true,
'is_required' => false,
'is_user_defined' => true,
'sort_order' => '1000',
'system' => 0,
]
];
foreach ($attributesInfo as $attributeCode => $attributeParams)
$customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams);
$setup->endSetup();
}
The customer address attribute is created, I have confirmed in database. But I am getting error after running
php bin/magento indexer:reindex
Below is the error:
Customer Grid indexer process unknown error:
SQLSTATE[42000]: Syntax error or access violation: 1070 Too many key parts specified; max 16 parts allowed, query was: CREATE TABLE IF NOT EXISTS `customer_grid_flat` (
`entity_id` int UNSIGNED NOT NULL COMMENT 'Entity ID' ,
`name` text NULL COMMENT 'Name' ,
`email` varchar(255) NULL COMMENT 'Email' ,
`group_id` int NULL COMMENT 'Group_id' ,
`created_at` timestamp NULL default NULL COMMENT 'Created_at' ,
`website_id` int NULL COMMENT 'Website_id' ,
`confirmation` varchar(255) NULL COMMENT 'Confirmation' ,
`created_in` text NULL COMMENT 'Created_in' ,
`dob` date NULL COMMENT 'Dob' ,
`gender` int NULL COMMENT 'Gender' ,
`taxvat` varchar(255) NULL COMMENT 'Taxvat' ,
`lock_expires` timestamp NULL default NULL COMMENT 'Lock_expires' ,
`contact_number` varchar(255) NULL COMMENT 'Contact_number' ,
`customer_company` varchar(255) NULL COMMENT 'Customer_company' ,
`shipping_full` text NULL COMMENT 'Shipping_full' ,
`billing_full` text NULL COMMENT 'Billing_full' ,
`billing_firstname` varchar(255) NULL COMMENT 'Billing_firstname' ,
`billing_lastname` varchar(255) NULL COMMENT 'Billing_lastname' ,
`billing_telephone` varchar(255) NULL COMMENT 'Billing_telephone' ,
`billing_postcode` varchar(255) NULL COMMENT 'Billing_postcode' ,
`billing_country_id` varchar(255) NULL COMMENT 'Billing_country_id' ,
`billing_region` varchar(255) NULL COMMENT 'Billing_region' ,
`billing_street` varchar(255) NULL COMMENT 'Billing_street' ,
`billing_city` varchar(255) NULL COMMENT 'Billing_city' ,
`billing_fax` varchar(255) NULL COMMENT 'Billing_fax' ,
`billing_vat_id` varchar(255) NULL COMMENT 'Billing_vat_id' ,
`billing_company` varchar(255) NULL COMMENT 'Billing_company' ,
`billing_building` varchar(255) NULL COMMENT 'Billing_building' ,
`billing_room_no` varchar(255) NULL COMMENT 'Billing_room_no' ,
PRIMARY KEY (`entity_id`),
INDEX `CUSTOMER_GRID_FLAT_GROUP_ID` (`group_id`),
INDEX `CUSTOMER_GRID_FLAT_CREATED_AT` (`created_at`),
INDEX `CUSTOMER_GRID_FLAT_WEBSITE_ID` (`website_id`),
INDEX `CUSTOMER_GRID_FLAT_CONFIRMATION` (`confirmation`),
INDEX `CUSTOMER_GRID_FLAT_DOB` (`dob`),
INDEX `CUSTOMER_GRID_FLAT_GENDER` (`gender`),
INDEX `CUSTOMER_GRID_FLAT_BILLING_COUNTRY_ID` (`billing_country_id`),
FULLTEXT `FTI_5DD806E7D7383F9D4376BB41BEB968FC` (`name`, `email`, `created_in`, `taxvat`, `contact_number`, `customer_company`, `shipping_full`, `billing_full`, `billing_firstname`, `billing_lastname`, `billing_telephone`, `billing_postcode`, `billing_region`, `billing_city`, `billing_fax`, `billing_company`, `billing_building`, `billing_room_no`)
) COMMENT='customer_grid_flat' ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci
In the database I tried by changing the indexer status from 'invalid' to 'valid' then also same error is coming.
Plz suggest me any solution.
magento2 indexing
magento2 indexing
edited Mar 16 '17 at 5:19
Teja Bhagavan Kollepara
3,00641949
3,00641949
asked Mar 15 '17 at 13:19
Abhimanyu SinghAbhimanyu Singh
1741418
1741418
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
did you get any solutions for the post
– senthil
Nov 28 '18 at 8:30
i hope it helps magento.stackexchange.com/questions/241765/…
– Chirag Patel
Feb 26 at 11:18
add a comment |
did you get any solutions for the post
– senthil
Nov 28 '18 at 8:30
i hope it helps magento.stackexchange.com/questions/241765/…
– Chirag Patel
Feb 26 at 11:18
did you get any solutions for the post
– senthil
Nov 28 '18 at 8:30
did you get any solutions for the post
– senthil
Nov 28 '18 at 8:30
i hope it helps magento.stackexchange.com/questions/241765/…
– Chirag Patel
Feb 26 at 11:18
i hope it helps magento.stackexchange.com/questions/241765/…
– Chirag Patel
Feb 26 at 11:18
add a comment |
1 Answer
1
active
oldest
votes
Set is_used_in_grid, is_filterable_in_grid, is_searchable_in_grid to false
This is because MSSQL only allowed 16 fields that can be set as true. You have to choose which one you want to be shown in customer grid.
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%2f164493%2fmagento-2-customer-grid-indexer-error-after-creating-new-custom-customer-address%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Set is_used_in_grid, is_filterable_in_grid, is_searchable_in_grid to false
This is because MSSQL only allowed 16 fields that can be set as true. You have to choose which one you want to be shown in customer grid.
add a comment |
Set is_used_in_grid, is_filterable_in_grid, is_searchable_in_grid to false
This is because MSSQL only allowed 16 fields that can be set as true. You have to choose which one you want to be shown in customer grid.
add a comment |
Set is_used_in_grid, is_filterable_in_grid, is_searchable_in_grid to false
This is because MSSQL only allowed 16 fields that can be set as true. You have to choose which one you want to be shown in customer grid.
Set is_used_in_grid, is_filterable_in_grid, is_searchable_in_grid to false
This is because MSSQL only allowed 16 fields that can be set as true. You have to choose which one you want to be shown in customer grid.
edited Feb 26 at 11:26
answered Feb 26 at 11:00
fernandusfernandus
1439
1439
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%2f164493%2fmagento-2-customer-grid-indexer-error-after-creating-new-custom-customer-address%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
did you get any solutions for the post
– senthil
Nov 28 '18 at 8:30
i hope it helps magento.stackexchange.com/questions/241765/…
– Chirag Patel
Feb 26 at 11:18