osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Help Making Comments Box Required field

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 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v2.0 Forums > osCMax v2 Features Discussion

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 12-10-2006, 07:31 PM
New Member
 
Join Date: Dec 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
mrgtih2
Default Help Making Comments Box Required field

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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #2  
Old 12-23-2006, 09:28 AM
Member
 
Join Date: Jan 2004
Location: edmonton, Alberta, Canada
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
peteyg
Default Re: Help Making Comments Box Required field

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3  
Old 12-24-2006, 05:43 PM
Member
 
Join Date: Jan 2004
Location: edmonton, Alberta, Canada
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
peteyg
Default Re: Help Making Comments Box Required field

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -8. The time now is 09:32 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax