Jump to content

[solved] "Send to a friend" Module not working. How to debug?


Recommended Posts

hello

 

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:


<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">
{$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>

(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

wat error u r getting? its a module send to a friend..

 

Hi Jiten rash,

 

There is no error message.

 

The pop-up screen will ask for friend's name and email. After entering the information and pressing the send button, it will close by itself.

 

Everything seems to work EXCEPT my friend or the email address did not receive anything at all.

Link to comment
Share on other sites

hello 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:

	
[url="{$productLink}"][img={$link->getImageLink($product->link_rewrite, $cover.id_image, ][/url] [url="{$productLink}"] {$product->name}[/url]	

{l s='Friend\'s name' mod='sendtoafriend'} 	
{l s='Friend\'s email' mod='sendtoafriend'} 		

(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

 

Thanks vekia for the big lump of information which I am totally unfamiliar with! Haha..

 

It is strange why it is not working as intended as I did not meddle with the module at all. Just a direct installation only.

 

Ok I will PM you the URL for troubleshooting as the website is currently not ready for the public eye.

 

Thanks.

Link to comment
Share on other sites

Many thanks to vekia for correcting the bug in "Send to a friend" module! He has been a very helpful and reliable contributor to this forum!

 

I suggest the developer of the module, ie. Prestashop, should do more backtesting of its modules before releasing these to the public. In this case, the module is obviously not ready but still uploaded for use.

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...