Magento converts non-Latin characters in the URL key of products and categories to Latin characters. How can I use non-Latin characters?
formatUrlKey
in Mage/Catalog/Model/Product/Url.php
uses $_convertTable
in Mage/Catalog/Helper/Product/Url.php
. I've tried to change the code but I can't make Magento save non-Latin URLs and show them correctly in the admin.
I've removed hebrew letters from the $_convertTable as you suggsted. The problem is that the formatUrlKey replaces characters which are not 0-9 or a-z with '-':
public function forma开发者_如何学GotUrlKey($str)
{
$urlKey = preg_replace('#[^0-9a-z]+#i', '-', Mage::helper('catalog/product_url')->format($str));
$urlKey = strtolower($urlKey);
$urlKey = trim($urlKey, '-');
return $urlKey;
}
So I'm overriding this method and changing it to:
$urlKey = preg_replace('#[^0-9a-zא-ת]+#i', '-', Mage::helper('url')->format($str));
Now magento correctly saves and display the url string but it doesn't work in the browser. When trying to access the product url I'm getting 404.
If instead of preg_replace, strtolower and trim I'm using only:
$urlKey = urlencode($str);
It also doesn't work because magento calls formatUrlKey several times. I don't understand why.
Thanks
Hi This extension will help for you.
http://www.magentocommerce.com/magento-connect/alexhost/extension/6587/magefast_seflinkmultilanguage
Since Magento is just blinding converting from the table, deleting entries from the table will prevent Magento from trying to convert them. Override the helper class and delete the entries you don't want to see and you should be pretty well on your way.
As far as displaying them correctly in the admin panel, is this a separate problem you have if you save those non-Latin characters? More specific information would be helpful.
精彩评论