Hello everybody,
i have a problem with URL keys related to german umlauts that are automatically generated by Magento2.
We have a lot of products / categories with umlauts (äüö ..), their URL-Keys were generated automatically by magento2. An "ä" for example is replaced by an "a", an "ü" is replaced by an "u" etc.
Example:
Category name: "Küchenmaschine" -> https://shop.de/kuchenmaschine
but the correct url-key would be https://shop.de/kuechenmaschine.
Somebody have an idea, how i can change the mapping of the umlauts?
I am grateful for your help.
Hello @workID,
Change URL key for products, I suggested to you that export all product with sku, name and url key and after correct all umlauts key as per reference of name then import it
Here A GUIDE ON HOW TO IMPORT AND EXPORT PRODUCTS IN MAGENTO 2
Change URL key for category, I think you have to change it by manually.
--
If you've found my answer useful, please give "Kudos" or "Accept as Solution"
Is this really the only solution in 2019 in Magento 2???
Update 2020-05-15: There is now an open source module for that. See https://github.com/integer-net/magento2-german-umlaut-urls.
This is my solution. You need two files and an existing module.
1. etc/di.xml:
<?xml version="1.0" ?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\Framework\Filter\TranslitUrl" type="Namespace\Module\Filter\TranslitUrl"/> </config>
2. Filter/TranslitUrl:
<?php declare(strict_types=1); namespace Namespace\Module\Filter; class TranslitUrl extends \Magento\Framework\Filter\TranslitUrl { /** * Add correct German Umlauts transliteration * * @return array */ protected function getConvertTable() { $convertTable = $this->convertTable; $convertTable['ä'] = 'ae'; $convertTable['ö'] = 'oe'; $convertTable['ü'] = 'ue'; $convertTable['Ä'] = 'Ae'; $convertTable['Ö'] = 'Oe'; $convertTable['Ü'] = 'Ue'; $convertTable['ß'] = 'ss'; $convertTable['ẞ'] = 'Ss'; return $convertTable; } }
Please replace "Namespace\Module" with your modules' namespace.
After clearing the cache, newly generated URL keys will have correctly transformed Umlauts.