Jump to content

[SOLVED] Currency: ISO - how to show currency sign on invoice template?


outlet.ee

Recommended Posts

Hello,

 

I have multiple currencies but most of them have the same sign (kr.) because the Nordic currency NOK, DKK and SEK are all abbreivated as kr. Terefore I need to mention the currency ise code on the invoice template but can't get any variable to work, for example

{$currency.iso_code}
{displayPrice currency=$order->id_currency.sign}

etc. Does anybody know how to get the variable to invoice.tpl?

 

 

Link to comment
Share on other sites

open PdfInvoiceController.php file (controllers/front directory)

 

add there function:

    public static function curr_iso($id){
        $currency = new Currency($id);
        return $currency->iso_code;
    }

then in invoice.tpl file you can use variable:

{PdfInvoiceControllerCore::curr_iso($order->id_currency)}

and you will see currency iso code :)

Link to comment
Share on other sites

Thank you, I really do appreciate your help!

 

But it gives me the blank page after modifying the .tpl file. Changing only the .php file doesn't create the error. Are you sure the variable is correct?

{PdfInvoiceControllerCore::curr_iso($order->id_currency)}
Link to comment
Share on other sites

Turn on debugging, and we may get more info on what goed wrong:

http://www.prestashop.com/forums/topic/224525-how-to-turn-on-error-reporting-for-debug-information/

 

 

Just a wild guess: Did you put the function INSIDE the PDFInvoiceControllerCore class? (i.e. just BEFORE the last '}' ?? :

...
   public static function curr_iso($id){
        $currency = new Currency($id);
        return $currency->iso_code;
    }

}     //  <-  this is the closing bracket of the class. Code should be ABOVE this line

pascal

 

 

(N.B. Overriding the PDFInvoiceController is long term a better solution than changing the core file, e.g. when upgrading PS.)

(N.B.2: you should also be able to use :  {PdfInvoiceController::curr_iso($order->id_currency)} , i.e. without Core, as this class extends the core one, so has all functionality of Core in it.) My 2 cents :-)

  • Like 2
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...