Checkout - shopping as a guest - problem with recaptcha

  • Posts: 9
  • Thank you received: 1
5 years 7 months ago #305102

Hello,

during the checkout when I am shopping as a guest user and I confirm email address the page with address information is displayed. At the top of the page is a button thanks to which I am able to change the email address I filled in before. But when I take this opportunity the previous swither should be displayed but there is a problem with recaptcha (recaptcha is not loaded) which cause that the rest of the javascript code is not executed (address page is still displayed).

Thanks for your help,

Martin

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82865
  • Thank you received: 13372
  • MODERATOR
5 years 7 months ago #305120

Hi,

Can you provide a link to the shop with precise instructions to reproduce the problem so that we can better understand the situation ?

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 1
5 years 7 months ago #305125

Hi Nicolas,

sure I can. Test website is available

This message contains confidential information

To reproduce the issue please do the following steps:
  • add any goods into the basket
  • move to the checkout
  • move to the second step of the checkout called "přihlásit se"
  • choose first option called "nákup bez registrace" which means "shopping as a guest"
  • fill in email address and verify that you are not a robot
  • at the page where you should fill in billing address click on the button called "změnit informace" which serves for reverse email address change
  • at this moment is page broken because of the recaptcha

If you need more instructions let me know.

Martin

Please Log in or Create an account to join the conversation.

  • Posts: 82865
  • Thank you received: 13372
  • MODERATOR
5 years 7 months ago #305127

Hi,

I see what you mean now.
Try removing the code:

if($ajax)
			return '
<div id="hika-recaptcha" class="hika-recaptcha"></div>
<script type="text/javascript">
	grecaptcha.render(\'hika-recaptcha\', {\'sitekey\':\''.$pubkey.'\', \'theme\':\''.$theme.'\'});
</script>
';
of the file plugins/system/recaptcha2/recaptcha2.php and try again, that should help for that case.

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 1
5 years 7 months ago #305134

Hi Nicolas,

this solves just executing the rest of the javascript code but recaptcha is still missing so the user can not verify itself and move to the next step.

Martin

Please Log in or Create an account to join the conversation.

  • Posts: 82865
  • Thank you received: 13372
  • MODERATOR
5 years 7 months ago #305144

Hi,

I see what is the problem. Also change the code:

return '
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?onload=onloadCallbackHKRecaptcha&render=explicit&hl='.$locale.'" async defer></script>
<script type="text/javascript">var onloadCallbackHKRecaptcha = function() { window.hkCaptchaWidget = grecaptcha.render(\'hika-recaptcha\', '.$params.'); '.$js.'};</script>
<div id="hika-recaptcha" class="hika-recaptcha"></div>';
to:
return '
<script type="text/javascript">
	var onloadCallbackHKRecaptcha = function() {
			window.hkCaptchaWidget = grecaptcha.render(\'hika-recaptcha\', '.$params.');
			'.$js.'
	};
	var scriptTag = document.createElement(\'script\');
	scriptTag.src = "https://www.google.com/recaptcha/api.js?onload=onloadCallbackHKRecaptcha&render=explicit&hl='.$locale.'";
	scriptTag..defer = true;
	document.body.appendChild(scriptTag);
</script>
<div id="hika-recaptcha" class="hika-recaptcha"></div>';
in that same file and it should work.

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 1
5 years 7 months ago #305154

Hi Nicolas,

I think you have a mistype in "scriptTag.defer = true;" - double dot. But even if I correct it, it does not work and recaptcha does not load at all because of: Error: Missing required parameters: sitekey

Martin

Please Log in or Create an account to join the conversation.

  • Posts: 82865
  • Thank you received: 13372
  • MODERATOR
5 years 7 months ago #305157

Hi,

Sorry, I gave you the code for the next version of the recaptcha plugin which will support the "invisible" mode.
In your version of the plugin, you need to replace:

'.$params.'
by:
{\'sitekey\':\''.$pubkey.'\', \'theme\':\''.$theme.'\'}

The following user(s) said Thank You: brunensys

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 1
5 years 7 months ago #305208

Hi Nicolas,

yes, it seems to be working now, thank you for your help.

Martin

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.073 seconds
Powered by Kunena Forum