Jump to content

I need help with editing PDF.php


salko

Recommended Posts

I need some help changing invoice (with editing PDF.php). First I need to change the date to be displayed as dd-mm-yyyy. Second thing is to add a signature to the invoice, to be relative to the end of the product list - that means if I'll have more produtcs on the invoice the signature will be always below the "Total" price .... Thank you for help!

42348_2XzMc2ieJqHTm2Fx3ye5_t

Link to comment
Share on other sites

First, the date is formatted by a call to Tools::displayDate() and that is returning a date formatted by the currently selected language.

Well, what do you know, after looking at it, it makes ALL languages YYYY-MM-DD unless the language is French, then it is displayed in DD-MM-YYYY order.

To make it return in DD-MM-YYYY order, you can also modify the SQL that returns the customer's orders to return the date in the correct order.

Haven't looked at adding the sig, yet.

Link to comment
Share on other sites

First, the date is formatted by a call to Tools::displayDate() and that is returning a date formatted by the currently selected language.

Well, what do you know, after looking at it, it makes ALL languages YYYY-MM-DD unless the language is French, then it is displayed in DD-MM-YYYY order.

To make it return in DD-MM-YYYY order, you can also modify the SQL that returns the customer's orders to return the date in the correct order.

Haven't looked at adding the sig, yet.


If French language shows the right date order then it must be some simple modification to make all languages like this ... I don't wan't to mess with the database, because I never have done that before ... Thanks for help!
Link to comment
Share on other sites

First, the date is formatted by a call to Tools::displayDate() and that is returning a date formatted by the currently selected language.

Well, what do you know, after looking at it, it makes ALL languages YYYY-MM-DD unless the language is French, then it is displayed in DD-MM-YYYY order.

To make it return in DD-MM-YYYY order, you can also modify the SQL that returns the customer's orders to return the date in the correct order.

Haven't looked at adding the sig, yet.


If French language shows the right date order then it must be some simple modification to make all languages like this ... I don't wan't to mess with the database, because I never have done that before ... Thanks for help!


I found solution by myself, using Google:

To change date display for all languages to be DD-MM-YYYY you have to change the following code in classes/Tools.php:

$language = Language::getLanguage((int)($id_lang));
        if ($language AND strtolower($language['iso_code']) == 'fr')
            return ($tmpTab[2].'-'.$tmpTab[1].'-'.$tmpTab[0].($full ? $hour : ''));
        else
            return ($tmpTab[0].'-'.$tmpTab[1].'-'.$tmpTab[2].($full ? $hour : ''));



to this code:

$language = Language::getLanguage((int)($id_lang));
        /*if ($language AND strtolower($language['iso_code']) == 'fr')
            return ($tmpTab[2].'-'.$tmpTab[1].'-'.$tmpTab[0].($full ? $hour : ''));
        else
            return ($tmpTab[0].'-'.$tmpTab[1].'-'.$tmpTab[2].($full ? $hour : ''));*/
            return ($tmpTab[2].'-'.$tmpTab[1].'-'.$tmpTab[0].($full ? $hour : ''));



Still looking for tip for inserting signature into invoice ...

Link to comment
Share on other sites

I didn't mean change the DB, I meant to change the way it was returned in the SQL. The SQL in getCusomerOrders returns o.* which
would not allow formatting of the date like you want it. You would have to modify that SQL.

However, you found a good solution but to other languages, the dates may look funny.

Link to comment
Share on other sites


However, you found a good solution but to other languages, the dates may look funny.


With solution I found there is no problem to arrange differend date format for each language, so if you need this, you must put the IF sentence back in business and modify the code for different languages ...
Link to comment
Share on other sites

  • 2 months later...

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...