Archives de
Month: août 2017

How to integrate Recaptcha in Prestashop in 3 steps

How to integrate Recaptcha in Prestashop in 3 steps

Prestashop is one of the most used ecommerce on the internet BUT the contact form has no protection again the spam. Of course you can buy an additional plugin but I will explain how to integrate a spam protection without paying. You have to create and configure an account, change 2 sources. You can make it in 30 mn or less.

Here is a howto step by step for prestashop 1.6 (I don’t know about prestashop 1.7 but I imagine it should be similar).

1 Setup your Google reCAPTCHA if you don’t have it

Note the key and the secret key

You have to configure it and put your domain name.

2  Change the contact-form.tpl

First you have to change the contact form (client side) contact-form.tpl should be in your theme. Open an editor and search the submit botton

For me it is like that

 <div class="submit">
 <button type="submit" name="submitMessage" id="submitMessage" class="button"><span>{l s='Send'}<i class="icon-chevron-right right"></i></span></button>


Just above add few lines of code. Replace key by your key

 <script src=''></script>
<div class="g-recaptcha" data-sitekey="key"></div>


That should look like that

 <script src=''></script>
 <div class="g-recaptcha" data-sitekey="key"></div>

 <div class="submit">
 <button type="submit" name="submitMessage" id="submitMessage" class="button"><span>
{l s='Send'}
<i class="icon-chevron-right right"></i></span>

3 Change ContactControler.php

If you don’t have this source in override\controllers\front copy it from controllers\front

Then you have to add few lines to check if the captcha is ok or not

search the postProcess() function it should be at the begining (2nd function) and add

  if (Tools::isSubmit('submitMessage')) {
 $extension = array('.txt', '.rtf', '.doc', '.docx', '.pdf', '.zip', '.png', '.jpeg', '.gif', '.jpg');
 $file_attachment = Tools::fileAttachment('fileUpload');
 $message = Tools::getValue('message'); // Html entities is not usefull, iscleanHtml check there is no bad html tags.
 $id_order = (int)$this->getOrder();
 if (!($from = trim(Tools::getValue('from'))) || !Validate::isEmail($from)) {
 $this->errors[] = Tools::displayError('Invalid email address.');
// add the 2 lines from here
 } elseif (!($gcaptcha = (int)(Tools::getValue('g-recaptcha-response')))) {
 $this->errors[] = Tools::displayError('Captcha error');
// to here
World’s longest pedestrian suspension bridge opens in Switzerland

World’s longest pedestrian suspension bridge opens in Switzerland

Switzerland has opened the world’s longest suspension footbridge. It is 494 meters long.

The bridge is suspended between 1,600 meters and 2,200 meters above sea level. It is only 65 centimeters wide and goes as high as 85 meters above the ground.

Hikers, within sight of the famed mountain, the Matterhorn, and the Bernese Alps, can cross it in about 10 minutes

The bridge crosses the deepest-cut valley in Switzerland. Hikers can look down onto it through grates in the bridge.

Without the bridge, the journey previously took up to four hours.

According to Swiss reports, it took only 10 weeks to build the bridge. And the structure surpasses Germany’s “Titan-RT” as the world’s longest suspension footbridge. The « Titan-RT », which opened last month, is just over 450 meters long. It crosses Germany’s highest reservoir, the Rappbode Dam.

The Swiss bridge is also longer than the so-called « footbridge in the sky. » This bridge, built in 2014, is part of the Sochi Sky Park in Russia. It spans 439 meters and includes observation platforms looking on the mountains and the Black Sea Coast.