magento / data-migration-tool

Magento Data Migration Tool
https://devdocs.magento.com/guides/v2.3/migration/bk-migration-guide.html
Open Software License 3.0
334 stars 200 forks source link

Unable to create or edit categories after migration from 1.9.x to 2.2.9 #783

Closed jas8522 closed 3 years ago

jas8522 commented 4 years ago

When I attempt to add a category it looks like it's successful, but then refreshes the page to show me a category was added with no data saved to the DB. A category was created, just with no attributes of any kind.

I've disabled caching entirely in a dev copy of the site and I've re-indexed repeatedly.

There's screenshots and more description about this exact issue here: https://magento.stackexchange.com/questions/237721/magento-2-category-not-save

There's a few people commenting on that indicating that they're having the same problem, seemingly always post-migration.

In a dev copy of the site, I updated it to 2.2.11 at which point adding a category resulted in the following in the exception log:

[2020-01-30 19:49:26] main.CRITICAL: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'custom_layout_update_file' in 'field list', query was: 
INSERT  INTO `mg_catalog_category_flat_store_8` (`entity_id`,`attribute_set_id`,`parent_id`,`created_at`,`updated_at`,`path`,`position`,`level`,`chi
ldren_count`,`store_id`,`all_children`,`available_sort_by`,`children`,`custom_apply_to_products`,`custom_design`,`custom_design_from`,`custom_design
_to`,`custom_layout_update`,`custom_layout_update_file`,`custom_use_parent_settings`,`default_sort_by`,`description`,`display_mode`,`filter_price_ra
nge`,`image`,`include_in_menu`,`is_active`,`is_anchor`,`landing_page`,`meta_description`,`meta_keywords`,`meta_title`,`name`,`page_layout`,`path_in_
store`,`thumbnail`,`url_key`,`url_path`)

So I created the missing column:

ALTER TABLE `mg_catalog_category_flat_store_8` ADD `custom_layout_update_file` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `custom_layout_update`;

And now I'm back to the original problem where I don't get any errors in any of the logfiles when creating a category, yet Magento refuses to save category data on each attempt.

My best guess is that there's some kind of custom category attribute that was carried over from 1.9.x in the DB, but which doesn't exist in 2.2.x. Is there a way to find this out? Attached is what should be the complete list of category attributes. I manually removed the last one (thumbnail) because it was not appearing anywhere on the admin side while editing/adding a category -- thought it was extraneous.

category-attributes

Is there a way I can at least get some debug logging that would help?

jas8522 commented 4 years ago

I've now updated this instance to 2.3.4 and the issue persists. I've also set up a fresh install of Magento 2.3.3 where the only category attribute that does not exist there, but does in the broken category management version of Magento is this: custom_layout_update_file

Core Magento code appears to reference that custom_layout_update_file attribute in my live and dev store, yet in my fresh install it's nowhere to be found. How is that even possible?

jas8522 commented 4 years ago

I found the solution for this here: https://magento.stackexchange.com/questions/287463/magento-2-3-2-saving-categories-after-data-migration-causes-empty-records

Specifically:

set the default category attribute to set to be 3 in eav_entity_type where it was set to 20 (and also the default attribute set for products to make sure they were added like the imported ones).

The migration process should set the default attribute set for categories correctly once it finishes migrating the data.

It also did not set the default attribute to the "Migration_Default" so our store managers were unable to add new products. All attribute defaults should be updated automatically by this utility.

victor-v-rad commented 4 years ago

Hi @jas8522

Thank you for reporting this issue. 2.2.x is an old branch. Most likely this issue was fixed in one of the latest versions 2.3.x of the tool.

jas8522 commented 3 years ago

Well, I sure hope so for those doing migrations now!