Order Date on Invoice templates

Project:Ubercart Contributions
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description
Project: 
Ubercart

It seems that there is no order date on either the customer or admin order template. Seems like a reasonable thing to include? Thanks.

mykz-'s picture
Offline
Joined: 02/13/2008
Juice: 209
Re: Order Date on Invoice templates

I ran into this problem and jumped into the irc channel for ubercart and rszrama told me to use the following code below.

<?php
echo format_date($order->created, 'custom', 'm/d/Y');
?>

Thanks rszrama

Tanjerine's picture
Offline
Bug FinderInternationalizationizerNot KulvikThe other woman.
Joined: 08/31/2007
Juice: 235
here's what i did... in
Assigned to:mykz-» Tanjerine

here's what i did...

in uc_order.module, under the uc_order_token_values function, i added:

$values['order-date'] =  format_date($order->created, 'custom', 'm/d/Y'); // order date

and then in the customer.itpl.php file, at around line 131 (where it says order #), i added:

<tr>
  <td nowrap="nowrap">
    <b><?php echo t('Order Date: '); ?></b>
  </td>
  <td width="98%">
    [order-date]
  </td>
</tr>

and then in the admin.itpl.php file, line 10, i added:

<?php echo t('Order date:'); ?> [order-date]<br />

hope this helps.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15453
Re: here's what i did... in
Assigned to:Tanjerine» Ryan

I'm not sure how long these have been a part of core, but it seems there are tokens for this as well: [order-date-created] and [order-date-modified].

Tanjerine's picture
Offline
Bug FinderInternationalizationizerNot KulvikThe other woman.
Joined: 08/31/2007
Juice: 235
Re: Order Date on Invoice templates
Assigned to:Ryan» Tanjerine

hi ryan, sorry, i forgot to mention that i was using an older version of ubercart (obviously pre-order-date token inclusion) Smiling

aneuryzma's picture
Offline
Joined: 07/06/2010
Juice: 197
#5
Assigned to:Tanjerine» Guest

hi,

I'm using [order-date-created] and what I get is: 07/16/2010 - 10:35

can I remove the time from the date format in my invoice?

In my Ubercart settings it is already specified I just want the d/m/y format.

thanks

Fonant's picture
Offline
Joined: 10/27/2011
Juice: 18
#6

I modified the code in uc_order.module to change this:

<?php
      $values
['order-date-created'] = format_date($order->created, 'small');
     
$values['order-date-modified'] = format_date($order->created, 'small');
?>

to this:

<?php
      $values
['order-date-created'] = format_date($order->created, 'custom', variable_get('uc_date_format_default', 'j F Y'));
     
$values['order-date-modified'] = format_date($order->modified, 'custom', variable_get('uc_date_format_default', 'j F Y'));

?>

so the invoice will use the date format set in Store Administration > Configuration > Store settings > Edit > Format settings.