ttetzloff Posted March 23, 2007 Share Posted March 23, 2007 Hello everyone, Let me start this off saying this forum is fantastic. It is awesome to have a forum where everyone helps each other out. I have been able to find most answers to my questions on here. I did do my homework on this question and I could not find it anywhere (after nearly 6 hours of searching). I am fairly new to osCommerce, so bear with me. What I need to accomplish seems pretty simple, however I do not know how to get it done. I am in need of an extra textarea underneath the "..add comments to your order" textarea on the checkout screen. It needs to be completely seperate from the one above it. It is also used for completely unrealted information (to be more specific it is for special delivery instructions). I am also fairly new to mysql, but I do know my way around phpMyAdmin. Thank you for your help in advance. -Tyler -Tyler Link to comment Share on other sites More sharing options...
ttetzloff Posted March 26, 2007 Author Share Posted March 26, 2007 Anyone?... :-" ... (tumbleweed in background) -Tyler Link to comment Share on other sites More sharing options...
ttetzloff Posted March 26, 2007 Author Share Posted March 26, 2007 Hello? Is anyone there? -Tyler Link to comment Share on other sites More sharing options...
ttetzloff Posted March 27, 2007 Author Share Posted March 27, 2007 I desperately need to get this one figured out. So I will need to bump this topic up. Any help or direction would be awesome. Thanks in advance. -Tyler -Tyler Link to comment Share on other sites More sharing options...
ttetzloff Posted March 28, 2007 Author Share Posted March 28, 2007 bump :-) -Tyler Link to comment Share on other sites More sharing options...
ttetzloff Posted March 29, 2007 Author Share Posted March 29, 2007 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! :) 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 :) -Tyler -Tyler Link to comment Share on other sites More sharing options...
pardesi Posted October 4, 2007 Share Posted October 4, 2007 Thanks for your help. But if you have already done all why dont you post detail instructions please ? it will be more help full for novice like us sad.gif Thanks Link to comment Share on other sites More sharing options...
Guest Posted October 4, 2007 Share Posted October 4, 2007 I can't get it to work ..detailed instructions would be nice Thanks in Advance Thomas Link to comment Share on other sites More sharing options...
Guest Posted October 4, 2007 Share Posted October 4, 2007 I found this it might help :blink: http://addons.oscommerce.com/info/4881 Link to comment Share on other sites More sharing options...
pardesi Posted October 5, 2007 Share Posted October 5, 2007 Nice Found Thomas, did u tried it ? is it working ? Link to comment Share on other sites More sharing options...
ttetzloff Posted October 5, 2007 Author Share Posted October 5, 2007 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! :) 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 :) -Tyler how is this post not detailed? I take you through phpmyadmin, and then on those pages below all you need to do is do a find for anything that has the word comments in it, then copy that line and paste it below the origional comments line.. then you need to change the variable name on the new line to comments2 or whatever else you want to name it to. -Tyler Link to comment Share on other sites More sharing options...
Guest Posted October 5, 2007 Share Posted October 5, 2007 how is this post not detailed? I take you through phpmyadmin, and then on those pages below all you need to do is do a find for anything that has the word comments in it, then copy that line and paste it below the origional comments line.. then you need to change the variable name on the new line to comments2 or whatever else you want to name it to. I did exactly as you stated and got errors I realized later due to the fact that I was changing all references of comments to my new variable. Doe.. pullin a Homer..I was tired I'm pretty new to php and mysql so could be a typo too, it was only my first attempt at getting it working, I will try again today to get it working. Thanks Tyler :blink: Link to comment Share on other sites More sharing options...
Guest Posted October 5, 2007 Share Posted October 5, 2007 Nice Found Thomas, did u tried it ? is it working ? :huh: Didn't work for me, lots of code differences I couldn't work out. I'm going to try the above again... if I get it working I will let you know. Thomas Link to comment Share on other sites More sharing options...
Guest Posted October 6, 2007 Share Posted October 6, 2007 Ya I still couldn't get it to work today The following are snippits of the code by page Catalogue pages >>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('delivery_instructions')) tep_session_register('delivery_instructions'); if (tep_not_null($HTTP_POST_VARS['delivery_instructions'])) { $delivery_instructions = tep_db_prepare_input($HTTP_POST_VARS['delivery_instructions']); } /////////////////// <?php if (tep_not_null($order->info['comments'])) { ?> <?php if (tep_not_null($order->info['delivery_instructions'])) { ?> /////////////////// <td class="main"><?php echo nl2br(tep_output_string_protected($order->info['comments'])) . tep_draw_hidden_field('comments', $order->info['comments']); ?></td> <td class="main"><?php echo nl2br(tep_output_string_protected($order->info['delivery_instructions'])) . tep_draw_hidden_field('delivery_instructions', $order->info['delivery_instructions']); ?></td> /////////////////// >>checkout_payment.php if (!tep_session_is_registered('comments')) tep_session_register('comments'); if (isset($HTTP_POST_VARS['comments']) && tep_not_null($HTTP_POST_VARS['comments'])) { $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']); } if (!tep_session_is_registered('delivery_instructions')) tep_session_register('delivery_instructions'); if (isset($HTTP_POST_VARS['delivery_instructions']) && tep_not_null($HTTP_POST_VARS['delivery_instructions'])) { $delivery_instructions = tep_db_prepare_input($HTTP_POST_VARS['delivery_instructions']); } //////////////////// <td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?></td> <td><?php echo tep_draw_textarea_field('delivery_instructions', 'soft', '60', '5', $delivery_instructions); ?></td> ///////////////////// >>checkout_process.php 'comments' => $order->info['comments']); 'delivery_instructions' => $order->info['delivery_instructions' ////////////////////// if ($order->info['comments']) { $email_order .= tep_db_output($order->info['comments']) . "\n\n"; } if ($order->info['delivery_instructions']) { $email_order .= tep_db_output($order->info['delivery_instructions']) . "\n\n"; } ///////////////////// tep_session_unregister('comments'); tep_session_unregister('delivery_instructions'); ////////////////////// >>checkout_shipping.php if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) { 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 ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) { if (!tep_session_is_registered('delivery_instructions')) tep_session_register('delivery_instructions'); if (tep_not_null($HTTP_POST_VARS['delivery_instructions'])) { $delivery_instructions = tep_db_prepare_input($HTTP_POST_VARS['delivery_instructions']); } ////////////////////// <td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td> <td><?php echo tep_draw_textarea_field('delivery_instructions', 'soft', '60', '5'); ?></td> /////////////////////// >>order.php global $HTTP_POST_VARS, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment, $comments, delivery_instructions; ////////////////////// 'comments' => (tep_session_is_registered('comments') && !empty($comments) ? $comments : '')); 'delivery_instructions' => (tep_session_is_registered('delivery_instructions') && !empty($delivery_instructions) ? $delivery_instructions : '')); ///////////////////// English Files >>checkout_confirmation.php define('HEADING_ORDER_COMMENTS', 'Comments About Your Order'); define('HEADING_ORDER_DELIVERY_INSTRUCTIONS', 'delivery instructions'); ///////////////////// define('TABLE_HEADING_COMMENTS', 'Enclosure Card Message and Special Delivery Instuctions <br>(i.e. directions, exceptions, Max 20 words)'); define('TABLE_HEADING_DELIVERY_INSTRUCTIONS', 'Delivery Instructions, Max 20 words)'); ////////////////////// define('TABLE_HEADING_COMMENTS', 'Enclosure Card Message and Special Delivery Instuctions <br>(i.e. directions, exceptions, Max 20 words)'); define('TABLE_HEADING_DELIVERY_INSTRUCTIONS', 'Delivery Instructions, Max 20 words)'); ////////////////////// define('TABLE_HEADING_COMMENTS', 'Enter a comment for the order processed'); define('TABLE_HEADING_DELIVERY_INSTRUCTIONS', 'Enter a comment for the order processed'); Thats it Please any help would be appreciated Thomas Link to comment Share on other sites More sharing options...
Guest Posted October 6, 2007 Share Posted October 6, 2007 Oh and I did create the field in the orders_status_history table called delivery_instructions as directed. Thomas Link to comment Share on other sites More sharing options...
Irvin Posted October 17, 2007 Share Posted October 17, 2007 I'm also looking to add a few extra fields to the checkout page and the invoice. Anyone has successfully done this pls shed some light Link to comment Share on other sites More sharing options...
Guest Posted October 17, 2007 Share Posted October 17, 2007 how is this post not detailed? I take you through phpmyadmin, and then on those pages below all you need to do is do a find for anything that has the word comments in it, then copy that line and paste it below the origional comments line.. then you need to change the variable name on the new line to comments2 or whatever else you want to name it to. tHis is the error I get Parse error: syntax error, unexpected $end in /home/xxxxxx/public_html/checkout_shipping.php on line 560 :huh: Link to comment Share on other sites More sharing options...
Guest Posted October 17, 2007 Share Posted October 17, 2007 basically - if the extra field is not require - the easy way it is look in order.php where those fields are and add another field Link to comment Share on other sites More sharing options...
Guest Posted October 18, 2007 Share Posted October 18, 2007 :'( Ok I got the second comment box to show up on the site with the correct heading, it takes data but the data does not reach the database, and I can't get it to print in the email. aarrrg any help here would be nicely appreciated, I'm pulling at straws narrowed the mail down to it down to checkout_process.php what I added is bold..see anything I missed..I'm going blind uggg // lets start with the email confirmation $email_order = STORE_NAME . "\n" . $email_order .= "\r\nThank you for your order. Some products may vary based on seasonal availability! \r\n Enjoy! \r\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n"; if ($order->info['delivery_instructions']) { $email_order .= tep_db_output($order->info['delivery_instructions']) . "\n\n"; } if ($order->info['comments']) { $email_order .= tep_db_output($order->info['comments']) . "\n\n"; } $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n"; for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) { $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n"; } if ($order->content_type != 'virtual') { $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n"; if(isset($_SESSION["shipdate"])) { $email_order.="\n" . EMAIL_TEXT_ARRIVAL_DATE . "\n" . EMAIL_SEPARATOR . "\n" . date('l, F j, Y',$_SESSION["shipdate"]) . "\n\n"; } } $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n"; if (is_object($$payment)) { $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n"; $payment_class = $$payment; $email_order .= $order->info['payment_method'] . "\n\n"; if ($payment_class->email_footer) { $email_order .= $payment_class->email_footer . "\n\n"; } } tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.