willemt Posted October 30, 2011 Share Posted October 30, 2011 The invoice of an order is always in the language of the admin, not in the language the customer ordered in. I had this problem since forever I started using prestashop, but I could always change the language in the admin quickly an get the right invoice language anyway. I'm testing 1.4.5.1 before upgrading and noticed this is still the same. The invoice is not in the customers language. Is there a fix for this, cannot find anything on this topic. So if anyove orders in German, the invoice should be in German I cannot print and send a dutch invoice to a German customer. Please help. Link to comment Share on other sites More sharing options...
willemt Posted November 3, 2011 Author Share Posted November 3, 2011 nobody having this problem or a fix? Link to comment Share on other sites More sharing options...
tuk66 Posted November 3, 2011 Share Posted November 3, 2011 Do you have German translations for PDF invoice? If not the invoice will be in English even if customer's language is German. Link to comment Share on other sites More sharing options...
willemt Posted November 6, 2011 Author Share Posted November 6, 2011 Do you have German translations for PDF invoice? If not the invoice will be in English even if customer's language is German. All translations are in place. If I set my admin account to german, I get a german invoice. If I set it to Dutch I get a dutch invoice and the sam for english. The problem is I have to change the language in my admin account to get the invoice in the right language. This is very time consuming if you have al lot of orders. A second print invoice button to print in the customer language to send with the package would be ideal. I'm suprised nobody has the same problem.... Link to comment Share on other sites More sharing options...
Malk Posted November 15, 2011 Share Posted November 15, 2011 willemt i have the same problem did you find any solution ? Link to comment Share on other sites More sharing options...
fkreileman Posted December 21, 2011 Share Posted December 21, 2011 willemt i have the same problem did you find any solution ? Same here.. Any solution yet? Link to comment Share on other sites More sharing options...
willemt Posted March 17, 2012 Author Share Posted March 17, 2012 FInd the solution here: http://www.prestashop.com/forums/topic/155422-module-download-invoice-in-customer-language/page__p__780034#entry780034 Kind regards Willem 1 Link to comment Share on other sites More sharing options...
selin Posted April 24, 2014 Share Posted April 24, 2014 Local -> Translate -> PDF .. Link to comment Share on other sites More sharing options...
tuk66 Posted April 25, 2014 Share Posted April 25, 2014 Local -> Translate -> PDF doesn't solve willemt's problem. There is difference between the invoice created by the customer in Front Office and the administrator in Back Office. Link to comment Share on other sites More sharing options...
webcorvo Posted May 9, 2014 Share Posted May 9, 2014 (edited) Local -> Translate -> PDF doesn't solve willemt's problem. There is difference between the invoice created by the customer in Front Office and the administrator in Back Office. I have the Version 1.6.0.6 I have the same problem. Where in code i can change de pdf translation? I will translate the EN for PT-PT. Tks Edited May 9, 2014 by webcorvo (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted May 9, 2014 Share Posted May 9, 2014 Search for "lang" in /classes/pdf folder. It may quite challenging to do it reliably. Anyway, the M4 PDF Extensions module has a switch under Orders - http://www.presta-addons.com/3-86/pdf-extensions.jpg Link to comment Share on other sites More sharing options...
webcorvo Posted May 12, 2014 Share Posted May 12, 2014 Search for "lang" in /classes/pdf folder. It may quite challenging to do it reliably. Anyway, the M4 PDF Extensions module has a switch under Orders - http://www.presta-addons.com/3-86/pdf-extensions.jpg I don´t have that dir ( I have try in the BO ( Translations > Pdf Translations ) change the vars of EN laguage fot PT, becouse that the clients receive. But after save, i dind´t receive more mails. Do you know where i can find this file in code? Tks Link to comment Share on other sites More sharing options...
tuk66 Posted May 13, 2014 Share Posted May 13, 2014 Translations are the first part. When you have all texts translated PrestaShop uses translated text differently in Front Office and Back Office. In Back Office the invoice is always translated to admin's language. Link to comment Share on other sites More sharing options...
webcorvo Posted May 13, 2014 Share Posted May 13, 2014 (edited) Translations are the first part. When you have all texts translated PrestaShop uses translated text differently in Front Office and Back Office. In Back Office the invoice is always translated to admin's language. Ok tks. I change the admin lang and is working now! Tks Edited May 13, 2014 by webcorvo (see edit history) Link to comment Share on other sites More sharing options...
Mr.SerikuS Posted December 18, 2015 Share Posted December 18, 2015 (edited) If anybody needs orders in only one language, different from admin`s, it helped for me: protected function getTemplate($template_name) { $template = false; $default_template = _PS_PDF_DIR_.'/'.$template_name.'.tpl'; $overriden_template = _PS_THEME_DIR_.'pdf/'.$template_name.'.tpl'; if (file_exists($overriden_template)) $template = $overriden_template; else if (file_exists($default_template)) $template = $default_template; // SELECT ORDER LANGUAGE FOR THE TEMPLATE if ( $this->order ) Context::getContext()->language = new Language($this->order->id_lang); return $template; } In this line: Context::getContext()->language = new Language($this->order->id_lang); Changed $this->order->id_lang to my language ID (My needed language was 2, so changed for 2) and my invoices become in one language. Context::getContext()->language = new Language(2); Edited December 18, 2015 by Mr.SerikuS (see edit history) Link to comment Share on other sites More sharing options...
fillmihail Posted December 25, 2015 Share Posted December 25, 2015 What is PHP file name where it's made correction? Link to comment Share on other sites More sharing options...
Mr.SerikuS Posted December 30, 2015 Share Posted December 30, 2015 My post classes/pdf/PDF.php But product names still in admin lang. I will think lates. Happy New Year :3 Link to comment Share on other sites More sharing options...
Guest Posted March 4, 2016 Share Posted March 4, 2016 This is a bug that needs to be fixed http://forge.prestashop.com/browse/PSCSX-2323 Link to comment Share on other sites More sharing options...
tuk66 Posted March 8, 2016 Share Posted March 8, 2016 My post classes/pdf/PDF.php But product names still in admin lang. I will think lates. Happy New Year :3 Product names are always in customer's language, because they are stored in the ps_orders table just in one language. It is possible to retrieve the names from Products, in every language. It is a popular method in bi-language invoices (like Chinese-English). Link to comment Share on other sites More sharing options...
M.N Posted February 3, 2021 Share Posted February 3, 2021 For PS 1.7.7 in classes/pdf/HTMLTemplate.php footer can be translated in line 71, that is setting the line to: 'free_text' => Configuration::get('PS_INVOICE_FREE_TEXT', (int) Context::getContext()->language->id, null, $this->order->id_lang), However the suggested solution does not seem to work for template. In PS 1.7.7 the code is little different: protected function getTemplate($template_name) { $template = false; $default_template = rtrim(_PS_PDF_DIR_, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $template_name . '.tpl'; $overridden_template = _PS_ALL_THEMES_DIR_ . $this->shop->theme->getName() . DIRECTORY_SEPARATOR . 'pdf' . DIRECTORY_SEPARATOR . $template_name . '.tpl'; if (file_exists($overridden_template)) { $template = $overridden_template; } elseif (file_exists($default_template)) { $template = $default_template; } return $template; } By adding code if ( $this->order ) Context::getContext()->language = new Language($this->order->id_lang); into the function does not result correct translation. How to adjust this correctly for keeping the pdf files always in order language? Link to comment Share on other sites More sharing options...
w3bsolutions Posted December 24, 2021 Share Posted December 24, 2021 I solved this in PS 1.7 by modifying (creating an override) for /classes/pdf/HTMLTemplateInvoice.php, changing the __construct function to: public function __construct(OrderInvoice $order_invoice, Smarty $smarty, $bulk_mode = false) { $this->order_invoice = $order_invoice; $this->order = new Order((int) $this->order_invoice->id_order); $this->smarty = $smarty; $this->smarty->assign('isTaxEnabled', (bool) Configuration::get('PS_TAX')); // If shop_address is null, then update it with current one. // But no DB save required here to avoid massive updates for bulk PDF generation case. // (DB: bug fixed in 1.6.1.1 with upgrade SQL script to avoid null shop_address in old orderInvoices) if (!isset($this->order_invoice->shop_address) || !$this->order_invoice->shop_address) { $this->order_invoice->shop_address = OrderInvoice::getCurrentFormattedShopAddress((int) $this->order->id_shop); if (!$bulk_mode) { OrderInvoice::fixAllShopAddresses(); } } // header informations $this->date = Tools::displayDate($order_invoice->date_add); // switch language to order language Context::getContext()->language = new Language($this->order->id_lang); $id_lang = Context::getContext()->language->id; $id_shop = Context::getContext()->shop->id; $this->title = $order_invoice->getInvoiceNumberFormatted($id_lang, $id_shop); $this->shop = new Shop((int) $this->order->id_shop); } 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now