Jump to content

PDFs Language according to Order language


zAy

Recommended Posts

Hello,

 

I searched the forums but no result about this tricky one:

 

We all know that customers receive their emails according to their shop language when they confirm the order, and that the language ID is included within each order record in the DB. This also applies to the mailalerts module that sends us ( the admins ) an email about new orders in the language of the customer.

 

My Goal:

I would like to generate all PDF files (invoice, delivery, credit slip ... ) according to the order language and not to the BO or Shop language.

Even if the customer changes the shop language and downloaded the invoice again, it shows according to the language he used when he placed that order.

 

Current Situation:

I have 2 languages (english and french), soon they will be 4.

I had the lightbulb ^_^ in head and created 2 Order statuses named (ENGLISH and FRENCH) that will be hidden on customers, and used only to "Flag" an order with ENGLISH or FRENCH Status according to the mail language when i receive that order. So that when i want to print the invoice and delivery PDFs, i will change the BO language first accordingly.

This will be annoying soon...

 

My Question:

Is that possible ? even if sophisticated, i thought maybe in the pdf templates where we call the {l s: maybe we can choose according to order ID ?

 

Any thoughts or solutions are much appreciated !! :)

 

Cheers !

 

PS 1.5.3.1

Link to comment
Share on other sites

Hello,

 

Still no answer for this topic while it could be of great use for the entire community..

 

Nobody knows where the decision is taken for the language of the PDFs ? I am sure it is somewhere and we just need to point to the order language instead of website language.

 

Thanks again for any leading hint..

Link to comment
Share on other sites

  • 4 years later...

I know that this topic is actually pretty old, but i spent like 3 days searching for the right solution to a similar problem. I found the solution here: https://www.prestashop.com/forums/topic/396155-need-to-display-double-currency-and-change-pdf-language/
 
Thank you so much Martijn!
 
I actually did change that a little bit though, I did an override of the specific HTMLTemplate Class (in my case HTMLTemplateSupplyOrderForm) and redefined the getTemplate method which was inherited by the HTMLTemplate class. My override looks like this:

HTMLTemplateSupplyOrderForm extends HTMLTemplateSupplyOrderFormCore
{
    protected function getTemplate($template_name)
    {
        $template = parent::getTemplate($template_name);
        Context::getContext->language = new Language($this->supply_order->id_lang);
        return $template;
    }
}

I hope this can help someone :)

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...