Contributions
Add text box to checkout like comments
These instructions show you how to add a new text box or input box to the checkout process just like the comments box. It does not include any instructions on making it beautiful, just getting the box in there and working.
| 19 Apr 2011 |
I think that the modifications of checkout_payment.php is not correct. Here are my changes.
| 1 Nov 2010 |
Combined v1.3 + bug fix + other little fixes.
Enjoy
fraser@dynamite.net.nz
| 29 Jun 2010 |
i have found bug like its not showing new comments in admin order page.
admin/orders.php
replace:
$orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added");
with:
$orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments,YOUR_NEW_BOX from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added");
regards,
rajdavinder@gmail.com
| 7 Feb 2009 |
There is a problem width zip file.
Please download this one or copy full instructions
ллллллллллллллллллллллллллллллллллллллллллллл
ллллллллллллллллллллллллллллллллллллллллллллл
ллллллллллллллллллллллллллллллллллллллллллллл
###################################
Add additional "comment" boxes
to the checkout process and emails
###################################
by Anthony Scott
10 Feb 2007
E-Mail: niagol@blackclaws.com
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:
<tr>
<td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>
</tr>
And above it place
<tr>
<td class="main"><?php echo tep_draw_input_field('YOUR_NEW_BOX', '', 'SIZE=10 maxlength=10') . tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
</tr>
------------------------------------------------------
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:
<td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>
</tr>
Replace by (correct comment - don't lose comment from checkout_shipping.php):
<td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?></td>
</tr>
and below it place
<tr>
<td class="main"><?php echo tep_draw_input_field('YOUR_NEW_BOX', '', 'SIZE=10 maxlength=10') . tep_draw_separator('pixel_trans.gif', '5', '1') . 'Your text here'; ?></td>
</tr>
------------------------------------------------------
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:
<tr>
<td class="main"><?php echo nl2br(tep_output_string_protected($order->info['comments'])) . tep_draw_hidden_field('comments', $order->info['comments']); ?></td>
</tr>
Below it add:
<tr>
<td class="main"><?php echo nl2br(tep_output_string_protected($order->info['YOUR_NEW_BOX'])) . tep_draw_hidden_field('YOUR_NEW_BOX', $order->info['YOUR_NEW_BOX']); ?></td>
</tr>
Find:
<?php
if (tep_not_null($order->info['comments'])) {
?>
Replace by:
<?php
// if (tep_not_null($order->info['comments'])) {
?>
Find (about 20 - 30 lines below last correction):
<?php
}
?>
Replace by:
<?php
// }
?>
---------------------------------------------------
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:
<td class="smallText">' . nl2br(tep_db_output($orders_history['comments'])) . 'а
and below it place:
<br />' . 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:
niagol@blackclaws.com
###################################
| 3 Feb 2009 |
I corrected some little bugs and had the possibilitie to see NEW comments in Admin / Orders.
FULL INSTRUCTIONS
| 4 Apr 2007 |
This file has the complete update, including changes so that the information is transferred into the database. This file replaces all before it.
| 30 Mar 2007 |
Forgot to include the section at the bottom of the checkout_process.php that unregisters the variable. Thanks to Tracy from Mountainmeadowherbs.com for pointing it out. File is just text, complete updated information.
| 12 Feb 2007 |
These instructions show you how to add a new text box or input box to the checkout process just like the comments box. It does not include any instructions on making it beautiful, just getting the box in there and working.
Note: Contributions are used at own risk.
