If anyone's interested in using the Captcha feature with their Return Authorisation Request page..this is how I did it (it works great for me).
First modify your header_php.php file located in
\includes\modules\pages\returns
so it looks something like this (only modified part of file shown):
Code:
<?php
/**
* Return Page
*
* @package page
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: header_php.php 3230 2006-03-20 23:21:29Z drbyte $
*/
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
// BOF Captcha
if(CAPTCHA_CONTACT_US != 'false') {
require(DIR_WS_CLASSES . 'captcha.php');
$captcha = new captcha();
}
// EOF Captcha
//require('includes/application_top.php');
if (REGISTERED_RETURN == 'true'){
if (!$_SESSION['customer_id']) {
$_SESSION['navigation']->set_snapshot();
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}
}
$error = false;
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
$name = zen_db_prepare_input($_POST['contactname']);
$email_address = zen_db_prepare_input($_POST['email']);
$telephone = zen_db_prepare_input($_POST['telephone']);
$street_address = zen_db_prepare_input($_POST['street_address']);
$city = zen_db_prepare_input($_POST['city']);
$state = zen_db_prepare_input($_POST['state']);
$postcode = zen_db_prepare_input($_POST['postcode']);
$order_number = zen_db_prepare_input($_POST['order_number']);
$value = zen_db_prepare_input($_POST['total_value']);
$item_number = zen_db_prepare_input($_POST['item_number']);
$item_name = zen_db_prepare_input($_POST['item_name']);
$action = zen_db_prepare_input($_POST['action']);
$reason = zen_db_prepare_input(strip_tags($_POST['reason']));
$zc_validate_email = zen_validate_email($email_address);
// BOF Captcha
if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
$error = true;
$messageStack->add('returns', ERROR_CAPTCHA);
}
// EOF Captcha
if ($zc_validate_email and !empty($reason) and !empty($name) and !$error) {
Don't forget the very last line
Note that the code above will configure it so that in admin when you turn off the captcha on the Contact Us page, it would also turn off the captcha on the Returns page as well. I have a feeling you would need to edit the SQL to have a separate setting (something I wasn't sure on how to do).
Then in..
includes\templates\YOUR_TEMPLATE\templates
edit tpl_returns_default.php so it looks like this:
Code:
<label class="inputLabel" for="entry-action"><?php echo ENTRY_ACTION; ?></label>
<?php echo zen_draw_input_field('action', $default_action, 'size="20" id="entry-action"') ; ?>
<?php
}
?>
</fieldset>
<br class="clearBoth" />
<fieldset id="write">
<legend><?php echo ENTRY_REASON . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></legend>
<?php echo zen_draw_textarea_field('reason', '30', '7', '', 'id="reason"'); ?>
</fieldset>
<?php
// BOF Captcha
if(is_object($captcha)) {
?>
<fieldset>
<legend><?php echo TITLE_CAPTCHA; ?></legend>
<?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"') . ' <span class="alert">' . TEXT_CAPTCHA . '</span>'; ?>
<br class="clearBoth" />
</fieldset>
<?php
}
// BOF Captcha
?>
<br class="clearBoth" />
<div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT); ?></div>
</fieldset>
<?php
}
?>
</div>
</form>
<div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
<br class="clearBoth" />
</div>
I'm quite sure that's all I did. Please state if it works ok for you, to confirm the instructions are correct and complete.
Bookmarks