[contact-form-7 id="24078" title="Feedback EN"]

Featured templates

PrestaShop 1.5.x Troubleshooter. Send to a friend module is not working

This tutorial will show you how to fix the Send to a Friend module in Prestashop 1.5.x.

PrestaShop 1.5.x. Troubleshooter. Send to a friend module is not working

In order to get rid of the error, you will need to update theme files on server.

  1. Connect to server via FTP or open cPanel file manager.

  2. Open the modules/sendtoafriend folder on server. Next, open the sendtoafriend-extra.tpl file. Find the line with the $(‘#sendEmail’).click(function() function. Copy body of the function:

    $('#sendEmail').click(function(){
            var name = $('#friend_name').val();
            var email = $('#friend_email').val();
            var id_product = $('#id_product_comment_send').val();
            if (name && email && !isNaN(id_product))
            $.ajax({
            {/literal}url: "{$module_dir}sendtoafriend_ajax.php",{literal}
            				type: "POST",
                            headers: {"cache-control": "no-cache"},
                            data: {action: 'sendToMyFriend', secure_key: '{/literal}{$stf_secure_key}{literal}', name: name, email: email, id_product: id_product},{/literal}{literal}
                            dataType: "json",
                            success: function(result) {
                            			$.fancybox.close();
                                        var msg = result ? "{/literal}{l s='Your e-mail has been sent successfully' mod='sendtoafriend'}{literal}" : "{/literal}{l s='Your e-mail could not be sent. Please check the e-mail address and try again.' mod='sendtoafriend'}{literal}";
                                        var title = "{/literal}{l s='Send to a friend' mod='sendtoafriend'}{literal}";
                                        fancyMsgBox(msg, title);
                                     }
                                  });
                                }else
                                		$('#send_friend_form_error').text("{/literal}{l s='You did not fill required fields' mod='sendtoafriend' js=1}{literal}");
             });
  3. Next, open the themes/themeXXX/modules/sendtoafriend folder on server. Open the sendtoafriend-extra.tpl file. Find the line with the $(‘#sendEmail’).click(function() function. Replace body of the function with the code you’ve copied.

  4. Save changes in the file. Refresh front-end with Ctrl/Cmd+F5 to test the form:

    PrestaShop 1.5.x. Troubleshooter. Send to a friend module is not working-1

Feel free to check the detailed video tutorial below:

PrestaShop 1.5.x. Troubleshooter. Send to a friend module is not working