Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Printing 'Customer Notes' on invoices

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #61  
Old 10-06-2007, 09:15 AM
 
robertswww robertswww is offline
 

X-Adept
  
Join Date: Jul 2003
Posts: 586
 

Default Re: Printing 'Customer Notes' on invoices

Order Status with Date/Time Stamp addition

Many people in the X-Cart forums have asked for a way to put a timestamp when the order status changes. You can integrate a Date and Time Stamp with this addition to the Customer Notes MOD. Each time an Order Status change is made, it will automatically be appended to the end of the Customer Comments/Notes and added into every email sent that has the Customer Comments/Notes included. The Order Status with Timestamp are also visible on the backend of the site and stored in the $customer_comments field in the database.

If you would like to use this code, follow the steps in Post #56 above, but replace Step 9 with this code:

Locate this File: admin/order.php
Find this Code: (around line 134)
Code:
func_change_order_status($orderid, $status); func_header_location("order.php?orderid=$orderid&mode=status_changed"); }


Replace with this Code: (added just above)
# This section converts the Order Status letter to Status Type name (NOTE - adjust or add to list if you have Custom Order Status)
Code:
if($status==P){$statustype="Processed";} else if($status==I){$statustype="Not Finished";} else if($status==C){$statustype="Completed";} else if($status==B){$statustype="Backordered";} else if($status==Q){$statustype="Queued";} else if($status==F){$statustype="Failed";} else if($status==D){$statustype="Declined";} else{$statustype="N/A";} $customer_comments = addslashes($Customer_Comment); $timestamp = date("M j, Y @ g:i a",time()+3600); // NOTE - I needed to add an hour - 3600 seconds - for the correct store time $customer_comments = $customer_comments . " \r\n" . "<b>Order Status: </b>" . $statustype . " " . $timestamp . " EST."; #outputs: <b>Order Status: </b> Completed Oct 6, 2007 @ 1:06 pm EST $oldcomments = db_query("SELECT value FROM $sql_tbl[order_extras] WHERE orderid='$orderid' AND khash='Customer_Comment'"); if ($oldcommentsexist = mysql_fetch_array($oldcomments)) { db_query("UPDATE $sql_tbl[order_extras] SET value='$customer_comments' WHERE orderid='$orderid' AND khash='Customer_Comment'"); } else { db_query("INSERT INTO $sql_tbl[order_extras] (orderid, khash, value) VALUES ('$orderid', 'Customer_Comment', '$customer_comments')"); } func_change_order_status($orderid, $status); func_header_location("order.php?orderid=$orderid&mode=status_changed"); }


NOTES:
1.) I needed to add an hour (i.e. 3600 seconds) to the $timestamp variable, as my server is an hour behind my store - adjust accordingly (+/-) for your store time.
2.) I am on east cost time, hence the EST in the timestamp code output formatting... adjust for your timezone.
3.) You can adjust the $timestamp variable to equal the date format you prefer... here's some sample output:
date("M j, Y @ g:i a",time()); # outputs: Oct 6, 2007 @ 1:06 pm
date("F j, Y, g:i a",time()); # outputs: September 21, 2007, 4:25 pm
date("m/d/y - H:i:s",time()); # outputs: 9/21/07 - 16:25:02
date("r"); # outputs: Fri, Sep 2007 16:25:56
* You can find other sample time and date formatting in PHP here: http://us3.php.net/date

UPDATE:
If you would like a standalone version of the Order Status with TimeStamp and UserID of the person who made the change, only visible to Admins and Providers... view my code at these 2 posts:
http://forum.x-cart.com/showthread.php?t=12823
http://forum.x-cart.com/showthread.php?t=18645&page=2

Tested in X-Cart 4.0.19
Robert
__________________
X-cart 4.1.10
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:56 PM.

   

 
X-Cart forums © 2001-2020