Jump to content

Send to friend module not working


Recommended Posts

I have fresh installation of prestashop 1.5.4.1. After i install send to friend module thats come with prestashop then i try to use it on front office but cannot. Once i put my email address on it and I didn't receive any email after click send. Is there anything that i need to configure?

Edited by goodboy88 (see edit history)
Link to comment
Share on other sites

Well, you use Softaculous, in my opinion it isn't great idea. But of course we can try to fix it.

 

For the first you should turn error reporting in your prestashop, after that - try to use the Send to friend module

 

if any error appear - paste it here

Link to comment
Share on other sites

Well, you use Softaculous, in my opinion it isn't great idea. But of course we can try to fix it.

 

For the first you should turn error reporting in your prestashop, after that - try to use the Send to friend module

 

if any error appear - paste it here

 

Hi Vekia,

 

There is no error appear.

 

I try to turn on the report by:

going to config/config.inc.php line 29 (actually there is nothing there) then i add

@ini_set('display_errors', 'on'); on line 29

but still there is no error come out. Or is there anyway to turn the error report on on prestashop 1.5.4.1?

Link to comment
Share on other sites

  • 2 weeks later...

ok, so i solved this by adding the language file and language folder in the modules/sendtoafriend/mails & ..../translations/

 

the problem was that by default this module didn't have the romanian language (ro), so i copy paste the english one and renamed the folder into ro and translated the content of the files in that folders + created the ro.php in the translation folder and that's it.

 

hope it will help you

Link to comment
Share on other sites

  • 3 weeks later...

I have exactly same problem. SendToAFrient doesn't send mail and there is no error (even when error display is enabled).

Shop is after upgrade from 1.4.10 installation (module was working).

I have all mentioned langauge files and folders.

Any idea what how/where look for solution?

Link to comment
Share on other sites

  • 1 month later...

i have the same trouble with this module, it doesnt send emails at all.

 

in server log show this error:

 

mod_fcgid: stderr: PHP Notice: Undefined property: stdClass::$value in .../public_html/modules/sendtoafriend/sendtoafriend_ajax.php on line 43

mod_fcgid: stderr: PHP Notice: Undefined property: stdClass::$value in .../public_html/modules/sendtoafriend/sendtoafriend_ajax.php on line 45

 

and it is :

 

43 line - $friendName = $entry->value;

 

45 line - $friendMail = $entry->value;

 

 

Fresh copy PS 1.5.4.1 without any modifications.

 

pls help solve this.

Link to comment
Share on other sites

  • 2 weeks later...

Hello PS Folks,

I have the same prob.

When I look in dev tools, alle things going ok, but no sending the email.

I use v1.5.4.1, one language.

Someone told me that these email to a friend module a risico are for spamming. And on The moment, I have disable them.

 

Best Regards,

Generaal

Link to comment
Share on other sites

so in this case you want to use SMTP method.

go to the adv. preferneces > e-mail tab in your back office

 

select the option:

Set my own SMTP parameters. For advanced users ONLY

 

then use this:

mWaWvUa.png

 

remember to use correct SMTP user (your e-mail addres) and SMTP password value

Link to comment
Share on other sites

hello @plaza24

 

it looks like problem with the ajax query to the sendtoafriend_ajax.php file located in the module directory. there is a foreach loop:

foreach ($friend_infos as $entry)
 {
  if ($entry->key == "friend_name")
   $friendName = $entry->value;
  else if ($entry->key == "friend_email")
   $friendMail = $entry->value;
  else if ($entry->key == "id_product")
   $id_product = $entry->value;
 }

and the most important variable is a $friend_infos ($friend_infos = Tools::jsonDecode(Tools::getValue('friend'));)

it's strictly related to the ajax post call and to the form:

<form method="post" action="{$request_uri}" class="std">
   <fieldset>
 <div class="product clearfix">
  <a href="{$productLink}" class="img_link"><img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'small_default')}" alt="" title="{$cover.legend}" /></a>
  <a href="{$productLink}" class="product_desc"><br />{$product->name}</a>
 </div>
 <div id="send_friend_form_content">
  <p class="text">
   <label for="friend-name">{l s='Friend\'s name' mod='sendtoafriend'}</label>
   <input type="text" id="friend-name" name="name" value="{if isset($smarty.post.name)}{$smarty.post.name|escape:'htmlall':'UTF-8'|stripslashes}{/if}" />
  </p>
  <p class="text">
   <label for="friend-address">{l s='Friend\'s email' mod='sendtoafriend'}</label>
   <input type="text" id="friend-address" name="email" value="{if isset($smarty.post.name)}{$smarty.post.email|escape:'htmlall'|stripslashes}{/if}" />
  </p>
  <p class="submit">
   <input type="submit" name="submitAddtoafriend" value="{l s='send' mod='sendtoafriend'}" class="button" />
  </p>
 </div>
   </fieldset>
  </form>

(part of the sendtoafriend.tpl file)

 

sorry for the boring introduction :D what to do now? well, you should compare this form code with code that you've got in your own module. values of the fields must be the same as the field names in the ajax .php file in the foreach loop.

 

can i test your website? if so, please share the url

Link to comment
Share on other sites

well, this is not bug at all, because in my several installations this module works well.

The problem is a bit different, i've got some workaround, but i'm not sure what's goin on in your store, so i can't say something more... everything depends on it

Link to comment
Share on other sites

well, this is not bug at all, because in my several installations this module works well.

The problem is a bit different, i've got some workaround, but i'm not sure what's goin on in your store, so i can't say something more... everything depends on it

you are sure that it is not bug ? :)

why this bag present on others servers and configurations too?

Link to comment
Share on other sites

that's the question. i've got several installations which works very well without any fix

i suppose that everything depends on many aspects like shop configuration and server conf.

 

may i ask you for something?

are you able to check the ajax query (especially result of it) when you're trying to "send" to a friend ?

 

after that i will know everything what's goin on :)

Link to comment
Share on other sites

  • 2 weeks later...

that's right, this is the solution

 

i suppose that this is some kind of "escaping" ;) but really poor ;)

vekia, after removing this .replace(/u/g, '%u'), it is really start working!

so if you think that it is really poor, how to solve this ?

Link to comment
Share on other sites

  • 3 weeks later...

I am having a similar issue using PS 1.5.5.0 and "Send to a Friend" module v.1.2 - However, the mod looks great but is non-functional. When I fill in the fields and  hit the "Send" button I get an error stating "You did not fill required fields" at the top in a red font and nothing happens. But, clearly I have filled these fields in..... any help??? I have included a screenshot as well.

 

send-to-friend-error.jpg

Link to comment
Share on other sites

Hi 

 

I using the send to a friend module V1.2 with Prestashop 1.5.5.0 and am getting the same message "You did not fill the required fields " when the form has been filled out, any ideas ?

 

I managed to get the comments sorted with the fix on this page

http://www.prestashop.com/forums/topic/240868-product-comments-error/page-2 

 

but this solution i cannot find.

 

Thanks in Advance

Link to comment
Share on other sites

Hello all, please check this Github fix and let me know if this fixes the issue with the module. https://github.com/PrestaShop/PrestaShop/commit/9d94337c9b6d1c808381f8181de1efc58e6c14e7

Although I have the Version: 1.2 Send to a friend the module. I made the changes and when you click on the link "send to a friend" does absolutely nothing.

 

sendtoafriend-extra.tpl:

 

$('#sendEmail').click(function(){
var datas = [];
$('#fancybox-content').find('input').each(function(index){
var o = {};
o.key = $(this).attr('name');
o.value = $(this).val();
if (o.value != '')
datas.push(o);
});
if (datas.length >= 3)
{
$.ajax({
Link to comment
Share on other sites

 

Although I have the Version: 1.2 Send to a friend the module. I made the changes and when you click on the link "send to a friend" does absolutely nothing.

 

sendtoafriend-extra.tpl:

 

$('#sendEmail').click(function(){
var datas = [];
$('#fancybox-content').find('input').each(function(index){
var o = {};
o.key = $(this).attr('name');
o.value = $(this).val();
if (o.value != '')
datas.push(o);
});
if (datas.length >= 3)
{
$.ajax({

 

 

you downloaded latest package from github? 

can you check your browser console log? what happens there after clickin on "send to a friend" button

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...

Hello,

I also had this problem and no solution from the above worked for me.

 

My setup: Version 1.5.6.0, Greek language, English language disabled, my-theme a modified default theme

 

  • In my-theme folder themes/my-theme/modules/sendtoafriend/mails there was only a folder "el" for the Greek language

No English folder. This seemed to be the problem.

 

  1. I coppied the en folder from modules/sendtoafriend/mails to themes/my-theme/modules/sendtoafriend/mails
     
  2. Uninstalled and reinstalled the module sendtoafriend 

And miracle! Everything works fine. 

 

 

  • Like 1
Link to comment
Share on other sites

Hello,

I also had this problem and no solution from the above worked for me.

 

My setup: Version 1.5.6.0, Greek language, English language disabled, my-theme a modified default theme

 

  • In my-theme folder themes/my-theme/modules/sendtoafriend/mails there was only a folder "el" for the Greek language

No English folder. This seemed to be the problem.

 

  1. I coppied the en folder from modules/sendtoafriend/mails to themes/my-theme/modules/sendtoafriend/mails

     

  2. Uninstalled and reinstalled the module sendtoafriend 

And miracle! Everything works fine. 

 

thank you for information how you solved it,

im convinced that this post will help other merchants here so in my opinion this post should be pinned somewhere :)

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I don't know why, but it starting when remove:

 

.replace(/u/g, '%u')

 

from sendtoafriend-extra.tpl

 

then value is value instead val

 

Why author replace the char?

 

I tried loads of things then had to uninstall, reinstall etc etc but finally found solution. 

I use PS 1.5.4.1 and Sendtofriend 1.2.

The only thing I changed after reinstall was to remove .replace(/u/g, '%u') from sendtoafriend-extra.tpl, as Lukkos had said. And that worked. :) Hope it helps someone.

Link to comment
Share on other sites

  • 1 month later...

file: themes\THEME_NAME\modules\sendtoafriend\sendtoafriend-extra.tpl

<form id="f_send_friend_form" onsubmit="return false">

//the fields must be here...

</form>

and

$('#f_send_friend_form').find(':input').each(function(index){

the reason to add <form> tag is some browsers cannot recognizes the script

$('#send_friend_form').find(':input').each(function(index){

 

when "send_friend_form" id not <form> tag.. causing datas.length == 0

Edited by omine (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Tried the solution of Nikolas Reissis but nothing is solved for me. I'm using PrestaShop 1.5.6.1.

 

 

 

 

 

<script text="javascript">
{literal}
$('document').ready(function(){


    $('#sendEmail').click(function(){
        var datas = [];
        $('.send_friend_form_content').find('input').each(function(index){
            var o = {};
            o.key = $(this).attr('name');
            o.value = $(this).val();
            if (o.value != '')
                datas.push(o);
        });
        if (datas.length >= 3)
        {
            $.ajax({
                {/literal}url: "{$module_dir}sendtoafriend_ajax.php",{literal}
                post: "POST",
                data: {action: 'sendToMyFriend', secure_key: '{/literal}{$stf_secure_key}{literal}', friend: JSON.stringify(datas)},{/literal}{literal}
                dataType: "json",
                    success: function(result){
                    $('#send_friend_form').modal('hide');
                }
            });
        }
        else
            $('#send_friend_form_error').text("{/literal}{l s='You did not fill required fields' mod='sendtoafriend' js=1}{literal}");
    });
});
{/literal}
</script>
<li class="sendtofriend">
    <a  class="btn-send-friend" href="#send_friend_form"  role="button"  data-toggle="modal" ><i class="icon-envelope"></i>{l s='Send to a friend' mod='sendtoafriend'}</a>
</li>

    <div id="send_friend_form" class="modal hide fade" tabindex="-1" data-width="760">
    <div class="modal-header">
     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h1 id="myModalLabel"><span>{l s='Send to a friend' mod='sendtoafriend'}</span></h1>
            </div>
            
             <div class="modal-body">
              <div class="row-fluid ">
<div class="span6 titled_box">
        
<h2><span>{$stf_product->name}</span></h2>
                <img src="{$link->getImageLink($stf_product->link_rewrite, $stf_product_cover, 'small_default')}"  alt="{$stf_product->name|escape:html:'UTF-8'}" />
                <div class="product_desc">
                    
                    <span class="send-desc">{$stf_product->description_short}</span>
                </div>

            </div>
            <div class="send_friend_form_content span6">
<div id="send_friend_form_error" ></div>
                <div class="form_container titled_box">
                    <h2><span>{l s='Recipient' mod='sendtoafriend'} :</span></h2>
                    <p class="text">
                        <label for="friend_name">{l s='Name of your friend' mod='sendtoafriend'} <sup class="required">*</sup> :</label>
                        <input id="friend_name" name="friend_name" type="text" value=""/>
                    </p>
                    <p class="text">
                        <label for="friend_email">{l s='E-mail address of your friend' mod='sendtoafriend'} <sup class="required">*</sup> :</label>
                        <input id="friend_email" name="friend_email" type="text" value=""/>
                    </p>
                    <p class="txt_required"><sup class="required">*</sup> {l s='Required fields' mod='sendtoafriend'}</p>
                </div>

            </div>
    </div></div>
    
    
 
        <div class="modal-footer">
                    <input id="id_product_comment_send" name="id_product" type="hidden" value="{$stf_product->id}" />
                   <button class="btn btn-inverse" data-dismiss="modal" aria-hidden="true">Close</button>
                    <input id="sendEmail" class="btn btn-inverse" name="sendEmail" type="submit" value="{l s='Send' mod='sendtoafriend'}" />
    </div>
</div>

Edited by confiachat (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

HI.

I had  problem with this module as well. (PS 1.5.6.2)

 

Module on front didn’t work – after filling (correctly) the form instead sending msg, gave me an alert  ”You did not fill required fields” and I could do nothing.

 

I checked and compare 2 file:

  1. shop/themes/my-theme/modules/ sendtoafriend /sendtoafriend-extra.tpl

 and

  1. shop/modules/ sendtoafriend /sendtoafriend-extra.tpl

in first the javascript code was:

<script text="javascript">
{literal}
$('document').ready(function(){


	$('#sendEmail').click(function(){
		var datas = [];
		$('.send_friend_form_content').find('input').each(function(index){
			var o = {};
			o.key = $(this).attr('name');
			o.value = $(this).val();
			if (o.value != '')
				datas.push(o);
		});
		if (datas.length >= 3)
		{
			$.ajax({
				{/literal}url: "{$module_dir}sendtoafriend_ajax.php",{literal}
				post: "POST",
				data: {action: 'sendToMyFriend', secure_key: '{/literal}{$stf_secure_key}{literal}', friend: JSON.stringify(datas)},{/literal}{literal}
				dataType: "json",
					success: function(result){
					$('#send_friend_form').modal('hide');
				}
			});
		}
		else
			$('#send_friend_form_error').text("{/literal}{l s='You did not fill required fields' mod='sendtoafriend' js=1}{literal}");
	});
});
{/literal}
</script>

in second:

<script type="text/javascript">
{literal}
$('document').ready(function(){
	$('#send_friend_button').fancybox({
		'hideOnContentClick': false
	});

	$('#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}");
	});
});
{/literal}
</script>

I just copy-paste the javascript code from 2 into 1 and everything working just fine.

 

Hope it will help someone

Edited by AInet (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 3 months later...

Hi,

 

I face to the same issue. Using Firebug, I can check that my browser transforms the following code

if (name && email && !isNaN(id_product))

into

if (name && email && !isNaN(id_product))

Then I modify the code using Firebug, it works correctly. But this is not the good answer for my customers. :(

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
  • 1 month later...

Hi, I'm using the latest version of presta and this thing does not send any mail. All existing solutions do not make any sense because they are already implemented in the latest version of presta.Though other mails from my shop work perfectly. Could someone try to inspect my website if I share the link?

Edited by Vitazzz (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...