Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Extra text area on shipping page


egghead123

Recommended Posts

:blink: I need to create an extra "greeting" field (type text area) - just like the comments field. I tryed to copy all code regarding the comments field, but the new field dos not work.

 

On the FORM page:

<tr>
<td class="infoBoxContents"><?php echo GREETING_TEXT; ?></td>
<td><?php echo tep_draw_textarea_field('greeting', 'soft', '20', '3'); ?></td>
</tr>

 

 

In checkout_process.php I changed to:

 

  $sql_data_array = array('orders_id' => $insert_id, 
                         'orders_status_id' => $order->info['order_status'], 
                         'date_added' => 'now()', 
                         'customer_notified' => $customer_notification,
                         'greeting' => $order->info['greeting'],
                         'comments' => $order->info['comments']);
 tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

 

and in order.php

 

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

 

 

in checkout_confirmation.php

 

  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']);
 }

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

 

and I

 

tep_session_unregister('greeting'); 

 

on several pages. But it won't work :angry:

 

Please HELP, IT IS JUST A SIMPLE TEXT BOX :huh:

Link to comment
Share on other sites

Does your code produce any errors or is it simply not working? Any details would be helpful.

 

No error, just nothing in the table. If the "greeting" field is missing (just for test!!) from the table, I get an error

 

Unknown column... insert into orders_status_history (orders_id, orders_status_id, date_added, customer_notified, greeting, comments) values ('9731', '1', now(), '', '')

 

showing NULL value for the "greeting" column.

Link to comment
Share on other sites

This is what I have found for a solution to the second greeting field in checkout

 

Are you doing a flower or gift basket site?

 

Thomas0012

 

anyhoo I haven't tried this yet but will be today.

 

Link to forum thread http://www.oscommerce.com/forums/index.php?sho...hl=extra+fields

 

After much need and no responses from the forum (which I can understand because it is a rather lenghtly explanation and can be confusing), I decided to dive in to this problem my self. What I needed was an extra textarea field on the checkout pages. This particular osCommerce website that I am working on is for a florist shop. Basically what they needed were two textareas to collect information: One for a greeting card, and the other for special delivery instructions. Since I got figured it out and noticed many posters were asking the same questions I decided to post my particular sceneario and how I accomplished things. Please note that this quick tutorial assumes that you know your way around phpMyAdmin as well as a firm grasp on html and php. Please be careful and make sure you back up your files before making any changes.

 

First open phpMyAdmin and select the orders_status_history table. Scroll down to the bottom and click "Go" next to the option "add new field at the end of the table". On the next page, name the field (in my case I named it "delivery_instructions"). Set it to "null", leave all of the other attributes alone and click save. This will create a new row in the orders_status_history table. This is all that you need to do with the database so once you have saved the table and verified that the new field is now there you can close phpMyAdmin.

 

Now for the code. In this scenario I needed to basically replicate everything that was going on in the "add comments to your order" textarea (which I later changed to: Enclosed Greeting Card Message) and create a "Delivery Instructions" textarea box of the same nature. To make things short and sweet all that you really need to do is go through the pages listed below, and do a find for "comments" this will find anything associated with the "add comments to your order" textarea. Then all you need to do is copy that code and change the variable names within. Thats it! smile.gif

 

Here are the associated file that will need editing:

 

Php/Html Code:

catalog/class/order.php

catalog/checkout_confirmation.php

catalog/checkout_payment.php

catalog/checkout_process.php

catalog/checkout_shipping.php

 

Languages:

catalog/languages/checkout_confirmation.php

catalog/languages/checkout_payment.php

catalog/languages/checkout_shipping.php

catalog/languages/checkout_success.php

 

Please note that I claim no responsibility on the use of this tutorial. You are responsible for the changes you make to your website.

 

Hope this helps smile.gif

-Tyler

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...