fsalvaggio Posted January 10, 2014 Share Posted January 10, 2014 Hi everybody, I have the 1.5.5 Prestashop version, with a custom template. Now, after the upgrade, I have a strange problem with "send to a friend" module. When I fill the module (Friend's name and e-mail) and send the form, this answer that I must complete all required fields... so... what?? Anybody can help? If you need some more informations, I'll try give you. Link to comment Share on other sites More sharing options...
Sharak Posted January 10, 2014 Share Posted January 10, 2014 Url of your shop would be a good start Link to comment Share on other sites More sharing options...
fsalvaggio Posted January 10, 2014 Author Share Posted January 10, 2014 setik.biz Link to comment Share on other sites More sharing options...
Sharak Posted January 10, 2014 Share Posted January 10, 2014 (edited) "This page is generated by Parallels Plesk Panel, the leading hosting automation software. You see this page because there is no Web site at this address." Edited January 10, 2014 by Sharak (see edit history) Link to comment Share on other sites More sharing options...
fsalvaggio Posted January 10, 2014 Author Share Posted January 10, 2014 try with the www For me (and customers) is working perfectly Link to comment Share on other sites More sharing options...
Sharak Posted January 10, 2014 Share Posted January 10, 2014 (edited) Check module's sendtofriend-extra.tpl. Not sure about 1.5.5 but on 1.5.6.1 it looks slightly different: <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> You have different id and name. Use the same for both. Also should be the same as that used in <script> section at the beginning of this file. Other problem is that this module doesn't work without some changes in .php, but this may be hosting related so we'll come to that if needed. Edited January 10, 2014 by Sharak (see edit history) Link to comment Share on other sites More sharing options...
fsalvaggio Posted January 10, 2014 Author Share Posted January 10, 2014 Still the same :\ But I noted that there's not the <form... > tag. Is this normal? Link to comment Share on other sites More sharing options...
Sharak Posted January 10, 2014 Share Posted January 10, 2014 (edited) I don't see you've changed anything. The file is /themes/your_theme/modules/sendtoafriend/sendtoafriend-extra.tpl If it's not present in this location then copy it from /modules/sendtoafriend/ directory Edited January 10, 2014 by Sharak (see edit history) Link to comment Share on other sites More sharing options...
fsalvaggio Posted January 10, 2014 Author Share Posted January 10, 2014 Here is the code, averything seems ok... But this not working... <script text="javascript"> {literal} $('document').ready(function(){ $('#send_friend_button').fancybox({ autoScale : true, 'hideOnContentClick': false }); $('#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 >= 1) { $.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}', friend: unescape(JSON.stringify(datas).replace(/u/g, '%u'))},{/literal}{literal} dataType: "json", success: function(result){ $.fancybox.close(); } }); } 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 id="send_friend_button" href="#send_friend_form"><i class="icon-envelope"></i>{l s='Send to a friend' mod='sendtoafriend'}</a> </li> <div style="display: none;"> <div id="send_friend_form"> <h1 class="title clearfix">{l s='Send to a friend' mod='sendtoafriend'}</h1> <div class="row-fluid"> <div class="span6 titled_box"> <h2 class="product_name"><span>{$stf_product->name}</span></h2> <div class="product clearfix"> <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"> {$stf_product->description_short} </div> </div> </div> <div class="span6"> <div class="send_friend_form_content"> <div id="send_friend_form_error"></div> <div class="form_container titled_box"> <h2 class="intro_form "><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> <p class="submit sendfrend_footer"> <input id="id_product_comment_send" name="id_product" type="hidden" value="{$stf_product->id}" /> <button class="btn btn-inverse" onclick="$.fancybox.close();">{l s='Cancel' mod='sendtoafriend'}</button> <button id="sendEmail" class="btn btn-inverse" name="sendEmail" type="submit" />{l s='Send' mod='sendtoafriend'}</button> <!--<input id="sendEmail" class="btn btn-inverse" name="sendEmail" type="submit" value="{l s='Send' mod='sendtoafriend'}" />--> </p> </div> </div> Link to comment Share on other sites More sharing options...
Sharak Posted January 10, 2014 Share Posted January 10, 2014 (edited) And that's default for presta.1.5.5: <script text="javascript"> {literal} $('document').ready(function(){ $('#send_friend_button').fancybox({ 'hideOnContentClick': false }); $('#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} type: "POST", headers: {"cache-control": "no-cache"}, data: {action: 'sendToMyFriend', secure_key: '{/literal}{$stf_secure_key}{literal}', friend: unescape(JSON.stringify(datas).replace(/\\u/g, '%u'))},{/literal}{literal} dataType: "json", success: function(result){ $.fancybox.close(); } }); } 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 id="send_friend_button" href="#send_friend_form">{l s='Send to a friend' mod='sendtoafriend'}</a> </li> <div style="display: none;"> <div id="send_friend_form"> <h2 class="title">{l s='Send to a friend' mod='sendtoafriend'}</h2> <div class="product clearfix"> <img src="{$link->getImageLink($stf_product->link_rewrite, $stf_product_cover, 'home_default')|escape:'html'}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$stf_product->name|escape:html:'UTF-8'}" /> <div class="product_desc"> <p class="product_name"><strong>{$stf_product->name}</strong></p> {$stf_product->description_short} </div> </div> <div class="send_friend_form_content" id="send_friend_form_content"> <div id="send_friend_form_error"></div> <div class="form_container"> <p class="intro_form">{l s='Recipient' mod='sendtoafriend'} :</p> <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> <p class="submit"> <input id="id_product_comment_send" name="id_product" type="hidden" value="{$stf_product->id}" /> <a href="#" onclick="$.fancybox.close();">{l s='Cancel' mod='sendtoafriend'}</a> {l s='or' mod='sendtoafriend'} <input id="sendEmail" class="button" name="sendEmail" type="submit" value="{l s='Send' mod='sendtoafriend'}" /> </p> </div> </div> </div> Try it, then correct stiling if it works Edited January 10, 2014 by Sharak (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 10, 2014 Share Posted January 10, 2014 $('#fancybox-content').find('input').each(function(index){ change it to: $('#send_friend_form').find('input').each(function(index){ Link to comment Share on other sites More sharing options...
fsalvaggio Posted January 10, 2014 Author Share Posted January 10, 2014 Thank you very much, Sharak and Vekia. Now is working. (I'll kill my colleague for this mistake ) Link to comment Share on other sites More sharing options...
vekia Posted January 10, 2014 Share Posted January 10, 2014 you're welcome, glad to hear that Sharak and I could help you a little in this case i marked whole topic as [solved] btw. welcome on board Link to comment Share on other sites More sharing options...
Recommended Posts