Closed Nuranto closed 2 years ago
Thanks for the report @Nuranto
Let's start with the second problem.
You can pass an extra --force
flag in the command to skip that check.
However, I believe you found a bug here, we should probably clear that flag whenever an exception occurs so that the extra --force
flag is not needed the next time you want to run the command. The original purpose of the check was to prevent people from running the checker twice at the same time.
As for the first problem, this is a bit harder to figure out, as the code that runs against this problem is a bit complex and it's been a while since I've written it. Can you tell me if you have multiple root categories? And could you maybe briefly explain how your category trees look like and especially where category with id '36764' fits into the tree? A screenshot might help here if are willing to share it publicly.
Hello @hostep
Ok thank you for the second problem 👍
For the first one, yes I have two root categories, for two websites. 36764 did not exists in catalog_category_entity
table, however, there was an entry in url_rewrite
. I deleted it, but it seems it doesn't solve the issue, so I guess 36764 is still in another table, but which one ?
Huh, this is really strange
If I follow the code, the category data is fetched from the database from here, and this does search the catalog_category_entity
table.
But since it needs the url_path
and url_key
attributes, I would suspect that a join is made with the catalog_category_entity_varchar
table. So maybe there are still entries in that table with that ID?
If that doesn't help, could you maybe try to debug the code a little bit, to see how and where it goes wrong?
I did check all entity tables also, there was no 36764 there.
Ok, I will dig this tomorrow ! I'll keep you informed.
I took a look at the code again, I believe you might have a category where the path
contains the '36764' id.
You can probably find the incorrect categories with a query like this: SELECT * FROM catalog_category_entity WHERE path LIKE '%/36764%';
That probably means those are subcategories of the no-longer existing category with id '36764' and those subcategories will probably not work properly and maybe even not show up in the backend of Magento and can probably be removed as well?
Hello, you're right ! That was it. Everything works fine after deleting those.
I don't know how that could happen....
Anyway, thank you very much for your help !
Great, glad you figured it out!
Let me keep this ticket opened, so I remember to take a look at that 2nd problem, where we should remove the flag that something is running after an exception occurred.
Release v1.3.1 was made which contains some small improvements based on what you reported here, thanks for that! 🙂
@Nuranto Can you share whats was your solution did u removed those records from db ?
@sajidunnar Yes, I remove duplicated lines, and it solves the issue.
On first try of this command (
catalog:category:integrity:urlkey
)I got this error :
Can't find category with id
And if try to launch again :
We are already refreshing the category url key's, just have a little patience 🙂