Jump to content

And work with cold Russian...


moros

Recommended Posts

open

./classes/Tools.php

find this

public static function link_rewrite($str, $utf8_decode = false)
{
 return Tools::translit($str); <-- Make it
 //~ return Tools::str2url(Tools::translit($str)); <-- Comment it
}

after this, type next code

public static function translit($str)
{
 $tr = array(
  "А"=>"a",
  "Б"=>"b",
  "В"=>"v",
  "Г"=>"g",
  "Д"=>"d",
  "Е"=>"e",
  "Ж"=>"j",
  "З"=>"z",
  "И"=>"i",
  "Й"=>"y",
  "К"=>"k",
  "Л"=>"l",
  "М"=>"m",
  "Н"=>"n",
  "О"=>"o",
  "П"=>"p",
  "Р"=>"r",
  "С"=>"s",
  "Т"=>"t",
  "У"=>"u",
  "Ф"=>"f",
  "Х"=>"h",
  "Ц"=>"ts",
  "Ч"=>"ch",
  "Ш"=>"sh",
  "Щ"=>"sch",
  "Ъ"=>"",
  "Ы"=>"yi",
  "Ь"=>"",
  "Э"=>"e",
  "Ю"=>"yu",
  "Я"=>"ya",
  "а"=>"a",
  "б"=>"b",
  "в"=>"v",
  "г"=>"g",
  "д"=>"d",
  "е"=>"e",
  "ж"=>"j",
  "з"=>"z",
  "и"=>"i",
  "й"=>"y",
  "к"=>"k",
  "л"=>"l",
  "м"=>"m",
  "н"=>"n",
  "о"=>"o",
  "п"=>"p",
  "р"=>"r",
  "с"=>"s",
  "т"=>"t",
  "у"=>"u",
  "ф"=>"f",
  "х"=>"h",
  "ц"=>"ts",
  "ч"=>"ch",
  "ш"=>"sh",
  "щ"=>"sch",
  "ъ"=>"y",
  "ы"=>"yi",
  "ь"=>"",
  "э"=>"e",
  "ю"=>"yu",
  "я"=>"ya",
  "-" => "_",
  " "=> "_",
  "."=> "",
  ","=> "",
  "/"=> "_"
 );
 return strtolower(strtr($str,$tr));
}

Ho-ho-ho, now i have translit gun

so, a little more?

post-523731-0-55649900-1364956604_thumb.png

Edited by moros (see edit history)
Link to comment
Share on other sites

Ow guys, sorry, forgot 'bout that

open ./js/admin.js

and add this code

String.prototype.translit = (function(){
var L = {
'А':'A','а':'a','Б':'B','б':'b','В':'V','в':'v','Г':'G','г':'g',
'Д':'D','д':'d','Е':'E','е':'e','Ё':'Yo','ё':'yo','Ж':'Zh','ж':'zh',
'З':'Z','з':'z','И':'I','и':'i','Й':'Y','й':'y','К':'K','к':'k',
'Л':'L','л':'l','М':'M','м':'m','Н':'N','н':'n','О':'O','о':'o',
'П':'P','п':'p','Р':'R','р':'r','С':'S','с':'s','Т':'T','т':'t',
'У':'U','у':'u','Ф':'F','ф':'f','Х':'Kh','х':'kh','Ц':'Ts','ц':'ts',
'Ч':'Ch','ч':'ch','Ш':'Sh','ш':'sh','Щ':'Sch','щ':'sch','Ъ':'"','ъ':'"',
'Ы':'Y','ы':'y','Ь':"'",'ь':"'",'Э':'E','э':'e','Ю':'Yu','ю':'yu',
'Я':'Ya','я':'ya'
	},
	r = '',
	k;
for (k in L) r += k;
r = new RegExp('[' + r + ']', 'g');
k = function(a){
	return a in L ? L[a] : '';
};
return function(){
	return this.replace(r, k);
};
})();

then find here this func copy2friendlyURL()

and make it like this

function copy2friendlyURL()
{
if (typeof(id_product) == 'undefined')
 id_product = false;

if (!$('#link_rewrite_' + id_language).val().length || !id_product)//check if user didn't type anything in rewrite field, to prevent overwriting
{
 $('#link_rewrite_' + id_language).val(str2url($('#name_' + id_language).val().translit().replace(/^[0-9]+\./, ''), 'UTF-8').replace('%', ''));
 if ($('#friendly-url'))
  $('#friendly-url').html($('#link_rewrite_' + id_language).val());
 // trigger onchange event to use anything binded there
 $('#link_rewrite_' + id_language).change();
}
return;
}

then find copyMeta2friendlyURL

and make it like

function copyMeta2friendlyURL()
{
$('#input_link_rewrite_' + id_language).val(str2url($('#name_' + id_language).val().translit().replace(/^[0-9]+\./, ''), 'UTF-8'));
}

viola, nous avons a cool transliterated links by clicking on Generate btn

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...