This is a discussion on Help Making Comments Box Required field within the osCMax v2 Features Discussion forums, part of the osCMax v2.0 Forums category; Need a required field for delivery date I've searched the forums, Googled the question, searched contributions and read a couple ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Need a required field for delivery date I've searched the forums, Googled the question, searched contributions and read a couple of posts that didn't answer the question. Can someone please tell me how to make the comments box a required field from the checkout_shipping.php page? I would like to have people input an approximate delivery date that they want to have their order shipped. Can I make the comments box a manditory field or would it be better to add another text field and make it manditory? We ship fruit from FL and need this as a function from the checkout procedure. Please help US! Thank You! |
|
#2
| |||
| |||
| You don't have to add another text field. Mainly if you need the field to be manditory, it's better to use the one you've got. Making a new field for important info will require making a new field in the database. I would stick to making the comments field manditory and maybe renaming it... or inserting some text intsucting the customer to write in the box. And on top of that make it so they have to write something in the box. I have not looked at the code in quite sometime I've been out of the loop for a bit. I am certain I can help you though if you would give me sometime. |
|
#3
| |||
| |||
| make a back up copy of catalog/checkout_shipping.php and catalog/includes/languages/english.php. Goto catalog/includes/languages/english.php and find the following line... define('ENTRY_COMPANY', 'Company Name:'); above it add the following .... define('ENTRY_COMMENTS_ERROR', 'delete this text and type what you want the error to say'); now goto your catalog/checkout_shipping.php find the following code // process the selected shipping method 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 (!tep_session_is_registered('shipping')) tep_session_register('shipping'); if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) { if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) { $shipping = $HTTP_POST_VARS['shipping']; list($module, $method) = explode('_', $shipping); if ( is_object($$module) || ($shipping == 'free_free') ) { if ($shipping == 'free_free') { $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE; $quote[0]['methods'][0]['cost'] = '0'; } else { $quote = $shipping_modules->quote($method, $module); } if (isset($quote['error'])) { tep_session_unregister('shipping'); } else { if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) { $shipping = array('id' => $shipping, 'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'), 'cost' => $quote[0]['methods'][0]['cost']); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYME NT, '', 'SSL')); } } } else { tep_session_unregister('shipping'); } } } else { $shipping = false; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYME NT, '', 'SSL')); } } change it to this //Added for required comments field $error = false; // process the selected shipping method if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) { if (!tep_session_is_registered('comments')) tep_session_register('comments'); $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']); if (strlen($comments) < 5) { $error = true; $messageStack->add('comments', ENTRY_COMMENTS_ERROR); } if ( $error == false) { if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) { if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) { $shipping = $HTTP_POST_VARS['shipping']; list($module, $method) = explode('_', $shipping); if ( is_object($$module) || ($shipping == 'free_free') ) { if ($shipping == 'free_free') { $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE; $quote[0]['methods'][0]['cost'] = '0'; } else { $quote = $shipping_modules->quote($method, $module); } if (isset($quote['error'])) { tep_session_unregister('shipping'); } else { if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) { $shipping = array('id' => $shipping, 'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'), 'cost' => $quote[0]['methods'][0]['cost']); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYME NT, '', 'SSL')); } } } else { tep_session_unregister('shipping'); } } } } else { $shipping = false; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYME NT, '', 'SSL')); } } I think it may work. If not just replce files with the backup copies. |
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Add required to some of the field names | oneplace2u | osCommerce 2.2 Modification Help | 0 | 09-04-2006 05:33 PM |
| comments box | joanstead | osCMax v2 Installation issues | 0 | 03-25-2006 06:12 PM |