7

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?

5

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.

  • Here is a little tweak I did, in my case some stores had different languages but the invoice had to be issued in the language that the store was located. here is how to set it up: switch ($invoice->getStoreId()){case 1: $langcode=1; break; case 2: $langcode=1; break; case 3: $langcode=1; break; case 4: $langcode=5; break; } if ($invoice->getStoreId()) { Mage::app()->getLocale()->emulate($langcode);Mage::app()->setCurrentStore($langcode); } – Andras May 2 '17 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.