Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to make Comments a required field


EricK

Recommended Posts

Posted

I'm using the Comments field for delivery Date and Time info. How do I make that a required field - v2.2 June02?

 

Many thanks- ocs rocks!

Posted

Do you mean you want to use it for them to give you a delivery date and time or for them to give you one?

 

If it is to have them give you a delivery date and time then I think making it required is not really what you need. I would think a way for the box to be checked to see if it is empty and to generate maybe a popup saying "You have not provided a delivery date and time" otherwise, if it is for you to pu the dekuvery info, then I think you could add a box to the orders status called "Delivery Info" and put it there and have it show in the customers account

Posted

It is for customers to give me their order delivery date and time ... the cart is for a catering service.

 

A popup would be great, the page checkout_payment.php already has a javascript validation popup for the payment modules, but it does not work for the Comments text field.

 

Should I add another javascript validation script for the Comments field, or will a PHP validate_fields function or error function ($error == "") work ??? This is the text field:

 

<?php echo tep_draw_textarea_field('comments', 'virtual', '60', '5'); ?>

 

Many thanks.

  • 2 months later...
Posted

try adding something like this to catalog/includes/form_check.js.php:

 

if (document.account_edit.elements['comments'].type != "hidden") {



   if (document.account_edit.comments.value == 0) {



     error_message = error_message + "<?php echo JS_COMMENTS; ?>";



     error = 1;



   }



 }

  • 1 year later...
  • 3 years later...
Posted
did anyone get this to work?

 

working on this right now. please share explanations.

 

thank you

 

Anyone ever get an easy solution to this? I would like to use this too. Or even better, can a pull down calendar and pull and pull down time list be added to the checkout page? I am thinking of the kind used by car rental companies. This would allow customers to choose their pick up time and date easily and obviate the need for mandatory comments.

 

Thanks,

 

Bruce

Posted
Try the ShipDate contribution. Turning the comment field into something else is a bad idea since a customer may really want to enter a comment.

 

Jack

 

Jack,

 

Thanks so much for the tip, I'll check it out and see how it works. Figured someone a lot smarter than me had thought of this already!

 

Bruce

  • 3 weeks later...
Posted

I am using shipdate for a catering company and it is working great.

 

But I am still looking for a way to make a delivery and pickup time required.

 

Any suggestions?

Posted
I am using shipdate for a catering company and it is working great.

 

But I am still looking for a way to make a delivery and pickup time required.

 

Any suggestions?

I don't use it and not familiar with the code but if there isn't an option to do that in the contribution, then the code would have to be added to check it. Either way, you should ask in the support thread for that contribution since that is where someone that uses it is more likely to see your question.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Posted
try adding something like this to catalog/includes/form_check.js.php:

if (document.account_edit.elements['comments'].type != "hidden") {
if (document.account_edit.comments.value == 0) {
  error_message = error_message + "<?php echo JS_COMMENTS; ?>";
  error = 1;
}
 }

 

Has anyone tried this and does it work? If so, can you share where exactly this code is placed in form_check.js.php. I would very much like to have this functionality, to require SOME entry in the comments field. I tired shipdate and could not get it to work for me.

 

Thanks,

 

Bruce

  • 3 years later...
Posted

This worked for me. found it on another forum.

 

in checkout_confirmation.php insert:

 

//-- Check the comments field

if (strlen($HTTP_POST_VARS['comments']) < 0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_CHECKOUT_COMMENTS_EMPTY), 'SSL', true, false));

}

 

 

 

in includes/languages/english.php insert:

 

define('ERROR_CHECKOUT_COMMENTS_EMPTY', 'please enter your blablabla text here');

 

If putting the above in the english.php doesn't work put it in the includes/languages/english/checkout_confirmation.php

Archived

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

×
×
  • Create New...