Như các bạn đã biết Opencart SEO Pack Pro là 1 module SEO cho Opencart hiệu quả nhất và tốt nhất hiện nay. Nó có chức năng tự động tạo url thân thiện cho trang bán hàng của bạn. Tuy nhiên nếu tên sản phẩm là tiếng việt thì chức năng Auto generate SEO URL này hoạt động thật sự không được tốt lắm.
Ví dụ: tên sản phẩm bạn nhập vào là “Kem trị nám và xóa nhăn Removing Cream” thì nó sẽ tạo url thành “kem-tr-i-nam-va-x-a-nh-n-removing-cream.html” nhìn trông thật chướng mắt nhỉ ? Tuy nhiên để khắc phục tình trạng này, bạn chỉ cần làm theo các bước sau đây
Bước 1: Tìm đến thư mục admin/controller/catalog mở file seopack.php lên, tìm đến đoạn:
$cyr = array(
“й”=>”i”,”ц”=>”c”,”у”=>”u”,”к”=>”k”,”е”=>”e”,”н”=>”n”,
“г”=>”g”,”ш”=>”sh”,”щ”=>”sh”,”з”=>”z”,”х”=>”x”,”ъ”=>”‘”,
“ф”=>”f”,”ы”=>”i”,”в”=>”v”,”а”=>”a”,”п”=>”p”,”р”=>”r”,
“о”=>”o”,”л”=>”l”,”д”=>”d”,”ж”=>”zh”,”э”=>”ie”,”ё”=>”e”,
“я”=>”ya”,”ч”=>”ch”,”с”=>”c”,”м”=>”m”,”и”=>”i”,”т”=>”t”,
“ь”=>”‘”,”б”=>”b”,”ю”=>”yu”,
“Й”=>”I”,”Ц”=>”C”,”У”=>”U”,”К”=>”K”,”Е”=>”E”,”Н”=>”N”,
“Г”=>”G”,”Ш”=>”SH”,”Щ”=>”SH”,”З”=>”Z”,”Х”=>”X”,”Ъ”=>”‘”,
“Ф”=>”F”,”Ы”=>”I”,”В”=>”V”,”А”=>”A”,”П”=>”P”,”Р”=>”R”,
“О”=>”O”,”Л”=>”L”,”Д”=>”D”,”Ж”=>”ZH”,”Э”=>”IE”,”Ё”=>”E”,
“Я”=>”YA”,”Ч”=>”CH”,”С”=>”C”,”М”=>”M”,”И”=>”I”,”Т”=>”T”,
“Ь”=>”‘”,”Б”=>”B”,”Ю”=>”YU”
);
$gr = array(
“Β” => “V”, “Γ” => “Y”, “Δ” => “Th”, “Ε” => “E”, “Ζ” => “Z”, “Η” => “E”,
“Θ” => “Th”, “Ι” => “i”, “Κ” => “K”, “Λ” => “L”, “Μ” => “M”, “Ν” => “N”,
“Ξ” => “X”, “Ο” => “O”, “Π” => “P”, “Ρ” => “R”, “Σ” => “S”, “Τ” => “T”,
“Υ” => “E”, “Φ” => “F”, “Χ” => “Ch”, “Ψ” => “Ps”, “Ω” => “O”, “α” => “a”,
“β” => “v”, “γ” => “y”, “δ” => “th”, “ε” => “e”, “ζ” => “z”, “η” => “e”,
“θ” => “th”, “ι” => “i”, “κ” => “k”, “λ” => “l”, “μ” => “m”, “ν” => “n”,
“ξ” => “x”, “ο” => “o”, “π” => “p”, “ρ” => “r”, “σ” => “s”, “τ” => “t”,
“υ” => “e”, “φ” => “f”, “χ” => “ch”, “ψ” => “ps”, “ω” => “o”, “ς” => “s”,
“ς” => “s”, “ς” => “s”, “ς” => “s”, “έ” => “e”, “ί” => “i”, “ά” => “a”,
“ή” => “e”, “ώ” => “o”, “ό” => “o”
);
$arabic = array(
“ا”=>”a”, “أ”=>”a”, “آ”=>”a”, “إ”=>”e”, “ب”=>”b”, “ت”=>”t”, “ث”=>”th”, “ج”=>”j”,
“ح”=>”h”, “خ”=>”kh”, “د”=>”d”, “ذ”=>”d”, “ر”=>”r”, “ز”=>”z”, “س”=>”s”, “ش”=>”sh”,
“ص”=>”s”, “ض”=>”d”, “ط”=>”t”, “ظ”=>”z”, “ع”=>”‘e”, “غ”=>”gh”, “ف”=>”f”, “ق”=>”q”,
“ك”=>”k”, “ل”=>”l”, “م”=>”m”, “ن”=>”n”, “ه”=>”h”, “و”=>”w”, “ي”=>”y”, “ى”=>”a”,
“ئ”=>”‘e”, “ء”=>”‘”,
“ؤ”=>”‘e”, “لا”=>”la”, “ة”=>”h”, “؟”=>”?”, “!”=>”!”,
“ـ”=>””,
“،”=>”,”,
“َ”=>”a”, “ُ”=>”u”, “ِ”=>”e”, “ٌ”=>”un”, “ً”=>”an”, “ٍ”=>”en”, “ّ”=>””
);
$persian = array(
“ا”=>”a”, “أ”=>”a”, “آ”=>”a”, “إ”=>”e”, “ب”=>”b”, “ت”=>”t”, “ث”=>”th”,
“ج”=>”j”, “ح”=>”h”, “خ”=>”kh”, “د”=>”d”, “ذ”=>”d”, “ر”=>”r”, “ز”=>”z”,
“س”=>”s”, “ش”=>”sh”, “ص”=>”s”, “ض”=>”d”, “ط”=>”t”, “ظ”=>”z”, “ع”=>”‘e”,
“غ”=>”gh”, “ف”=>”f”, “ق”=>”q”, “ك”=>”k”, “ل”=>”l”, “م”=>”m”, “ن”=>”n”,
“ه”=>”h”, “و”=>”w”, “ي”=>”y”, “ى”=>”a”, “ئ”=>”‘e”, “ء”=>”‘”,
“ؤ”=>”‘e”, “لا”=>”la”, “ک”=>”ke”, “پ”=>”pe”, “چ”=>”che”, “ژ”=>”je”, “گ”=>”gu”,
“ی”=>”a”, “ٔ”=>””, “ة”=>”h”, “؟”=>”?”, “!”=>”!”,
“ـ”=>””,
“،”=>”,”,
“َ”=>”a”, “ُ”=>”u”, “ِ”=>”e”, “ٌ”=>”un”, “ً”=>”an”, “ٍ”=>”en”, “ّ”=>””
);
$normalize = array(
‘Š’=>’S’, ‘š’=>’s’, ‘Ð’=>’Dj’,’Ž’=>’Z’, ‘ž’=>’z’, ‘À’=>’A’, ‘Á’=>’A’, ‘Â’=>’A’, ‘Ã’=>’A’, ‘Ä’=>’A’,
‘Å’=>’A’, ‘Æ’=>’A’, ‘Ç’=>’C’, ‘È’=>’E’, ‘É’=>’E’, ‘Ê’=>’E’, ‘Ë’=>’E’, ‘Ì’=>’I’, ‘Í’=>’I’, ‘Î’=>’I’,
‘Ï’=>’I’, ‘Ñ’=>’N’, ‘Ò’=>’O’, ‘Ó’=>’O’, ‘Ô’=>’O’, ‘Õ’=>’O’, ‘Ö’=>’O’, ‘Ø’=>’O’, ‘Ù’=>’U’, ‘Ú’=>’U’,
‘Û’=>’U’, ‘Ü’=>’U’, ‘Ý’=>’Y’, ‘Þ’=>’B’, ‘ß’=>’Ss’,’à’=>’a’, ‘á’=>’a’, ‘â’=>’a’, ‘ã’=>’a’, ‘ä’=>’a’,
‘å’=>’a’, ‘æ’=>’a’, ‘ç’=>’c’, ‘è’=>’e’, ‘é’=>’e’, ‘ê’=>’e’, ‘ë’=>’e’, ‘ì’=>’i’, ‘í’=>’i’, ‘î’=>’i’,
‘ï’=>’i’, ‘ð’=>’o’, ‘ñ’=>’n’, ‘ò’=>’o’, ‘ó’=>’o’, ‘ô’=>’o’, ‘õ’=>’o’, ‘ö’=>’o’, ‘ø’=>’o’, ‘ù’=>’u’,
‘ú’=>’u’, ‘û’=>’u’, ‘ý’=>’y’, ‘ý’=>’y’, ‘þ’=>’b’, ‘ÿ’=>’y’, ‘ƒ’=>’f’, ‘Ğ’=>’G’, ‘Ş’=>’S’, ‘Ü’=>’U’,
‘ü’=>’u’, ‘Ẑ’=>’Z’, ‘ẑ’=>’z’, ‘Ǹ’=>’N’, ‘ǹ’=>’n’, ‘Ò’=>’O’, ‘ò’=>’o’, ‘Ù’=>’U’, ‘ù’=>’u’, ‘Ẁ’=>’W’,
‘ẁ’=>’w’, ‘Ỳ’=>’Y’, ‘ỳ’=>’y’, ‘č’=>’c’, ‘Č’=>’C’
);
$result = html_entity_decode($phrase, ENT_COMPAT, “UTF-8”);
$result = strtr($result, $cyr);
$result = strtr($result, $gr);
$result = strtr($result, $arabic);
$result = strtr($result, $persian);
$result = strtr($result, $normalize);
$result = strtolower($this->_transliteration_process($result));
Bước 2: Thay thế đoạn vừa tìm được bằng đoạn code dưới đây rồi sau đó lưu lại:
$normalize = array(
‘à’=>’a’,’á’=>’a’,’ả’=>’a’,’ã’=>’a’,’ạ’=>’a’,
‘ă’=>’a’,’ằ’=>’a’,’ắ’=>’a’,’ẳ’=>’a’,’ẵ’=>’a’,’ặ’=>’a’,
‘â’=>’a’,’ầ’=>’a’,’ấ’=>’a’,’ẩ’=>’a’,’ẫ’=>’a’,’ậ’=>’a’,
‘À’=>’a’,’Á’=>’a’,’Ả’=>’a’,’Ã’=>’a’,’Ạ’=>’a’,
‘Ă’=>’a’,’Ằ’=>’a’,’Ắ’=>’a’,’Ẳ’=>’a’,’Ẵ’=>’a’,’Ặ’=>’a’,
‘Â’=>’a’,’Ầ’=>’a’,’Ấ’=>’a’,’Ẩ’=>’a’,’Ẫ’=>’a’,’Ậ’=>’a’,
‘đ’=>’d’,’Đ’=>’d’,
‘è’=>’e’,’é’=>’e’,’ẻ’=>’e’,’ẽ’=>’e’,’ẹ’=>’e’,
‘ê’=>’e’,’ề’=>’e’,’ế’=>’e’,’ể’=>’e’,’ễ’=>’e’,’ệ’=>’e’,
‘È’=>’e’,’É’=>’e’,’Ẻ’=>’e’,’Ẽ’=>’e’,’Ẹ’=>’e’,
‘Ê’=>’e’,’Ề’=>’e’,’Ế’=>’e’,’Ể’=>’e’,’Ễ’=>’e’,’Ệ’=>’e’,
‘ì’=>’i’,’í’=>’i’,’ỉ’=>’i’,’ĩ’=>’i’,’ị’=>’i’,
‘Ì’=>’i’,’Í’=>’i’,’Ỉ’=>’i’,’Ĩ’=>’i’,’Ị’=>’i’,
‘ò’=>’o’,’ó’=>’o’,’ỏ’=>’o’,’õ’=>’o’,’ọ’=>’o’,
‘ô’=>’o’,’ồ’=>’o’,’ố’=>’o’,’ổ’=>’o’,’ỗ’=>’o’,’ộ’=>’o’,
‘ơ’=>’o’,’ờ’=>’o’,’ớ’=>’o’,’ở’=>’o’,’ỡ’=>’o’,’ợ’=>’o’,
‘Ò’=>’o’,’Ó’=>’o’,’Ỏ’=>’o’,’Õ’=>’o’,’Ọ’=>’o’,
‘Ô’=>’o’,’Ồ’=>’o’,’Ố’=>’o’,’Ổ’=>’o’,’Ỗ’=>’o’,’Ộ’=>’o’,
‘Ơ’=>’o’,’Ờ’=>’o’,’Ớ’=>’o’,’Ở’=>’o’,’Ỡ’=>’o’,’Ợ’=>’o’,
‘ù’=>’u’,’ú’=>’u’,’ủ’=>’u’,’ũ’=>’u’,’ụ’=>’u’,
‘ư’=>’u’,’ừ’=>’u’,’ứ’=>’u’,’ử’=>’u’,’ữ’=>’u’,’ự’=>’u’,
‘Ù’=>’u’,’Ú’=>’u’,’Ủ’=>’u’,’Ũ’=>’u’,’Ụ’=>’u’,
‘Ư’=>’u’,’Ừ’=>’u’,’Ứ’=>’u’,’Ử’=>’u’,’Ữ’=>’u’,’Ự’=>’u’,
‘ỳ’=>’y’,’ý’=>’y’,’ỷ’=>’y’,’ỹ’=>’y’,’ỵ’=>’y’,
‘Y’=>’y’,’Ỳ’=>’y’,’Ý’=>’y’,’Ỷ’=>’y’,’Ỹ’=>’y’,’Ỵ’=>’y’
);
$result = html_entity_decode($phrase, ENT_COMPAT, “UTF-8”);
$result = strtr($result, $normalize);
$result = strtolower($this->_transliteration_process($result));
Bước 3: Đăng nhập vào trang quản trị Opencart bằng tài khoản admin, sau đó vào Catalog -> SEO -> SEO Pack và click vào Clear SEO Urls để xóa các url SEO cũ sau đó bạn click vào SEO Urls Generator để Opencart SEO Pack Pro tạo url mới.
Bây giờ bạn hãy vào trang front store xem kết quả đã thay đổi chưa nha. Trong quá trình fix lỗi SEO Urls Generator của Opencart SEO Pack Pro, nếu có gì thắc mắc, các bạn hãy comment bên dưới !