PDA

View Full Version : PayPal email address error check in affiliate_signup



ganast
08-24-2005, 08:51 AM
The bug issue was more the 'no error text on PayPal' part, since it needs to validate as both a required and legit e-mail entry... but I'm sure I can code the checks as needed. I just haven't spent a great deal of time going through all the code yet and I didn't want to recreate the entire wheel if some pieces were known to be there, so thanks for the answer on that part and I'll start digging.

For the person that wanted additional requirements in the affiliate signup:

To do the error checking find the following line in affiliate_signup.php:

$entry_payment_paypal_error = false;

Replace it with:

//$entry_payment_paypal_error = false;
if ((AFFILIATE_USE_PAYPAL == 'true')&&(AFFILIATE_USE_BANK == 'false')&&(AFFILIATE_USE_CHECK == 'false')) {
if ($a_payment_paypal = '') $entry_payment_paypal_error = true;
if (strlen($a_payment_paypal) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
$error = true;
$entry_paypal_address_error = true;
} else {
$entry_paypal_address_error = false;
}
}
if (!tep_validate_email($a_payment_paypal)) {
$error = true;
$entry_paypal_address_check_error = true;
} else {
$entry_paypal_address_check_error = false;
}
Then in includes/modules/affiliate_account_details.php

find line:

if ($entry_payment_paypal_error == true) {
echo tep_draw_input_field('a_payment_paypal') . ' ' . ENTRY_AFFILIATE_PAYMENT_PAYPAL_ERROR;

replace it with:

if (($entry_payment_paypal_error == true)&&(AFFILIATE_USE_BANK == 'false')&&(AFFILIATE_USE_CHECK == 'false')) {
echo tep_draw_input_field('a_payment_paypal') . ' ' . ENTRY_AFFILIATE_PAYMENT_PAYPAL_ERROR;
} elseif ($entry_paypal_address_error == true) {
echo tep_draw_input_field('a_payment_paypal') . ' ' . ENTRY_EMAIL_ADDRESS_ERROR;
} elseif ($entry_paypal_address_check_error == true) {
echo tep_draw_input_field('a_payment_paypal') . ' ' . ENTRY_EMAIL_ADDRESS_CHECK_ERROR;

Note that this is only a "fix" for a PayPal-Only setup... a similar fix will work for a Check-Only setup, or a Bank-Only setup... or we could make a nice case statement and check for all the possibilities.

Currently if an affiliate chooses none of the options, there is no error, however this *should* be default... I would asssume that if an affiliate wants to sign up, they should be able to regardless of whether or not a payment method is specified.

--gabe