Search code examples
phpmysqljoomlavirtuemart

virtuemart 2 change language native


[Joomla->2.3.2 Virtuemart 2.1]

Hello everybody I am currently developing a fast webservice webapp to connect to joomla and virtuemart and insert a product.

I am having difficulties with multilanguage.

I send a product array as following:

            $product['vmlang'] = 'en-GB';
            $product['product_name'] = 'Red shirt';
            $product['product_description'] = 'Red shirt very nice';

..............

And then I want to translate in italian so I change and pass:

 $product['vmlang'] = 'it-IT';
 $product['product_name'] = 'Maglia Rossa';
 $product['product_description'] = 'Maglia Rossa molto carina';

..............

But it doesn't work: it overwrites the first values in table #_virtuemart_product_en_gb instead of inserting new fields in #_virtuemart_product_it_it

Looking at workflow from joomla panel, it seems first change the JApplication and virtuemart language and then do vmModel('product')->store() with the new language.

From backend the VirtuemartControllerTranslate is called with ->paste task but it doesn't seems to change the app language.

Which can be the problem?

Thanks


Solution

  • I answer by my self

    you should put following to change language. hope this help

    $b= VmConfig::set('vmlang','en_gb');