Solution / Bug - vmError: VmTableData Sef Alias in record is missing! [...]

Started by Tanase B., November 11, 2014, 16:56:10 PM

Previous topic - Next topic

Tanase B.

Hi!

I've been struggling with the following error since version 2.6.6 when I introduced more than 2 languages on my store and one of them had some special characters.
vmError: VmTableData Sef Alias in record is missing! Can't save the record with no Sef Alias.

*This happens even with the latest version (2.6.12.2).

Test case:
- J! 2.5 & VM 2.6 - both latest version
- 2 languages (probably it happens even if the website is not multilangual, but the language contains special chars)
- trying to set Category name as "Акции" (it's in russian) and leaving the Sef Alias field empty.
- any host WITHOUT mbstrings installed!
- php 5.4.16 on CentOS

When you'll try to save the category the above error will rase.
So the solution was to install the mbstrings library on my server (php54-php-mbstrings in my case). Now everything works!

Virtuemart code:
1. administrator/components/com_virtuemart/helpers/vmtable.php - line 823:
$this->$slugName = vRequest::filterUword($this->$slugName,'-,_,|','-');
... which calls the following function from
2. administrator/components/com_virtuemart/helpers/vrequest.php - line 45 - 52:
public static function filterUword($source, $custom,$replace=''){
if(function_exists('mb_ereg_replace')){
//$source is string that will be filtered, $custom is string that contains custom characters
return mb_ereg_replace('[^\w'.preg_quote($custom).']', $replace, $source);
} else {
return preg_replace("~[^\w".preg_quote($custom,'~')."]~", $replace, $source); //We use Tilde as separator, and give the preq_quote function the used separator
}
}


So, if mb_ereg_replace function does not exists the slugName is not converted as it should and everything is replaces with dashes: "Акции" will become "--------" and back in vmtable the dashes will be removed so that's why the error says that the Sef Alias is empty.

This is a solution for those who have access to their server, but for those who use shared hosts i think that the filterUword function should be refactored.

Milbo

open the virtuemart.cfg, then enter transliterateSlugs=1.

Save the file and go to the tools and use "Renew config by file". Then use "Install tables or if necessary update them"

In case you use already vm3 (2.9.x) then you can just store the vm config and the value is added.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Tanase B.

Thanks!

I'll keep in mind these steps in case I have another store with the same issue.

Milbo

if you do it the described way, it keeps the configuration even if you update.

and I am just curious, why the heck do you use a server which does not "understand" cyrillic?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Tanase B.

That's a good question!  ;D
My server's default php version is 5.3 and I wanted to use 5.4 on some websites so I did a multiple php versions install and when I installed 5.4 I did it without mbstrings library.