VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: ereallstaff on April 11, 2012, 17:28:43 PM

Title: [SOLVED ]product Translation problem in a component
Post by: ereallstaff on April 11, 2012, 17:28:43 PM
Hello everybuddy I am trying develping a custom component to insert multi language product with virtuemart.

need to set first a product in italian so I build a product array like this, then call vmModel('product)->store($product) and it's all ok :
    $productVM["vmlang"]="it-IT";
$productVM["product_name"]="prodotto Italiano";
$productVM["slug"]="prodotto Italiano slug";
                        $productVM["product_s_desc"]="prodotto Italiano descrizione breve ";
...........................

and then I try this following and call again vmModel('product)->store($product), but system over write previous values in italian table :

    $productVM["vmlang"]="en-GB";
$productVM["product_name"]="ENGLISH product";
$productVM["slug"]="ENGLISH-produc-slug";
                        $productVM["product_s_desc"]="English product description";
...........................

I assume there should be some step to change current JApplication-> set new language in the middle, but after many trial I was not able to reach them

Could someone help please?
Title: Re: product Translation problem in a component
Post by: Studio 42 on April 11, 2012, 18:33:03 PM
I don't understand all your system. SImply follow the mvc patern to do it work.

For your information a final version of my tranlslator is ready, only some last testing but it work perfect.

If you try to store multiple language the best way is to do it in ajax and changing the vmlang values each time.
If you want do it with a loop then you must use setVar('vmlang';$lang) (and im not sure it work)
Title: Re: product Translation problem in a component
Post by: ereallstaff on April 11, 2012, 22:42:36 PM
Simply following the mvc. What it means, sorry?
I have trying modifying the vmLang simply as you see in the first example but it does not works.  Following my first example it overwrite the ..product_it_it table without inserting on en_gb

Can you confirm that editing only the vmlang variable of a product is enough?

Where I can see your component?
Thanks!
Title: Re: product Translation problem in a component
Post by: ereallstaff on April 12, 2012, 09:39:00 AM
Ok I got it

I though that the first item of the array vmlang could be enough.

but it's not so manually  set


$app->initialise(array(
   'language' => 'en-GB'
));
             
                $b= VmConfig::set('vmlang','en_gb');

And it seems working

Thanks