There is a problem width zip file.
Please download this one or copy full instructions
«««««««& laquo;««««««&l aquo;««««««&la quo;««««««&laq uo;««««««&laqu o;««««««&laquo ;««
«««««««& laquo;««««««&l aquo;««««««&la quo;««««««&laq uo;««««««&laqu o;««««««&laquo ;««
«««««««& laquo;««««««&l aquo;««««««&la quo;««««««&laq uo;««««««&laqu o;««««««&laquo ;««
###################################


Add additional "comment" boxes
to the checkout process and emails


###################################


by Anthony Scott
10 Feb 2007
E-Mail: [email protected]


A contribution for osCommerce 2.2 Milestone 2;
released under GNU GENERAL PUBLIC LICENSE


###################################

What this contribution does
###################################


This allows you to add additional text boxes to the checkout process exactly like the comments box.
It does require that you edit your database so the information can be added to the emails.
It does not currently show up in the administration order viewing, haven't gotten that far yet.
These instructions do not include any editing for beauty. If you want to place the box somewhere else or add text to it, go for it but I just put down the bare minimums to add a new box to the check out section and get it into the email.

###################################

Files Affected
###################################

Please backup all files!

1. catalog/checkout_shipping.php
2. catalog/checkout_payment.php
3. catalog/checkout_confirmation.php
4. catalog/checkout_process.php

###################################

Instructions - how to install
###################################

Please backup all files!


##############################changes to make to site:###################################


1. in the file catalog/checkout_shipping.php look for:

if (!tep_session_is_registered('comments')) tep_session_register('comments');
if (tep_not_null($HTTP_POST_VARS['comments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
}

and add below it (you can change the text in caps to reflect your own variable):

if (!tep_session_is_registered('YOUR_NEW_BOX')) tep_session_register('YOUR_NEW_BOX');
if (tep_not_null($HTTP_POST_VARS['YOUR_NEW_BOX'])) {
$YOUR_NEW_BOX = tep_db_prepare_input($HTTP_POST_VARS['YOUR_NEW_BOX']);
}


Also in the same file near the end find:





And above it place





------------------------------------------------------

2. In the file catalog/checkout_payment.php look for:

IMPORTANT:
Find:

if (!tep_session_is_registered('comments')) tep_session_register('comments');

and below it add (correct comment - don't lose comment from checkout_shipping.php):

if (tep_not_null($HTTP_POST_VARS['comments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
}

and again below it add (new comment)

if (!tep_session_is_registered('YOUR_NEW_BOX')) tep_session_register('YOUR_NEW_BOX');
if (tep_not_null($HTTP_POST_VARS['YOUR_NEW_BOX'])) {
$YOUR_NEW_BOX = tep_db_prepare_input($HTTP_POST_VARS['YOUR_NEW_BOX']);
}


Find:



Replace by (correct comment - don't lose comment from checkout_shipping.php):






and below it place






------------------------------------------------------

3. in the file catalog/checkout_confirmation.php find:

if (!tep_session_is_registered('comments')) tep_session_register('comments');
if (tep_not_null($HTTP_POST_VARS['comments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
}

and below it place:

if (!tep_session_is_registered('YOUR_NEW_BOX')) tep_session_register('YOUR_NEW_BOX');
if (tep_not_null($HTTP_POST_VARS['YOUR_NEW_BOX'])) {
$YOUR_NEW_BOX = tep_db_prepare_input($HTTP_POST_VARS['YOUR_NEW_BOX']);
}



Find:





Below it add:







Find:



Replace by:


Find (about 20 - 30 lines below last correction):


Replace by:




---------------------------------------------------

4. In file catalog/checkout_process.php find:


'comments' => $order->info['comments']);

And replace it with

'comments' => $order->info['comments'],
'YOUR_NEW_BOX' => $order->info['YOUR_NEW_BOX']);


Next, in the same file find:

tep_session_unregister('comments');

and below it place:

tep_session_unregister('YOUR_NEW_BOX');



Find:

if ($order->info['comments']) {
$email_order .= tep_db_output($order->info['comments']) . "nn";
}

and below it add

if ($order->info['YOUR_NEW_BOX']) {
$email_order .= tep_db_output($order->info['YOUR_NEW_BOX']) . "nn";
}




-----------------------------------------------------------
5. In file catalong/includes/classes/order.php find:

'comments' => (isset($GLOBALS['comments']) ? $GLOBALS['comments'] : ''));

and change it to:

'comments' => (isset($GLOBALS['comments']) ? $GLOBALS['comments'] : ''),
'YOUR_NEW_BOX' => (isset($GLOBALS['YOUR_NEW_BOX']) ? $GLOBALS['YOUR_NEW_BOX'] : ''));



---------------------------------------
7. DO NOT FORGET TO DO THIS PART - SQL

Use your friendly database editor (phpMyAdmin, etc) to navigate to the orders_status_history table and add a field with the same name you chose for YOUR_NEW_BOX, it should be set type as text, null as YES and default as NULL, basically whatever you see your comments field is set to, do the same.

---------------------------------------
8. See the NEW commnet in Admin / Orders

Find:

' . nl2br(tep_db_output($orders_history['comments'])) . '


and below it place:


' . nl2br(tep_db_output($orders_history['YOUR_NEW_BOX'])) . '

###################################

Hints
###################################

This is an easy contribution, but watch those single quotes and 'white spaces'. If you have an error because of this fix, you should start there. Also make sure you edit your database BEFORE trying to do an order with the updated code.


Thats it. Your Done!



###################################

Feel free to send me comments, corrections, feedback to:

[email protected]
###################################
















More...