You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today.

Postup pri premenovaní obrázkov v Opencartu

Popíšeme ako v Opencarte premenujeme zle založenú štruktúru obrázkov

Presťahovať tabuľky nižšie do databáze s právom root

oc_banner_image
oc_category
oc_language
oc_location
oc_manufacturer
oc_option_value
oc_product
oc_product_image
oc_product_option_value_data
oc_simple_blog_article
oc_simple_blog_author
oc_simple_blog_category
oc_user
oc_voucher_theme

Inštalovať do databáze s právom root nasledujúcu funkciu


DROP FUNCTION IF EXISTS fn_remove_accents;

DELIMITER |

CREATE FUNCTION fn_remove_accents( textvalue VARCHAR(10000) ) RETURNS VARCHAR(10000)



BEGIN



    SET @textvalue = textvalue;



    -- ACCENTS

    SET @withaccents = ’QWERTYUIOPASDFGHJKLZXCVBNMŠšŽžÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝŸÞàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿþƒ _’;

    SET @withoutaccents = ’qwertyuiopasdfghjklzxcvbnmsszzaaaaaaaceeeeiiiinoooooouuuuyybaaaaaaaceeeeiiiinoooooouuuuyybf--’;

    SET @count = LENGTH(@withaccents);



    WHILE @count > 0 DO

        SET @textvalue = REPLACE(@textvalue, SUBSTRING(@withaccents, @count, 1), SUBSTRING(@withoutaccents, @count, 1));

        SET @count = @count - 1;

    END WHILE;



    -- SPECIAL CHARS

    SET @special = ’!@#$%¨&*()+=§¹²³£¢¬"`´{[^~}]<,>:;?°ºª+*|’’’;

    SET @count = LENGTH(@special);

    

    WHILE @count > 0 do

        SET @textvalue = REPLACE(@textvalue, SUBSTRING(@special, @count, 1), ’’);

        SET @count = @count - 1;

    END WHILE;



    RETURN @textvalue;



END

|

DELIMITER;

Spustit v phpmyadmin

update oc_banner_image set `image` = fn_remove_accents(`image`);
update oc_category set `image` = fn_remove_accents(`image`);
update oc_language set `image` = fn_remove_accents(`image`);
update oc_location set `image` = fn_remove_accents(`image`);
update oc_manufacturer set `image` = fn_remove_accents(`image`);
update oc_option_value set `image` = fn_remove_accents(`image`);
update oc_product set `image` = fn_remove_accents(`image`);
update oc_product_image set `image` = fn_remove_accents(`image`);
update oc_product_option_value_data set `image` = fn_remove_accents(`image`);
update oc_simple_blog_article set `image` = fn_remove_accents(`image`);
update oc_simple_blog_author set `image` = fn_remove_accents(`image`);
update oc_simple_blog_category set `image` = fn_remove_accents(`image`);
update oc_user set `image` = fn_remove_accents(`image`);
update oc_voucher_theme set `image` = fn_remove_accents(`image`);

Pokračovanie prácou v total commenderu

  1. Prejsť do složky image
  2. Alt+F7, žiadny filter na meno súborov, hľadať v podsložkách
  3. Výsledok zobraziť v panelu
  4. Vybrať všetko (Ctrl+a)
  5. Hromadné premenovanie Ctrl+m
    1. Zvoliť iba malé písmená,
    2. Do políčka "hľadať"
      
      Q|W|E|R|T|Y|U|I|O|P|A|S|D|F|G|H|J|K|L|Z|X|C|V|B|N|M|Š|š|Ž|ž|À|Á|Â|Ã|Ä|Å|Æ|Ç|È|É|Ê|Ë|Ì|Í|Î|Ï|Ñ|Ò|Ó|Ô|Õ|Ö|Ø|Ù|Ú|Û|Ü|Ý|Ÿ|Þ|à|á|â|ã|ä|å|æ|ç|è|é|ê|ë|ì|í|î|ï|ñ|ò|ó|ô|õ|ö|ø|ù|ú|û|ü|ý|ÿ|þ|ƒ| |_|
      do políčka "nahradiť"
      
      q|w|e|r|t|y|u|i|o|p|a|s|d|f|g|h|j|k|l|z|x|c|v|b|n|m|s|s|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|y|b|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|y|b|f|-|-|
    3. Spustiť