Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Nov 2012
    Posts
    27
    Plugin Contributions
    0

    help question How to make Special Instructions/Comments field on Order Form a required field

    How can I make the Special Instructions/Comments field on Order Form a required field ?

    I have searched for this information but could not find it.

    Thank You

  2. #2
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,536
    Plugin Contributions
    19

    Default Re: How to make Special Instructions/Comments field on Order Form a required field

    You'll need to edit some of your files since this feature isn't built in.

    Edit your includes/modules/pages/checkout_confirmation/header_php.php
    Around line 48, find the following code:
    Code:
    if (isset($_POST['payment'])) $_SESSION['payment'] = $_POST['payment'];
    $_SESSION['comments'] = zen_db_prepare_input($_POST['comments']);
    and add AFTER:
    Code:
    // BOF Comments Required
    if(!zen_not_null($_SESSION['comments'])) {
    	$messageStack->add_session('checkout_payment', ERROR_COMMENTS_REQUIRED, 'error');
    	zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
    }
    // EOF Comments Required
    Next, edit your includes/languages/english.php (OR if you have a template override, it will be includes/languages/english/YOUR_TEMPLATE/english.php
    Find the following:
    Code:
    define('ERROR_PRIVACY_STATEMENT_NOT_ACCEPTED', 'Please confirm the privacy statement by ticking the box below.');
    and add after:
    Code:
    // BOF Comments Required
      define('ERROR_COMMENTS_REQUIRED','Comments are required.');
      // EOF Comments Required
    And that's it. There might be different approaches, but I think this one is the simplest...

  3. #3
    Join Date
    Jul 2012
    Posts
    16,705
    Plugin Contributions
    17

    Default Re: How to make Special Instructions/Comments field on Order Form a required field

    An approach that might help with upgrades would be to effectively do the same thing through the use of an observer... That way, when the next upgrade is performed, that header file will effectively remain the same (no special merge necessary) and with the good notes taken about the applied "mods" can verify that the proper notifiers remain.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,536
    Plugin Contributions
    19

    Default Re: How to make Special Instructions/Comments field on Order Form a required field

    Yes, you're absolutely right, but I did point out that this was the simplest method. Although observers are not rocket science, it IS slightly more complex...

    However, since I always prefer to post a solution if I know it (instead of just talking about it), here's a version with observers.
    Attached Files Attached Files

  5. #5
    Join Date
    Apr 2011
    Posts
    358
    Plugin Contributions
    0

    Default Re: How to make Special Instructions/Comments field on Order Form a required field

    Quote Originally Posted by balihr View Post
    Yes, you're absolutely right, but I did point out that this was the simplest method. Although observers are not rocket science, it IS slightly more complex...

    However, since I always prefer to post a solution if I know it (instead of just talking about it), here's a version with observers.
    I understand this is a really old post but how can apply this to One Page Checkout?

    I tried the provided file but no luck.

  6. #6
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,570
    Plugin Contributions
    122

    Default Re: How to make Special Instructions/Comments field on Order Form a required field

    Please post this question to the One Page Checkout support thread; it will get some attention there.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. Replies: 4
    Last Post: 15 Apr 2014, 04:13 PM
  2. How to Make The Order Delivery Date A Required Field?
    By trickobrien in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 4 Jul 2011, 09:12 AM
  3. Make order comments a required field?
    By straitline in forum Basic Configuration
    Replies: 3
    Last Post: 29 Dec 2008, 02:05 AM
  4. Setting Order Comments field required, and making it drop-down?
    By davemehta in forum General Questions
    Replies: 8
    Last Post: 24 Nov 2008, 06:37 PM
  5. Mysql field for for Comments/Special Instructions
    By OrganicMan in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 24 Jul 2008, 07:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR