News:

Support the VirtueMart project and become a member

Main Menu

Disable Unicode/transliteral aliases

Started by Piszi, July 20, 2017, 05:10:14 AM

Previous topic - Next topic

Piszi

Hello,

I was searching for an option to somehow disable unicode aliases because i don't want to use it and it causes MySQL error (1267 - Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '=')
So because I did not find an option for that in VM config I searched the forum and found that there is a switch for that but you have to modify VM config manually.
First I tried the suggestion found here to add transliterateSlugs=1 to virtuemart.cfg but that did nothing than I put the same into the VM config db table but like this transliterateSlugs="1" and that did the trick.

But I was asking my selve what if I want to change my settings than I will have to go into the db and change it again.
Than I thought why not add this option to the config template that way it would remain even after doing changes in settings. And so I did.
If some one is interested I put this line echo VmHTML::row('checkbox','Do not use Unicode Aliases','transliterateSlugs',VmConfig::get('transliterateSlugs',1)); into default_sef.php

Than I was thinking what if I update VM?
I think it would be nice to add this line to the next update for VM.
Or maybe you could do something crazy and make unikode aliases dependent from Joomla unicode aliases setting.
Maybe like this
//Original VM code from vmtable.php
//$unicodeslugs = VmConfig::get('transliterateSlugs',false);
//if($unicodeslugs){
//$lang = JFactory::getLanguage();
//$this->$slugName = $lang->transliterate($this->$slugName);
//}

//My suggestion
$unicodeslugs = JFactory::getConfig()->get('unicodeslugs');
if($unicodeslugs == 0){ //if I'm not mistaken
$lang = JFactory::getLanguage();
$this->$slugName = $lang->transliterate($this->$slugName);
}


And maybe this whole post is pointless and I missed a checkbox somewhere "hidden" in VM and there is an option to turn off unicode aliases.