-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Magento 2.3.1, Invalid URL key when saving category for store view #22187
Comments
Hi @KhaledJoulani. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. @KhaledJoulani do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
@magento-engcom-team give me 2.3.1-develop instance |
Hi @KhaledJoulani. Thank you for your request. I'm working on Magento 2.3.1-develop instance for you |
@magento-engcom-team give me 2.3-develop instance |
Hi @KhaledJoulani. Thank you for your request. I'm working on Magento 2.3-develop instance for you |
Hi @KhaledJoulani, here is your Magento instance. |
I confirm that I was able to reproduce the issue on vanilla Magento instance following steps to reproduce. |
Hi @shikhamis11. Thank you for working on this issue.
|
@magento-engcom-team give me 2.3-develop instance |
Hi @shikhamis11. Thank you for your request. I'm working on Magento 2.3-develop instance for you |
Hi @shikhamis11, here is your Magento instance. |
✅ Confirmed by @shikhamis11 Issue Available: @shikhamis11, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
@magento-engcom-team give me 2.2-develop instance |
Hi @shikhamis11. Thank you for your request. I'm working on Magento 2.2-develop instance for you |
Hi @shikhamis11, here is your Magento instance. |
it's may be related to #13689 |
Wow it's been a year on the related issue you linked, no one fixed it ? |
And probably also related to #20879 |
In my view this is a duplicate of #22187 so I will close this. I know that we have a module in the Japanese localization project that is aiming at URLRewrites https://github.com/magento/magento2-jp/tree/2.3-develop/JapaneseUrlRewrite and I think this would be a good module or fixes to have in the main repository as well. Thank you for raising this issue please feel free to track the progress in the other issue. |
I am sorry I couldn't get which issue you are referring to. #22187 is this issue, there is no other issue. It's not fixed as well, so you shouldn't have closed this issue without providing a fix yet. |
Is there any update on this? |
6f4f511 "might" fix this problem based on the commit message. (will be included in Magento 2.3.3, which will be out in a couple of weeks) |
Was this ever fixed? |
2.3.3 did not fix this, I don't understand why @dmanners closed this issue by saying that it is a duplicate of itself, he probably found some other issue and copied the incorrect number. But which issue number should it be? |
Actually according to commit files... this is for product URL rewrite module. not for Categories. |
Preconditions (*)
Steps to reproduce (*)
You must have a second store view.
Expected result (*)
Actual result (*)
Additional information
So I checked the log file in, var/log/system.log
[2019-04-06 14:45:41] main.CRITICAL: Exception message: Invalid URL key
Trace:
And I tried to debug the issue.
In the execute function here:
Magento\CatalogUrlRewrite\Observer\CategoryUrlPathAutogeneratorObserver->execute()
which for my Magento 2 installation is in this file:
vendor/magento/module-catalog-url-rewrite/Observer/CategoryUrlPathAutogeneratorObserver.php, Line:76.
This one: $resultUrlKey = $category->formatUrlKey($category->getOrigData('name'));
The value of $resultUrlKey is empty,
now the next line is :
$this->updateUrlKey($category, $resultUrlKey);
and in updateUrlKey() there is a check:
if (empty($urlKey)) {
throw new \Magento\Framework\Exception\LocalizedException(__('Invalid URL key'));
}.
So after all this i debugged formatUrlKey() function from line 76, found the function in:
vendor/magento/module-catalog/Model/Category.php, line:649.
In this function there is only one line:
return $this->filter->translitUrl($str);
that leads to this class:
vendor/magento/framework/Filter/TranslitUrl.php
and in there, there is this code:
at this line $string = preg_replace('#[^0-9a-z]+#i', '-', parent::filter($string));
it returns " - " only.
and at this line it makes it empty :
$string = trim($string, '-');
That's all, so what pattern should I used that wont effect Arabic letters, I'm not a regex expert!.
The text was updated successfully, but these errors were encountered: