VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: p.barg on November 26, 2017, 16:17:04 PM

Title: VM 3.2.6 invoice not in shop language [solved]
Post by: p.barg on November 26, 2017, 16:17:04 PM
Hello,
after updating VM 3.2.4 to 3.2.6 the invoices are no longer created in shop language, but in English.
The site is mulitlingual (German, English), the shop language is set to German and the option "invoice in user language"
is disabled.
Am I missing something?

-- Petra
Title: Re: VM 3.2.6 invoice not in shop language
Post by: Milbo on November 27, 2017, 21:21:57 PM
Hmmm, no clue, I have to take a look. can you please post me the vmdebug, the language line?

I just wonder about, the used line (at least by your settings) is shopFunctionsF::loadOrderLanguages(VmConfig::$jDefLangTag);

I just wonder, what is your VmConfig::$jDefLangTag? and the VmConfig::$vmlangTag; in FE/controllers/invoice.php line 232 ?
Title: Re: VM 3.2.6 invoice not in shop language
Post by: p.barg on November 28, 2017, 09:33:28 AM
This is the debug line in backend:
1 vmdebug 2 Languages, default shoplanguage (VmConfig::$jDefLang): de_de de-DE Selected VM language (VmConfig::$vmlang): de_de de-DE SEF: de

In frontend it looks like this:
1 vmdebug 2 Languages, default shoplanguage (VmConfig::$jDefLang): de_de de-DE Fallback language (VmConfig::$defaultLang): de_de Selected VM language (VmConfig::$vmlang): en_gb en-GB SEF: en

Title: Re: VM 3.2.6 invoice not in shop language
Post by: Milbo on November 28, 2017, 12:27:34 PM
So jDefLang point to german. I also just tested it locally and it works fine for me. Hmm, I just notice, it works fine for me using the Backend.

When I am in the frontend and browse the german store in english, I see this vmdebug 2 Languages, default shoplanguage (VmConfig::$jDefLang): de_de de-DE Fallback language (VmConfig::$defaultLang): de_de Selected VM language (VmConfig::$vmlang): en_gb en-GB SEF: en

That means that (VmConfig::$jDefLang): de_de is indeed the correct value for the invoice.

Ahhh, there is it. I think I found it.

Please try in the controller/invoice.php around line 227, this here:

if(VmConfig::get('invoiceInUserLang', false) and !empty($orderDetails['details']) and !empty($orderDetails['details']['BT']->order_language)) {
$orderLang = $orderDetails['details']['BT']->order_language;
} else {
$orderLang = VmConfig::$jDefLangTag;
}

shopFunctionsF::loadOrderLanguages($orderLang);
if($orderLang!=VmConfig::$vmlangTag){
$orderDetails = $orderModel->getOrder($orderDetails['details']['BT']->virtuemart_order_id);
}


I did not reload the order. And the function "getOrder" uses translations, so we must call it after loading the new order language
Title: Re: VM 3.2.6 invoice not in shop language
Post by: p.barg on November 28, 2017, 13:30:52 PM
I've tested that from the backend and frontend and the invoice is still in English...
Title: Re: VM 3.2.6 invoice not in shop language
Post by: p.barg on December 07, 2017, 16:46:15 PM
Solved in VM 3.2.8