Forums / General Questions / Modifying the checkout process - making "comments" a required field - urgent

Modifying the checkout process - making "comments" a required field - urgent

Locked

Views: 2,202

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
24 Aug 2007, 7:54 AM
#1
auroramedia avatar

auroramedia

New Zenner

Join Date:
May 2007
Posts:
7
Plugin Contributions:
0

Modifying the checkout process - making "comments" a required field - urgent

I need to make the Comments/Special instructions text area field on the checkout process (page 2 of 3) a compulsory field. The process should not advance to page 3 unless this field has some data.

Could someone please advice on how to implement this.

Thanks in advance.

29 Aug 2007, 5:03 AM
#2
auroramedia avatar

auroramedia

New Zenner

Join Date:
May 2007
Posts:
7
Plugin Contributions:
0

Re: Modifying the checkout process - making "comments" a required field - urgent

We urgently need to make the Comments / Special Instructions field appearing at the end of the Checkout Page 2 of 3 a compulsory field.

The Checkout should not proceed to Step 3 unless this field has some data.

What modifications do I need to do to ensure that?

Please advice.

Thanks all.

30 Aug 2007, 7:03 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Modifying the checkout process - making "comments" a required field - urgent

This is the concept which you can work with to build your custom coding:
/includes/modules/pages/checkout_confirmation/header_php.php
around line 44 you have:```
if (isset($_POST['payment'])) $_SESSION['payment'] = $_POST['payment'];
$_SESSION['comments'] = zen_db_prepare_input($_POST['comments']);


Add the check to enforce not-empty content:```
if (isset($_POST['payment'])) $_SESSION['payment'] = $_POST['payment'];
$_SESSION['comments'] = zen_db_prepare_input($_POST['comments']);
[B]if ($_SESSION['comments'] == '') {
  $messageStack->add('checkout_payment', 'Please enter order comments before proceeding.', 'error');
  zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}[/B]

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

31 Aug 2007, 6:29 AM
#4
auroramedia avatar

auroramedia

New Zenner

Join Date:
May 2007
Posts:
7
Plugin Contributions:
0

Re: Modifying the checkout process - making "comments" a required field - urgent

Thanks a million DrByte. Your suggestion was all that was needed to get it working. Only the add('checkout_payment'...... had to be changed to add_session('checkout_payment'.... to get the error prompt to show on the frontend.

It is now working just as we had wanted. Thanks again.

AuroraMedia