Hi Anne
I'm assuming you are using the 'Ask a Question' plugin - https://www.zen-cart.com/downloads.php?do=file&id=109
If so, it should be fairly easy to add it to that.
Essentially you need too look at the instruction for pre-1.5.1 installation
In /includes/modules/ask_a_question/header.php just after line 41 add:
and change the line below it fromCode:$zco_notifier->notify('NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK');
toCode:if ($zc_validate_email and !empty($enquiry) and !empty($name)) {
in /includes/classes/observers/class.google_recaptcha.php insert this just below line number 23Code:if ($zc_validate_email and !empty($enquiry) and !empty($name) and $error == false) {
in your tpl_ask_a_question_default.php file (probably just under the textarea, so line 80) addCode:$pages_to_check[] = 'NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK';
That should do it :)Code:<?php echo recaptcha_get_html(); ?>
Hi Anne
Opps forgot - in /includes/classes/observers/class.google_recaptcha.php line 42 change
toCode:$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text');
Code:$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text','NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK' => 'ask_a_question');
Got a question via private message - so I thought I'd post it here so that everyone can see the answer:
Hi David,
I have added the files to my cart, v1.5.4, english and dutch version.
I have a graphic on the contact us page and create account page, on both languages it says "Ik ben geen robot" (I am not a robot)
How can I get the text in engllish om my english pages?
Answer:
When the request is sent to Google to display the reCaptcha they detect what your language setting is in your browser and automatically display the reCaptcha challenge in that language. So generally for multi-language sites you don't need to do anything, the customers preferred language will be used.
The only time it might be a problem is if the customer is using a computer that isn't their own and the browser language is set to some other language.
It is possible to force the reCaptcha to display in a specific language by adding a language code to the javascript call
eg - to force the display in spanish you would have
To do this you would need to alter the file /includes/functions/extra_functions/recaptchalib.php and detect the language being used by Zen. This however might lead to other difficulties - if for instance a Spanish person is looking at your site which is in Dutch and English, they may choose to see the site in English (because their English is better than their Dutch) then tieing the language for Google to the language for Zen would lead to that spanish person seeing an English reCaptcha rather than the Spanish version that they would see by default.Code:script src="https://www.google.com/recaptcha/api.js?hl=es
A bit of a rambling answer I'm afraid, but in short you don't have to do anything, your customers will see the reCaptcha in their own language
Regards
David
OK! David, thank you for your explanation ! , Cees
David,
Thanks for the awesome module! Initial installation was a super simple.
I am atttempting to add the reCaptcha to the AJAX FAQ module following the tips you gave others on adding it to the ask a question module.
Unfortuantely I have not gotten far, with the added reCaptcha code to the class file for the faq when I click submit nothing happens...
You can take a look on the product page HERE by clicking on Ask A Question, just below the part number.
Any insight on how to get this working as well as it does on the other pages would be greatly appreciated.
Hi Mike
Just had a quick look at it (nice site btw). I think what you need to do is in the class.faq_request.php file:
Add at the beginning of the function update (just after the global $messagestack):
then change the line 2 below fromCode:$error=false; $zco_notifier->notify('NOTIFY_FAQ_CAPTCHA_CHECK');
toCode:if(isset($_POST['email_address']) && !empty($_POST['email_address']) && isset($_POST['fullname']) && !empty($_POST['fullname']) && isset($_POST['message']) && !empty($_POST['message']) && isset($_POST['subject']) && !empty($_POST['subject'])) {
in the class.google_recaptcha.php file add (line 23 ish)Code:if(isset($_POST['email_address']) && !empty($_POST['email_address']) && isset($_POST['fullname']) && !empty($_POST['fullname']) && isset($_POST['message']) && !empty($_POST['message']) && isset($_POST['subject']) && !empty($_POST['subject']) && $error==false) {
Hopefully that should sort it - if not I'll have another lookCode:$pages_to_check[] = 'NOTIFY_FAQ_CAPTCHA_CHECK';
Regards
David
I have tried to use this module for my client and it is a good module but there are a few problems when you try to use many Google Recaptcha on one page. It can not with this module. I think author needs to update the code with this code:
https://developers.google.com/recapt...xplicit_render
Our Site: http://zucando.com
Marketing Plugins: Marketing Modules
Free Response Templates: Responsive Templates
I could have done it that way, but because stock Zen Cart only has one form per page it wouldn't be worth it. If you want several reCaptchas on the one page, you have correctly identified how to change things to make that work
Regards
David
Bookmarks