Question

I have a Magento ver. 1.9.2.4 with friendly url rewrite active. It works, but it is replacing special characters as 'ñ' with '-' and I need to replace them with 'n'.

Now if the product is, for example, named 'piña' in the url rewrite is changed to 'pi-a', and I want to change it to 'pina'.

I do not find any option to change this in the backend, only the URL Rewrite management, but changing it one by one is not an option.

Where is the url rewrite code? I'm thinking about replacing 'ñ' character to 'n' in the string before the url encode, but I'm not finding the code.

Was it helpful?

Solution

Finally I've found a solution and I post it here hoping it helps somebody in the future.

There is an asociative array named $_convertTable, that acts like a conversion table, placed in app/code/core/Mage/Catalog/Helper/Product/Url.php .

In this array there are all the special character conversions, and surprisingly there is no 'ñ' character and there is no 'Ñ' character.

So the solution is override the file. Copy this file in app/code/local/Mage/Catalog/Helper/Product/Url.php and add 'ñ' => 'n', 'Ñ' => 'n', (or the desired characters with their equivalence) at the end of the $_convertTable array.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top