Forums / General Questions / Add to end of order number ie 1234 - 2010

Add to end of order number ie 1234 - 2010

Locked

Started by dropbop on 5 Jan 2010, 9:59 PM · Views: 912

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
5 Jan 2010, 9:59 PM
#1
dropbop avatar

dropbop

Zen Follower

Join Date:
Apr 2008
Location:
Athlone, Ireland
Posts:
177
Plugin Contributions:
1

Add to end of order number ie 1234 - 2010

Hey guys,

I was wondering if anyone knows if this is possible.

I would like to add the year to the end of the order number so it reads 1234 - 2009.

I would like it to show on the customers invoice and email confirmation but not really want it in the database cause when orders are exported to another program for processing the other program attathces the year/date to the end of the zencart generated order ID.

even if its some added text that could need to be put somewhere to show 2010 in say the invoice file.

If anyone have any ideas on how to do this that would be wonderful. Might even be handy for other people who are looking to do something similar.

Cheers and Happy New Year

5 Jan 2010, 10:26 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Add to end of order number ie 1234 - 2010

For the confirmation e-mail, you can edit /includes/classes/order.php (caution - no override available - make a backup first) and add a bit of text, say in this block starting around line 900:```php
// lets start with the email confirmation
// make an array to store the html version
$html_msg=array();

//intro area
$email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" .
$this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" .
EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" .
EMAIL_SEPARATOR . "\n" .
EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" .
EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" .
EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
$html_msg['EMAIL_TEXT_HEADER']     = EMAIL_TEXT_HEADER;
$html_msg['EMAIL_TEXT_FROM']       = EMAIL_TEXT_FROM;
$html_msg['INTRO_STORE_NAME']      = STORE_NAME;
$html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
$html_msg['EMAIL_DETAILS_FOLLOW']  = EMAIL_DETAILS_FOLLOW;
$html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
$html_msg['INTRO_ORDER_NUMBER']    = $zf_insert_id;
$html_msg['INTRO_DATE_TITLE']      = EMAIL_TEXT_DATE_ORDERED;
$html_msg['INTRO_DATE_ORDERED']    = strftime(DATE_FORMAT_LONG);
$html_msg['INTRO_URL_TEXT']        = EMAIL_TEXT_INVOICE_URL_CLICK;
$html_msg['INTRO_URL_VALUE']       = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);
Add the part in red:
    EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . '-2010' . "\n" .
or for something easier/safer to maintain:
    EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . EMAIL_TEXT_ORDER_YEAR . "\n" .
and then make a define file with a line
define('EMAIL_TEXT_ORDER_YEAR','-2010');
or you could add this define to the file where related constants are defined.

Similarly with the HTML content:
    $html_msg['INTRO_ORDER_NUMBER']    = $zf_insert_id. EMAIL_TEXT_ORDER_YEAR;

Other locations would be handled in a similar fashion.
5 Jan 2010, 11:23 PM
#3
dropbop avatar

dropbop

Zen Follower

Join Date:
Apr 2008
Location:
Athlone, Ireland
Posts:
177
Plugin Contributions:
1

Re: Add to end of order number ie 1234 - 2010

I dont know how I missed that. I should be able to use the same principle for showing it in customers order history too.

Cheers Glen, your help is always appreciated.

Happy New Year.

Droppy