Translate url image аля скрипт для замены кириллицы в названиях изображений (opencart и не только)

Опубликовано: 28.05.2019 в 04:18

Автор:

Категории: Opencart,sql,Бложег

Досталась работа по транслитерации адресов картинок для работы yml парсера, переделанный скрипт который работал для 1.5 выдавал миллион ошибок, написал простые sql запросы

update oc_product_image set image = replace(image, 'а', 'a');
update oc_product_image set image = replace(image, 'б', 'b');
update oc_product_image set image = replace(image, 'в', 'v');
update oc_product_image set image = replace(image, 'г', 'g');
update oc_product_image set image = replace(image, 'д', 'd');
update oc_product_image set image = replace(image, 'е', 'e');
update oc_product_image set image = replace(image, 'ж', 'zh');
update oc_product_image set image = replace(image, 'з', 'z');
update oc_product_image set image = replace(image, 'и', 'i');
update oc_product_image set image = replace(image, 'й', 'y');
update oc_product_image set image = replace(image, 'к', 'k');
update oc_product_image set image = replace(image, 'л', 'l');
update oc_product_image set image = replace(image, 'м', 'm');
update oc_product_image set image = replace(image, 'н', 'n');
update oc_product_image set image = replace(image, 'о', 'o');
update oc_product_image set image = replace(image, 'п', 'p');
update oc_product_image set image = replace(image, 'р', 'r');
update oc_product_image set image = replace(image, 'с', 's');
update oc_product_image set image = replace(image, 'т', 't');
update oc_product_image set image = replace(image, 'у', 'u');
update oc_product_image set image = replace(image, 'ф', 'f');
update oc_product_image set image = replace(image, 'х', 'h');
update oc_product_image set image = replace(image, 'ц', 'c');
update oc_product_image set image = replace(image, 'ч', 'ch');
update oc_product_image set image = replace(image, 'ш', 'sh');
update oc_product_image set image = replace(image, 'ы', 'y');
update oc_product_image set image = replace(image, 'ь', 'j');
update oc_product_image set image = replace(image, 'э', 'e');
update oc_product_image set image = replace(image, 'ю', 'yu');
update oc_product_image set image = replace(image, 'я', 'ya');
update oc_product_image set image = replace(image, 'ъ', 'j');
update oc_product_image set image = replace(image, 'ё', 'je');
update oc_product_image set image = replace(image, 'щ', 'sch');

update oc_product_image set image = replace(image, 'А', 'a');
update oc_product_image set image = replace(image, 'Б', 'b');
update oc_product_image set image = replace(image, 'В', 'v');
update oc_product_image set image = replace(image, 'Г', 'g');
update oc_product_image set image = replace(image, 'Л', 'd');
update oc_product_image set image = replace(image, 'Е', 'e');
update oc_product_image set image = replace(image, 'Ж', 'zh');
update oc_product_image set image = replace(image, 'З', 'z');
update oc_product_image set image = replace(image, 'И', 'i');
update oc_product_image set image = replace(image, 'Й', 'y');
update oc_product_image set image = replace(image, 'К', 'k');
update oc_product_image set image = replace(image, 'Л', 'l');
update oc_product_image set image = replace(image, 'М', 'm');
update oc_product_image set image = replace(image, 'Н', 'n');
update oc_product_image set image = replace(image, 'О', 'o');
update oc_product_image set image = replace(image, 'П', 'p');
update oc_product_image set image = replace(image, 'Р', 'r');
update oc_product_image set image = replace(image, 'С', 's');
update oc_product_image set image = replace(image, 'Т', 't');
update oc_product_image set image = replace(image, 'У', 'u');
update oc_product_image set image = replace(image, 'Ф', 'f');
update oc_product_image set image = replace(image, 'Х', 'h');
update oc_product_image set image = replace(image, 'Ц', 'c');
update oc_product_image set image = replace(image, 'Ч', 'ch');
update oc_product_image set image = replace(image, 'Ш', 'sh');
update oc_product_image set image = replace(image, 'Ы', 'y');
update oc_product_image set image = replace(image, 'Ь', 'j');
update oc_product_image set image = replace(image, 'Э', 'e');
update oc_product_image set image = replace(image, 'Ю', 'yu');
update oc_product_image set image = replace(image, 'Я', 'ya');
update oc_product_image set image = replace(image, 'Ъ', 'j');
update oc_product_image set image = replace(image, 'Ё', 'je');
update oc_product_image set image = replace(image, 'Щ', 'sch');

update oc_product_image set image = replace(image, 'A', 'a');
update oc_product_image set image = replace(image, 'B', 'b');
update oc_product_image set image = replace(image, 'V', 'v');
update oc_product_image set image = replace(image, 'G', 'g');
update oc_product_image set image = replace(image, 'D', 'd');
update oc_product_image set image = replace(image, 'E', 'e');
update oc_product_image set image = replace(image, 'ZH', 'zh');
update oc_product_image set image = replace(image, 'Z', 'z');
update oc_product_image set image = replace(image, 'I', 'i');
update oc_product_image set image = replace(image, 'Y', 'y');
update oc_product_image set image = replace(image, 'K', 'k');
update oc_product_image set image = replace(image, 'L', 'l');
update oc_product_image set image = replace(image, 'M', 'm');
update oc_product_image set image = replace(image, 'N', 'n');
update oc_product_image set image = replace(image, 'O', 'o');
update oc_product_image set image = replace(image, 'P', 'p');
update oc_product_image set image = replace(image, 'R', 'r');
update oc_product_image set image = replace(image, 'S', 's');
update oc_product_image set image = replace(image, 'T', 't');
update oc_product_image set image = replace(image, 'U', 'u');
update oc_product_image set image = replace(image, 'F', 'f');
update oc_product_image set image = replace(image, 'H', 'h');
update oc_product_image set image = replace(image, 'C', 'c');
update oc_product_image set image = replace(image, 'CH', 'ch');
update oc_product_image set image = replace(image, 'SH', 'sh');
update oc_product_image set image = replace(image, 'Y', 'y');
update oc_product_image set image = replace(image, 'J', 'j');
update oc_product_image set image = replace(image, 'E', 'e');
update oc_product_image set image = replace(image, 'YU', 'yu');
update oc_product_image set image = replace(image, 'YA', 'ya');
UPDATE oc_product_image SET IMAGE = REPLACE(IMAGE, 'J', 'j');
UPDATE oc_product_image SET IMAGE = REPLACE(IMAGE, 'JE', 'je');
UPDATE oc_product_image SET IMAGE = REPLACE(IMAGE, 'SCH', 'sch');
update oc_product_image set image = replace(image, 'Q', 'q');
update oc_product_image set image = replace(image, 'W', 'w');
update oc_product_image set image = replace(image, 'X', 'x');
update oc_product_image set image = replace(image, '_', '-');
update oc_product_image set image = replace(image, ' ', '-');
update oc_product_image set image = replace(image, '№', '-');
update oc_product_image set image = replace(image, "'", "-");
update oc_product_image set image = replace(image, ",", "-");
update oc_product_image set image = replace(image, '+', '-');
update oc_product_image set image = replace(image, "(", "-");
update oc_product_image set image = replace(image, ")", "-");

+ тотал командер решает все проблемы =)

Всего комментариев: 0

Оставить комментарий

Ваш email не будет опубликован.

Вы можете использовать следующие HTML тэги: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>