when virtuemart is configurated for different languages we got some bug in the back end
i developped a little additionnal code to update the categorie for the language requested
When we change the language the categorie for the language is refreshed and not only the product name and the Product Alias
in function addStandardEditViewCommands in file vmview.php
around line 197
$j = '
jQuery(function($) {
var oldflag = "";
$("select#vmlang").chosen().change(function() {
langCode = $(this).find("option:selected").val();
flagClass = "flag-"+langCode.substr(0,2) ;
$.getJSON( "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id='.$id.'&editView='.$editView.'&'.$token.'=1" ,
function(data) {
var items = [];
if (data.fields !== "error" ) {
if (data.structure == "empty") alert(data.msg);
$.each(data.fields , function(key, val) {
cible = jQuery("#"+key);
if (oldflag !== "") cible.parent().removeClass(oldflag)
if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) tinyMCE.execInstanceCommand(key,"mceSetContent",false,val);
else if (data.structure !== "empty") cible.val(val);
});
oldflag = flagClass ;
} else alert(data.msg);
}
);';
///addcode
if ($editView=='product'){
$editView='category';
$j .= '
$.getJSON( "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id='.$id.'&editView='.$editView.'&'.$token.'=1" ,
function(data) {
var items = [];
if (data.fields !== "error" ) {
if (data.structure == "empty") alert(data.msg);
$.each(data.fields , function(key, val) {
if (key=="category_name") {
$("#categories option[value='.$id.']").text(val);
$("#categories").trigger("liszt:updated");
}
});
} else alert(data.msg);
} );
';
}
$j .= '});
})';
///addcode
$document->addScriptDeclaration ( $j);
the code inserted is between ///addcode