5

We have been having problem moving Magento 2 category. When we try to re-arrange/ move a category we get the error, "There was a category move error." We have increased PHP execution time out and reindexed Magento 2, but still these didn't help.

Any assistance would be much appreciated. Thanks in advance!

3
  • try this github.com/magento/magento2/commit/… May 29, 2016 at 4:16
  • Hi. I did try your fix but it actually caused many other problems... :) 1- I couldn't find that path in my installation. 2- So I created the path by adding the diffrent folders and file and the content app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml 3- when I did that it broke the entire website
    – P. Paul
    Jun 19, 2016 at 12:11
  • @ P. Paul Sorry you misplaced, please check the answer. Jun 19, 2016 at 16:54

7 Answers 7

5

i had the same problem and i successfully could solve it but i am not sure that it is the correct solution. let's go to the solution ...

first of all i explain the problem first: imagine i have 1 main category and it has 6 sub-category and i want to move one of the sub-category to out of the sub-category so it become another main category.

enter image description here

solution : find the sub-category's ID and the main category's ID that you want to move the sub-category under it. then open the PHPMyAdmin(OR what ever Your DataBase Administration tool is) section and go the related Database and go to the "catalog_category_entity" Table.

enter image description here

find the sub-category's ID in the "entity_id" column and change the "parent_id" column's value to to the main category's ID that u want to move the sub-category to it.

enter image description here

save the table and drag and drop it again. that's it.

enter image description here

final result ;-)

enter image description here

if it doesn't work for u just let me know, so i can help u.

1
  • Hello. Thanks for the help. I will try that and let you know as soon as possible.
    – P. Paul
    Aug 27, 2016 at 19:42
1

There can be many reasons, one of the possible reasons, is here, I solved it this way.

If Categories are created programmatically, category position will be either zero or allotted same to all categories.

Check postion column of table catalog_category_entity, postion of each category should be different. If any 2 child-category of same parent is same than it will be not movable with each other.

enter image description here

1

For me the error was thrown caused by the fact that moving the category would create 'duplicate urls'.

I went in the database to the url_rewrite table and deleted the custom-type rewrites. Make sure to take a backup before doing so.

    DELETE FROM `url_rewrite` WHERE `entity_type` LIKE 'custom'

Then You can move the category. Finally ran bin/magento indexer:reindex in the CLI

1
  • but I not have any record with entity_type` LIKE 'custom' PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'produits-hightech/connectique-adaptateurs-connecteurs/casque-usb' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID' in /var/www/html/magento1/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:91 May 4, 2021 at 7:08
0

Please try below

root/vendor/magento/module-catalog/view/adminhtml/templates/catalog/category/edit/form.phtml

Around line number 34

<form id="category_edit_form" action="<?php echo $block->getSaveUrl() ?>" method="post" enctype="multipart/form-data">

Replace with

<form id="category_edit_form" name="category_edit_form" action="<?php echo $block->getSaveUrl() ?>" method="post" enctype="multipart/form-data">

root/vendor/magento/module-catalog/view/adminhtml/templates/catalog/category/tree.phtml

around line number 472

$('form .messages').html(data.messages);

Replace with

$('[name="category_edit_form"] .messages').html(data.messages);

Make sure remove cache , set proper permission , run setup:upgrade before check.

Hope this helps.

1
  • Hello Krishna-- Thank you so much for the support. I have changed/ replaced the line in the first file (form.phtml), but the second file "tree.phtml" was already the same so I didn't changed/ replace anything in it. I cleared the cache and ran "setup:upgrade" then tried again. I didn't get the error message anymore, which was a good sign, but the category were not moved. I think the issue is close to being resolved. :) Any other tricks? Thank you!
    – P. Paul
    Jun 30, 2016 at 19:11
0

Please open the Dev mode to see the detailed errors

0

1 ) First Go to Exception error and Check for error details.

2 ) Sometimes Your columns are missed from 'field list', if the issue is related to field list then simply run this command. bin/magento indexer:reindex

Your issue will be resolve.

-1

Try changing the indexing mode to Manual indexing before moving categories . Once categories are moved , do reindex and you can also set back the indexing mode to reindex on save Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.