Jump to content



Latest News: (loading..)

- - - - -

PDF Invoice 162 Order date format change


  • Please log in to reply
5 replies to this topic

#1   Ozmooseus

Ozmooseus
  • Members
  • 17 posts
  • Real Name:Ryan

Posted 03 January 2011 - 12:52 PM

Hi,
I have successfully formatted and customised my PDF invoice created using;

http://addons.oscommerce.com/info/3027

Quick question is how do I alter the date formating of the order date from mm/dd/yy to dd/mm/yy ?  Formatting of tep_date_short is my issue I assume.

//Draw Date of Order Text
$temp = str_replace(' ', ' ', PRINT_INVOICE_DATE);
$pdf->Text(50,113,$temp . tep_date_short($order->info['date_purchased']));

Thanks Heaps,
Ryan.
Ryan,
Australia

#2   germ

germ
  • Members
  • 13,921 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 03 January 2011 - 11:28 PM

In /catalog/includes/languages/english.php make the date format this:

define('DATE_FORMAT', 'd/m/Y'); // this is used for date()

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -

"Headers already sent" - The definitive help

"Cannot redeclare ..." - How to find/fix it

SSL Implementation Help

Like this post? "Like" it again over there >

#3   Ozmooseus

Ozmooseus
  • Members
  • 17 posts
  • Real Name:Ryan

Posted 04 January 2011 - 08:29 AM

View Postgerm, on 03 January 2011 - 11:28 PM, said:

In /catalog/includes/languages/english.php make the date format this:

define('DATE_FORMAT', 'd/m/Y'); // this is used for date()

Thanks germ,  However this is what I have;

define('DATE_FORMAT_SHORT', '%d/%m/%Y');  // this is used for strftime()
define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
define('DATE_FORMAT', 'd/m/Y'); // this is used for date()
define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');

////
// Return date in raw format
// $date should be in format mm/dd/yyyy
// raw date is in format YYYYMMDD, or DDMMYYYY
function tep_date_raw($date, $reverse = false) {
  if ($reverse) {
        return substr($date, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4);
  } else {
        return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2);
  }
}

Thanks,
Ryan.
Ryan,
Australia

#4   germ

germ
  • Members
  • 13,921 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 04 January 2011 - 11:38 AM

Change this:

$pdf->Text(50,113,$temp . tep_date_short($order->info['date_purchased'])); 

To this:

$pdf->Text(50,113,$temp . substr(tep_date_short($order->info['date_purchased']), 3, 2) . '/' . substr(tep_date_short($order->info['date_purchased']), 0, 2) . '/' . substr(tep_date_short($order->info['date_purchased']), 6, 4) ); 

Edited by germ, 04 January 2011 - 11:41 AM.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -

"Headers already sent" - The definitive help

"Cannot redeclare ..." - How to find/fix it

SSL Implementation Help

Like this post? "Like" it again over there >

#5   Ozmooseus

Ozmooseus
  • Members
  • 17 posts
  • Real Name:Ryan

Posted 04 January 2011 - 08:12 PM

View Postgerm, on 04 January 2011 - 11:38 AM, said:

Change this:

$pdf->Text(50,113,$temp . tep_date_short($order->info['date_purchased'])); 

To this:

$pdf->Text(50,113,$temp . substr(tep_date_short($order->info['date_purchased']), 3, 2) . '/' . substr(tep_date_short($order->info['date_purchased']), 0, 2) . '/' . substr(tep_date_short($order->info['date_purchased']), 6, 4) ); 

germ,
Yep that is a very good work around.  Thanks for the help.

Ryan.
Ryan,
Australia

#6   dzina

dzina
  • Members
  • 1 posts
  • Real Name:Denise

Posted Today, 04:12 AM

I know this is an old thread but I need help on the same Module, so thought i would use it.

I need the product attributes to appear in the invoice. Can anyone help me do this?

Thanks.