cancel
Showing results for 
Search instead for 
Did you mean: 

Migrated attributes not workin / Indexer breaks catalog_product_index_eav

Migrated attributes not workin / Indexer breaks catalog_product_index_eav

Hi, hope that someone can help me out.

I've Migrated data from Magento 1.9 to Magento 2.2.5. There's three store fronts in the installation. For some reason multiselect product attributes are not working correctly.

The old store had several hundreds of products with these attributes, but only a handful (14) of them has those attributes in the new 2.2.5 installation.

Very odd is that you can see the correct selections in the new backend when viewing the product, but the selections are not showing on the product grid, where you select the products. I cannot change the attributes in the products that doesn't have them on the grid, but I can change them for the products that has the attributes shown on the grid.

 

I first thought that this is a migration issue, so I manually merged the catalog_product_index_eav tables. Then the frontends layered navigation gets the data correct from the database, but the backend uses indexes, so it doesn't work. When I try to reindex with the correct catalog_product_index_eav table, the indexer truncates the manually added data and again, it's the same way wrong again.

 

I've checked the attributes in the database and all the values for the attributes are correct in eav_attribute (_option & _value), the attributes show up as supposed to and work for new products. When I create a new multiselect attribute, it also seems to work properly.

 

Why the few products has the attributes correctly, even though they have all the other values identical?
How can the products have them set correctly on the products backend page, but not showing in the listing grid?

Where are the values for products saved if not in catalog_product_index_eav table?

Why the indexer removes the added values from the catalog_product_index_eav table?

 

Thanks, hopefully you get the hang of the problem from this. All the help is appreciated.

 

1 REPLY 1

Re: Migrated attributes not workin / Indexer breaks catalog_product_index_eav

Found the solution.

To answer my own questions:
catalog_product_index_eav table is the table that's indexed from catalog_product_entity_varchar.

 

The Layered navigation didn't use the indexed table although Magentos listing page did.

 

My question was a dublicate from (still can't use google) this: https://magento.stackexchange.com/questions/174546/multi-select-attribute-not-indexing-ce-2-6-1

 

And the answer is that even if the eav_attribute table did have correct value "varchar" on the attribute, the migrated data still went to catalog_product_entity_text on the migrations. This might be a bug in the Magento data migration tool.

 

{attribute_id} = eav_attribute table attribute id:

UPDATE catalog_product_entity_varchar, catalog_product_entity_text
SET catalog_product_entity_varchar.value = catalog_product_entity_text.value
WHERE catalog_product_entity_varchar.attribute_id = catalog_product_entity_text.attribute_id
AND catalog_product_entity_varchar.entity_id = catalog_product_entity_text.entity_id
AND catalog_product_entity_text.store_id = catalog_product_entity_varchar.store_id
AND catalog_product_entity_varchar.value is null
AND catalog_product_entity_text.attribute_id = {attribute_id};
INSERT IGNORE INTO catalog_product_entity_varchar (store_id, attribute_id, entity_id, value)
select store_id, attribute_id, entity_id, value from catalog_product_entity_text where catalog_product_entity_text.attribute_id = {attribute_id}
and catalog_product_entity_text.value is not null;DELETE FROM catalog_product_entity_text where attribute_id = {attribute_id};