Jump to content

[Resolved] recapture


keat

Recommended Posts

On some of my contact forms, I'm using a very primitive capture method (don't ask its manual)

I spotted re-capture in store settings, so created a re-capture account and site key etc.

 

However, the google instructions mention dropping the code inside the <head> tags, which the documents editor doesn't show.

Is there an easy way to use this ?

 

 

Link to comment
Share on other sites

The admin Editor is used only to compose the actual Document content, Product Description, Category Description, and HTML email content.

CubeCart is not coded to edit skin template files (as you may have seen in Wordpress, and other applications).

Find the /skins/YOUR_SKIN/templates/main.php (and main.checkout.php, if it exists) template, open it in a programmer's text editor, and add the code with this editor.

It is critically important that any braces in this code be surrounded by white-space:

var = {['name','address']};  // BAD

var = {
['name','address']
}; // GOOD

Otherwise, Smarty will think what is inside the braces belongs to it.

Link to comment
Share on other sites

Site Documents are (supposed to be) read-only. Nothing was envisioned to have a SiteDoc be interactive.

The Contact Form is not really a SiteDoc. If the Store Setting, Features tab, "Enable Recaptcha" is enabled, then customers will see a captcha on the Contact Us page.

CubeCart keeps a session variable that will cause the captha to NOT show once a captcha on any page has been successful. For example, a successful verification on the Registration page will cause no additional captchas to appear on the Product Review, Checkout, Contact Us, or anywhere else -- for that session.

If you are not seeing a captcha on the Contact Us page (not a part of the admin, Contact Form, Content tab), then maybe you already solved one on some other page.

Link to comment
Share on other sites

My site imported all the contact and info pages from the V3 upgrade, so I havn't used the built in V6 contact form.

I may have a look, however, I'm guessing it wont do what we want.

We have a few contact forms, eg, one where the customer would fill out a form to obtain a catalogue download.

And another, where a customer could recommend a friend or product.

 

I have a home made capture on these pages, but it's pretty poor.

Link to comment
Share on other sites

CC6's Contact Form feature allows you to create a list of "departments". The visitor filling out the Contact Us form can choose which department the form will be emailed to.

However, there is no separate "Contents" that can be created specific to each department -- not without creating a plugin.

Link to comment
Share on other sites

  • 3 weeks later...

Having found the contact form and it's ability to email multiple departments from one point, I deleted my V3 forms in favour of this.

I've enable recapture and it works just fine.

However, the store admin recommends 'New Re-Capture'.

I've enabled this and configured my keys etc, but nothing appears.

 

I guess I'm not overly concerned as re-capture is far superior to what I had before, but if 'New Re-Capture' is stronger, i would prefer this.

Is there anything else I should be doing to get this to work ?

Link to comment
Share on other sites

Please remind us of the skin name and version of that skin you are using.

In Foundation, for example, the template content.recaptcha.php has this:

      {if $RECAPTCHA==='2'}<!-- New reCaptcha -->
      {if empty($CONFIG.recaptcha_public_key) || empty($CONFIG.recaptcha_secret_key)}
      <p>{$LANG.form.recaptcha_key_not_set}</p>
      {else}
      <div class="g-recaptcha" data-sitekey="{$CONFIG.recaptcha_public_key}"></div>
      {/if}
      {else}
      <!-- what to display if RECAPTCHA is not "New reCaptcha" -->

This is paired with code in the template content.recaptcha.head.php:

{if $RECAPTCHA==='2'}<script src='https://www.google.com/recaptcha/api.js'></script>{/if}

So, if your skin does not have these two files, or is not coded for the "New reCaptcha" feature in the version of CC6 you have installed, then that may explain why you don't see it.

Assuming you haven't already solved a reCaptcha for this session.

Link to comment
Share on other sites

Recapture is far far superior to the made up rubbish I had on V3.

The Mican skin fits almost perfectly with our company logo, the boss loves the look and feel, so we decided to adopt it, unbeknown that it may cause a few issues, I started working around it.

Unless a foundation skin comes along that wows the boss, then Mican is probably here to stay. If it's easy to incorporate 'New Re-Capture' into Mican, then I'm more than happy to tinker.

If not, then I'm happy to keep what we have.

Link to comment
Share on other sites

Ok, let's do this.

In the Mican /templates/ folder, create a new file.

content.recaptcha.head.php
==========================
{if $RECAPTCHA==='2'}<script src='https://www.google.com/recaptcha/api.js'></script>{/if}
In the Mican /templates/ folder, edit:

main.php
==============
Find:

	{if $FBOG}
	<meta property="og:image" content="{$PRODUCT.thumbnail}">
	<meta property="og:url" content="{$VAL_SELF}">
	{/if}

Add After:

      {include file='templates/content.recaptcha.head.php'}
In the Mican /templates/ folder, edit:

content.recaptcha.php
======================

Find:

  <legend>{$LANG.form.verify_human}</legend>

Add After:

      {if $RECAPTCHA==='2'}
      {if empty($CONFIG.recaptcha_public_key) || empty($CONFIG.recaptcha_secret_key)}
      <p>{$LANG.form.recaptcha_key_not_set}</p>
      {else}
      <div class="g-recaptcha" data-sitekey="{$CONFIG.recaptcha_public_key}"></div>
      {/if}
      {else}

Find:
  {$DISPLAY_RECAPTCHA}

Add After:
      {/if}

Since we have edited templates, be sure to clear the cache (admin, Maintenance, Rebuild tab, Clear Cache).

Link to comment
Share on other sites

As a test, in admin, Store Settings, Features tab, completely blank the New reCaptcha site and secret key fields. Be sure "New reCaptcha (Recommended) is chosen. Click the Save button.

On the storefront, view the Register page. You should see:

Verify you are a human
reCaptcha public and/or private key has not been set!

That shows that some, if not all, of the edit in content.recaptcha.php is correct.

Next, have your browser show you the Source HTML. You should see:
<script src='https://www.google.com/recaptcha/api.js'>

somewhere in the <head> section.

 

Link to comment
Share on other sites

Hold on 5, i think i rolled back the skin when it didn't work.

 

with the keys removed, I do see 'Keys not set' message

in the page source I only see this though.

 

    <fieldset id="recaptcha-title">
  <legend>Verify you are a human</legend>
              <p>reCAPTCHA public and/or private key has not been set!</p>
            </fieldset>

content.recaptcha.php

 

{if $RECAPTCHA}
<fieldset id="recaptcha-title">
  <legend>{$LANG.form.verify_human}</legend>
  {if $RECAPTCHA==='2'}
      {if empty($CONFIG.recaptcha_public_key) || empty($CONFIG.recaptcha_secret_key)}
      <p>{$LANG.form.recaptcha_key_not_set}</p>
      {else}
      <div class="g-recaptcha" data-sitekey="{$CONFIG.recaptcha_public_key}"></div>
      {/if}
      {else}
  <script type="text/javascript">
   var RecaptchaOptions = {
      theme : 'clean'
   };
  </script>
  {$DISPLAY_RECAPTCHA}
   {/if}
</fieldset>
{/if}

Link to comment
Share on other sites

Had a thought today whilst on the trian to the city.

As i only modified the Mican skin, then anyone trying to register via the mobile skin would have the same issue.

I was right.

Thankfully, we have mobile internet, so I swiftly rolled back to the old Re-Capture.

Would these edits be much the same for the Mobile skin ???

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...