Magento – Printing invoice in different custom language

invoicelanguagelocalemagento-1.8pdf

I have one website with multiple store views for different languages. All store views have same products, but use different front-end languages which are stored in locale.

When someone orders from German store view, Sales=>Invoices=>(invoice #)=>Print will print a German PDF invoice. I would like to be also able to print all PDF invoices in English language for accounting. How can I achieve that?

Best Answer

Some information for you on this:

The language is set in the getPdf() method of Mage_Sales_Model_Order_Pdf_Invoice. You will see that the locale and store are set according to the invoide data:

Mage::app()->getLocale()->emulate($invoice->getStoreId());
Mage::app()->setCurrentStore($invoice->getStoreId());

What you could do is to extend this functionality and add maybe a second button to your admin-backend which always generate the english invoice.

Be aware that emulate() needs a store id. If you don't have an english store, this won`t work.

In this case you could try to remove the first line Mage::app()->getLocale()->emulate($invoice->getStoreId()); from your rewritten-method and also the revert back Mage::app()->getLocale()->revert(); at the end of the function which sets the locale back to the last one before emulation.

Related Topic