Archives de
Category: Digital

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

https://www.google.com/recaptcha/intro/index.html

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>
 </div>
 </form>

 

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

 <script src='https://www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="key"></div>

 

That should look like that

<div>
 <script src='https://www.google.com/recaptcha/api.js'></script>
 <div class="g-recaptcha" data-sitekey="key"></div>
</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>
</button>
 </div>
 </form>

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
Tutorial How to make a voice record with protools first

Tutorial How to make a voice record with protools first

Pro Tools is a digital audio workstation which can be used for a wide range of sound recording and sound production purposes. Like all digital audio workstation software, Pro Tools can perform the functions of a multitrack tape recorder and audio mixer, along with additional features that can only be performed in the digital domain, such as non-destructive editing, using the Undo feature, which allows an engineer to undo any changes he or she does not like.

If you start using ProTools, you can download a free version Protools first. This version is just limited but you can use it for training. If you are completely beginer and just want to have a basic audio recording this is a tutorial for you. You have plenty of tutorial but most of them are for musicians or for advanced level. In halt an hour you will be able to create your first record.