outlet.ee Posted January 1, 2014 Share Posted January 1, 2014 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 More sharing options...
vekia Posted January 1, 2014 Share Posted January 1, 2014 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 More sharing options...
outlet.ee Posted January 1, 2014 Author Share Posted January 1, 2014 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 More sharing options...
vekia Posted January 1, 2014 Share Posted January 1, 2014 strange, where you use this variable {PdfInvoiceControllerCore::curr_iso($order->id_currency)} ? Link to comment Share on other sites More sharing options...
outlet.ee Posted January 1, 2014 Author Share Posted January 1, 2014 That's right. Pasted it exactly the same and it gives the blank page. Once I remove it, it opens the invoice in pdf. Link to comment Share on other sites More sharing options...
vekia Posted January 1, 2014 Share Posted January 1, 2014 but where you used it? in what file, in what line? also what ps version? i will test it once again. Link to comment Share on other sites More sharing options...
outlet.ee Posted January 1, 2014 Author Share Posted January 1, 2014 Oh sorry, I used it in pdf/invoice.tpl, line 27 (right before the first table begins, for testing purposes - is shouldn't matter where to put it?). PS v.1.5.2. Link to comment Share on other sites More sharing options...
PascalVG Posted January 3, 2014 Share Posted January 3, 2014 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 :-) 2 Link to comment Share on other sites More sharing options...
outlet.ee Posted January 3, 2014 Author Share Posted January 3, 2014 Thank you very much, it works now perfectly. First I did put it right in the middle of the file. No wonder, given my knowledge of php being as it is... Link to comment Share on other sites More sharing options...
PascalVG Posted January 4, 2014 Share Posted January 4, 2014 Glad it works! I'll mark the topic as solved. Happy selling, pascal. N.B. For all kind of useful "first steps into..." tutorials, see here : w3schools.com :-) Link to comment Share on other sites More sharing options...
vekia Posted January 4, 2014 Share Posted January 4, 2014 pascal helpful as always, thank you for wonderful cooperation :-) 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