Quote Originally Posted by nikki72 View Post
Hello,
I wanted to add this option to my return authorization form. I have search for link with instructions..but couldn't find any... does anyone know how to get this to work with return authorization form? I tired but to no avail .

thanks nicole
If it's the Return Authorization by Clyde, then for tpl_returns_default.php add the following, I placed mine just above the submit button..

Code:
<?php
// BOF Captcha
if(is_object($captcha) && (!$_SESSION['customer_id'])) {
?>
<br class="clearBoth" />
<?php echo $captcha->img(); ?>
<?php echo $captcha->redraw_button(BUTTON_IMAGE_CAPTCHA_REDRAW, BUTTON_IMAGE_CAPTCHA_REDRAW_ALT); ?>
<br class="clearBoth" />
<label for="captcha"><?php echo TITLE_CAPTCHA; ?></label>
<?php echo $captcha->input_field('captcha', 'id="captcha"') . '&nbsp;<span class="alert">' . TEXT_CAPTCHA . '</span>'; ?>
<br class="clearBoth" />
<?php
}
// BOF Captcha
?>
Then for the header file in >modules/pages/retuns/header_php.php you need to add it in two places, first anywhere near the top this section of code..

Code:
//BOF Captcha
if((CAPTCHA_RETURNS != 'false') && (!$_SESSION['customer_id'])) {
    require(DIR_WS_CLASSES . 'captcha.php');
    $captcha = new captcha();
}
// EOF Captcha

  $error = false;
I did mine just above this line..
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
Notice the CAPTCHA_RETURNS in the if statement, this turns it on or off through admin. if you don't do a SQL statement to add this, you'll need to change it to something else like CAPTCHA_CONTACT_US which has an admin control.

Look for this line
if ($zc_validate_email and !empty($reason) and !empty($name)) {
replace it with the following code..
Code:
//BOF Captcha
  if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
    $error = true;
    $messageStack->add('returns', ERROR_CAPTCHA);
  }
//  if ($zc_validate_email and !empty($reason) and !empty($name)) {
  if ($zc_validate_email and !empty($reason) and !empty($name) and !$error) {
 //EOF Captcha
To turn it on or off in admin.. add a sql statement using the Zen-Cart Sql Patches tool. Please backup your database before doing this... you never know when something will go wrong..
Code:
SET @configuration_group_id=0;
SELECT (@configuration_group_id:=configuration_group_id) FROM configuration_group WHERE configuration_group_title= 'CAPTCHA' LIMIT 1;

INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function) VALUES 
(NULL, 'Return Authorization', 'CAPTCHA_RETURNS', 'true', 'Activate Validation on Return Authorization', @configuration_group_id, 23, NOW(), NULL, 'zen_cfg_select_option(array(\'true\', \'false\'),');
Again... BACKUP before running the SQL statement.. I do my testing on a testing server before making any changes to a live site!