I just went through the process of integrating CAPTCHA (v 2.8_28.04.2007) into a site running ZenCart 1.3.8 and the CSS buttons (2.6.1) add-on, and I thought I would share what I learned to get it working.
The files that need to be changed are:
includes/functions/html_output.php
includes/modules/pages/contact_us/header.php
everything else in the captcha addon goes in as normal.
includes/modules/pages/contact_us/header.php: this needs to basically have the CAPTCHA add-on code merged with the 1.3.8 version of this file...
insert at line 14:
and line 27 (replacing the line that was on line 21 before the modification):Code:// BOF Captcha if(CAPTCHA_CONTACT_US != 'false') { require(DIR_WS_CLASSES . 'captcha.php'); $captcha = new captcha(); } // EOF Captcha
(the commented line of code above is the one that gets replaced)Code:// BOF Captcha if (is_object($captcha) && !$captcha->validateCaptchaCode()) { $error = true; $messageStack->add('contact', ERROR_CAPTCHA); } // if ($zc_validate_email and !empty($enquiry) and !empty($name)) { if ($zc_validate_email and !empty($enquiry) and !empty($name) and !$error) { // EOF Captcha
that is all pretty much as you would expect, but the rest has to do with CSS buttons and CAPTCHA not meshing, so that the onclick code was not appearing in the refresh button. I had to change includes/functions/html_output.php so that it would pass the onclick code to the button:
line 293 is normally:
which wipes out the $parameters variable, so we change to:Code:if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') return zenCssButton($image, $alt, 'button', $sec_class, $parameters = '');
also in html_output.php, the $parameters variable must be present in the button definition. (it wasn't in earlier versions) Yours may be OK, but check that line 331 is:Code:if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') return zenCssButton($image, $alt, 'button', $sec_class, $parameters);
Thats it for the critical stuff... should get you working.Code:$css_button = '<span class="' . $mouse_out_class . '" ' . $css_button_js . $parameters . $style . ' > ' . $text . ' </span>';



