Polytonic letters to latin SEO

Ok here is our first free tip for all you CS-Cart users.
We ran into this problem working on Greek websites, If the category, product, page etc. had a Greek title, the automated SEO URL would leave out all polytonic letters producing a not so friendly URL.

To get around this, we added the code below in the file addons/seo/func.php
after line 116 or whatever line you have this:

function fn_create_seo_name($object_id, $object_type, $object_name, $index = 0, $dispatch = '', $company_id = '', $lang_code = CART_LANGUAGE)
{

add the below code, replacing the first letter in quotes in every object name with your languages polytonic letter, and the latin equivalent in the second letter in quotes:

// polytonic seo hack //
$object_name = str_replace("ς", "s", $object_name);
$object_name = str_replace("ε", "e", $object_name);
$object_name = str_replace("Ε", "E", $object_name);
$object_name = str_replace("έ", "e", $object_name);
$object_name = str_replace("Έ", "E", $object_name);
$object_name = str_replace("ρ", "r", $object_name);
$object_name = str_replace("Ρ", "R", $object_name);
$object_name = str_replace("τ", "t", $object_name);
$object_name = str_replace("Τ", "T", $object_name);
$object_name = str_replace("υ", "u", $object_name);
$object_name = str_replace("Υ", "Y", $object_name);
$object_name = str_replace("ύ", "u", $object_name);
$object_name = str_replace("Ύ", "Υ", $object_name);
$object_name = str_replace("θ", "th", $object_name);
$object_name = str_replace("Θ", "TH", $object_name);
$object_name = str_replace("ι", "i", $object_name);
$object_name = str_replace("É", "Ι", $object_name);
$object_name = str_replace("Ί", "I", $object_name);
$object_name = str_replace("ί", "i", $object_name);
$object_name = str_replace("ϊ", "i", $object_name);
$object_name = str_replace("ο", "o", $object_name);
$object_name = str_replace("ό", "o", $object_name);
$object_name = str_replace("Ο", "O", $object_name);
$object_name = str_replace("Ο", "O", $object_name);
$object_name = str_replace("Ό", "O", $object_name);
$object_name = str_replace("π", "p", $object_name);
$object_name = str_replace("Π", "P", $object_name);
$object_name = str_replace("α", "a", $object_name);
$object_name = str_replace("ά", "a", $object_name);
$object_name = str_replace("Α", "A", $object_name);
$object_name = str_replace("Ά", "A", $object_name);
$object_name = str_replace("σ", "s", $object_name);
$object_name = str_replace("Σ", "S", $object_name);
$object_name = str_replace("δ", "d", $object_name);
$object_name = str_replace("Δ", "D", $object_name);
$object_name = str_replace("Φ", "F", $object_name);
$object_name = str_replace("φ", "f", $object_name);
$object_name = str_replace("γ", "g", $object_name);
$object_name = str_replace("Γ", "G", $object_name);
$object_name = str_replace("η", "i", $object_name);
$object_name = str_replace("ή", "i", $object_name);
$object_name = str_replace("Η", "I", $object_name);
$object_name = str_replace("Ή", "I", $object_name);
$object_name = str_replace("ξ", "ks", $object_name);
$object_name = str_replace("Ξ", "KS", $object_name);
$object_name = str_replace("κ", "k", $object_name);
$object_name = str_replace("Κ", "K", $object_name);
$object_name = str_replace("λ", "l", $object_name);
$object_name = str_replace("Λ", "L", $object_name);
$object_name = str_replace("ζ", "z", $object_name);
$object_name = str_replace("Ζ", "Z", $object_name);
$object_name = str_replace("χ", "ch", $object_name);
$object_name = str_replace("Χ", "CH", $object_name);
$object_name = str_replace("Ψ", "PS", $object_name);
$object_name = str_replace("ψ", "PS", $object_name);
$object_name = str_replace("ω", "o", $object_name);
$object_name = str_replace("ώ", "o", $object_name);
$object_name = str_replace("ω", "o", $object_name);
$object_name = str_replace("Ώ", "o", $object_name);
$object_name = str_replace("β", "v", $object_name);
$object_name = str_replace("β", "v", $object_name);
$object_name = str_replace("Β", "v", $object_name);
$object_name = str_replace("ν", "n", $object_name);
$object_name = str_replace("N", "N", $object_name);
$object_name = str_replace("μ", "m", $object_name);
$object_name = str_replace("Μ", "M", $object_name);
$object_name = str_replace("Ί", "I", $object_name);
$object_name = str_replace("&", "kai", $object_name);
// polytonic seo hack end //

** DONT FORGET THAT THIS WILL WORK FOR NEW PRODUCTS ADDED, FOR EXISTING PRODUCTS YOU HAVE TO GO TO THE PRODUCTS PAGE AND DELETE THE SEO NAME IN THE ADD-ONS TAB, IF YOU HAVE HUNDREDS OF PRODUCTS YOU CAN ALWAYS DELETE THE SEO NAME FROM THE DATABASE (as always before doing anything to your database, we suggest you make a backup first) **

 

Comments

*****

Nice Post...Good day! I just wish to give a huge thumbs up for the nice data you may have right here on this post. I might be coimng back to your blog for extra soon....

Loading...