Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

OSC 2.2rc2a checkout_confirmation Make Fields Required


NodsDorf

Recommended Posts

Posted

So I'm looking at our checkout confirmation page we only use 1 payment processor auth.net and I'm wondering why it is allowing somebody to submit the payment info without actually making the fields required. This just returns a general error and throws them back 1 step. Has anybody done a simple solution that makes the fields required and throws appropriate errors on submit? IE field X must not be blank ...?

 

I'm looking at the code and I think its generated in an infobox with a loop

 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
     	<tr class="infoBoxContents">
       	<td><table border="0" cellspacing="0" cellpadding="2">
         	<tr>
           	<td class="main" colspan="4"><?php echo $confirmation['title']; ?></td>
         	</tr>
<?php
 	for ($i=0, $n=sizeof($confirmation['fields']); $i<$n; $i++) {
?>
         	<tr>
           	<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
           	<td class="main"><?php echo $confirmation['fields'][$i]['title']; ?></td>
           	<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
           	<td class="main"><?php echo $confirmation['fields'][$i]['field']; ?></td>
         	</tr>
<?php
 	}
?>
       	</table></td>
     	</tr>
   	</table></td>
 	</tr>

 

Any help is appreciated.

 

Thanks

Posted

Still need some help on this one, I'm trying to check if the fields in on checkout_confirmation.php are blank, and if they are Alert the field that is blank so the user can fix it.

 

This is what I've done so far.

 

catalog/includes/classes/payment.php

 

Wrote a new function to check 2 fields

function aim_validation() {
 	$aimv = '';
 	if (is_array($this->modules)) {
   	$aimv = '<script language="javascript"><!-- ' . "\n" .
         	'function check_form_aim() {' . "\n" .
         	'  if (document.checkout_confirmation.cc_number_nh-dns == "") { ' . "\n" .
		  '  alert ("Credit Card Number Can Not Be Blank") ' . "\n" .
		  '  valid = false; ' . "\n" .
		  '  } ' . "\n" . 
		  '  else if (document.checkout_confirmation.cc_cvc_nh-dns == "") { '  . "\n" .
		  '  alert ("Verification Number Must Not Be Blank") ' . "\n" .
		  '  valid = false; ' . "\n" .
		  ' } ' . "\n" .
		  ' } else { ' . "\n" .
		  ' return valid; ' . "\n" .
		  ' } ' . "\n" .
		  ' //--></script>' . "\n";
  }
}

 

then in catalog/includes/modules/payment/authorizenet_cc_aim.php

added call to the function:

function aim_validation() {
   return false;
  }
function javascript_validation() {
 	return false;
}

function selection() {
 	return array('id' => $this->code,
              	'module' => $this->public_title);
}

function pre_confirmation_check() {
 	return false;
}

 

But I'm not getting any alerts when you submit the checkout_confirmation.php with a blank Credit Card Number or CSV code.

 

As for the javascript code I pulled the text field names from the array that seems to be called on the checkout_confirmation.php page from the authorizenet_cc_aim.php module here:

 

  	$confirmation = array('fields' => array(array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_OWNER,
                                               	'field' => tep_draw_input_field('cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),
                                         	array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_NUMBER,
                                               	'field' => tep_draw_input_field('cc_number_nh-dns')),
                                         	array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_EXPIRES,
                                               	'field' => tep_draw_pull_down_menu('cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('cc_expires_year', $expires_year)),
                                         	array('title' => MODULE_PAYMENT_AUTHORIZENET_CC_AIM_CREDIT_CARD_CVC,
                                               	'field' => tep_draw_input_field('cc_cvc_nh-dns', '', 'size="5" maxlength="4"'))));

 

 

Well, I'm stuck after this I don't know what else to try so any help is appreciated.

Posted

Hello NodsDorf,

I do not think you need to make a new php function to fix this problem. You should look to the "create acount" php file for help. It uses the form_check.js file to make sure that required fields are filled in. If the user clicks the "Next" button and they are not filled in as requiered, they will simply get an alert telling them what they did wrong. At the end of the create account file is this: require('includes/form_check.js.php'); That is what allows it to be checked. You would also have to include this at the begining: require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT); That way you can use the required fields text and add in what ever text you may need their. Creating the js code to check the fields is the easy part as I have found. I have done this before when I added nnew fields on the creat account page, such as the customer title field. I really hope that this information will help you.

- Luc

 

 

 

My Installed Contributions:

1. Ultimate SEO URLs V 2-2.2d-X

2. Quantity Box on Product Info Page

3. httpbl4osc Version 1.1.0

4. QTpro for osc 2.3

5. Header Tags SEO V 3.0 (For 2.3)

6. DHTML State Selection for 2.3.1

And Good To Know:

I use a 960gs fluid style sheet.

I do have a honey pot on my website.

Store Version: 2.3

 

“Pain is temporary. Quitting lasts forever."

- Lance Armstrong

Posted

Thanks for the tip, this got me digging some more, and I noticed the default Credit Card processor has credit card number checks on it, but in 2.2 rc2a it is written in with the eregi function so I'll have to see about getting that replaced.

 

Still working it, thanks.

Posted

Thanks for the tip, this got me digging some more, and I noticed the default Credit Card processor has credit card number checks on it, but in 2.2 rc2a it is written in with the eregi function so I'll have to see about getting that replaced.

 

Still working it, thanks.

 

 

Your welcome, glad that helped.

- Luc

My Installed Contributions:

1. Ultimate SEO URLs V 2-2.2d-X

2. Quantity Box on Product Info Page

3. httpbl4osc Version 1.1.0

4. QTpro for osc 2.3

5. Header Tags SEO V 3.0 (For 2.3)

6. DHTML State Selection for 2.3.1

And Good To Know:

I use a 960gs fluid style sheet.

I do have a honey pot on my website.

Store Version: 2.3

 

“Pain is temporary. Quitting lasts forever."

- Lance Armstrong

Posted

After looking again at the files involved in the process it is clear to me that the Authorize AIM module already had transaction responses or better explained as error codes, coded into the functionality. We just weren't seeing any of them. No matter what the problem was we always got a general error message, which from a customer's point of view isn't very helpful. After I found the switch statement in the code I realized that it is looking for a response from Authorize.net as to what the problem is then echo'ing the correct error message. It turns out that we hadn't enabled our API Transaction Responses at Auth.net... So simple.

 

Hope this helps somebody else if they run into the same issue.

Archived

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

×
×
  • Create New...