A few days ago we updated our project magento version from 2.4.3 to 2.4.7. All works quite well, with the exception of the category url, all category url returns 404 error. The catalog/category/view/id/x urls don't work either, not only the url redirects. The category information is not displayed in the backend but they are saved in the database. The category tree is displayed, but for example the category name and the category url are not, the input fields are empty. I cannot update this informations either, when I try to save it, I get the text "category saved" whit no error but the fields are still empty. I have tried many things. Reindex, clean cache, I checked if there is any duplication in the catalog_category_entity table but there is no duplicates, I changed the value of "web/seo/use_rewrites" path to 0 in the url_rewrite table, also nothing happened. Does anyone have any idea what I can do to get the category url's to go and not get a 404 error? Please help me!
-
Whe you try to save, is there any error on log file or any console log there?– Dhiren VasoyaCommented Jun 20 at 10:51
-
No errors. After save I got "You saved the category." message, but nothing is saved. No errors in the log files and no erros in console. This is what I got in debug.log :main.DEBUG: cache_invalidate: {"method":"POST","url":"https://...../admin/catalog/category/save/key/3f88f284b08e13bb10f45d2d3f201d6a89e2c51b7f87b8575b5863ad4c65e29f/","invalidateInfo":{"tags":{"0":"cat_c_113","1":"cat_c_p_113","2":"cat_c_p_1","3":"cat_c_p_2","5":"cat_c"},"mode":"matchingAnyTag"}} []– beataCommented Jun 20 at 11:17
-
Try to compile from CLI one's then check this.– Dhiren VasoyaCommented Jun 22 at 6:34
1 Answer
The issue you're facing with Magento categories after an update can be complex, especially if the category data is not displaying correctly in the backend. Here are some additional steps and checks that can help resolve this problem:
Step 1: Database Integrity Check
Since the category data is not displaying correctly, there might be issues with the database schema or data integrity. Run the following SQL queries to check the integrity of your category tables:
Verify Category Entity Table
SELECT * FROM catalog_category_entity WHERE entity_id NOT IN (SELECT entity_id FROM catalog_category_entity_varchar);
SELECT * FROM catalog_category_entity WHERE entity_id NOT IN (SELECT entity_id FROM catalog_category_entity_int);
SELECT * FROM catalog_category_entity WHERE entity_id NOT IN (SELECT entity_id FROM catalog_category_entity_text);
SELECT * FROM catalog_category_entity WHERE entity_id NOT IN (SELECT entity_id FROM catalog_category_entity_datetime);
SELECT * FROM catalog_category_entity WHERE entity_id NOT IN (SELECT entity_id FROM catalog_category_entity_decimal);
Verify EAV Tables
SELECT * FROM eav_attribute WHERE entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_category');
Verify URL Rewrite Table
SELECT * FROM url_rewrite WHERE entity_type = 'category';
Step 2: Reset Category Attributes
Sometimes, attributes can get corrupted. You can reset category attributes by running the following queries:
Update Category Attributes
UPDATE catalog_category_entity_varchar SET value = '' WHERE attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_category'));
UPDATE catalog_category_entity_text SET value = '' WHERE attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_category'));
UPDATE catalog_category_entity_int SET value = 0 WHERE attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_category'));
UPDATE catalog_category_entity_decimal SET value = 0 WHERE attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_category'));
UPDATE catalog_category_entity_datetime SET value = NOW() WHERE attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_category'));
Step 3: Recreate URL Rewrites
Manually recreate URL rewrites for categories:
php bin/magento indexer:reset
php bin/magento indexer:reindex
php bin/magento cache:flush
Step 4: Debugging Extension Conflicts
Disable all custom extensions and third-party modules to see if any of them are causing the issue:
php bin/magento module:disable --all
php bin/magento setup:upgrade
php bin/magento cache:flush
If the categories start working, enable the modules one by one to identify the problematic extension.
Step 5: Magento Logs and Error Reporting
Check the var/log/
directory for Magento logs, especially system.log
and exception.log
:
tail -f var/log/system.log
tail -f var/log/exception.log
Look for any errors related to categories or URL rewrites.
Step 6: Magento Mode
Switch Magento to developer mode to get more detailed error messages:
php bin/magento deploy:mode:set developer
Step 7: Review Setup Upgrade and Compile
Ensure that the Magento upgrade and compilation steps completed without errors:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
Step 8: Check for Core File Changes
Ensure that core Magento files were not altered during the update. If core files were changed, revert them to the original state.
Step 9: Check for Proper Permissions
Ensure that file and directory permissions are correctly set:
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod -R 777 var/ pub/ generated/
Step 10: Restore from Backup
If possible, restore the categories data from a backup taken before the update. This might help if the data got corrupted during the update process.
If none of the above steps resolve the issue, consider reaching out to Magento support or a professional Magento developer for a deeper investigation.
-
Thank you for your reply! I will try these steps! I run the SQL queries to check the integrity of category tables (Verify Category Entity Table), but I do not know if good values are returned, I do not understand. The first three queries returns nothing, the fourth returns one line ,and the last one returns more lines (25 rows). I do not understand what to do with these.– beataCommented Jun 21 at 5:53
-
I did everything, the result was that all data disappeared in backend (categories admin page) except the category id. I still can not save the category name or url :(– beataCommented Jun 21 at 7:08