Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

send_to_friend.tpl pop up

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 07-17-2008, 12:37 PM
 
luxor luxor is offline
 

Senior Member
  
Join Date: Apr 2007
Posts: 120
 

Default Re: send_to_friend.tpl pop up

I have a simple solution I use.

add this to the end of send_to_friend.php before the final }

func_header_location("thankyoupage.php");

this will load thankyoupage.php after a succesful submit. you can stylize this page all you like.
__________________
v4.1.8 GOLD
Reply With Quote
  #12  
Old 07-17-2008, 01:04 PM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default Re: send_to_friend.tpl pop up

Thank you, Luxor!
__________________
~ Andrea Beight
Reply With Quote
  #13  
Old 07-17-2008, 01:29 PM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default Re: send_to_friend.tpl pop up

Here are the steps that I followed to get this working in 4.1.9 based on other posts in this thread. I just thought someone else might find it helpful to have everything in one place. Let me know if I missed anything.

1. Place pop-up link somewhere in skin1/customer/main/product.tpl

Code:
<A HREF="javascript:popUp('product.php?productid={$product.productid}&mode=showsend')">Email A Friend</A>

2. Place this pop-up script in <head> section of skin1/customer/home.tpl (just a free script I found online - credits are in place):

Code:
{literal} <SCRIPT LANGUAGE="JavaScript"> <!-- Idea by: Nic Wolfe --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=450,height=200,left = 287,top = 284');"); } // End --> </script> {/literal}

3. In send_to_friend.php:

Add:

Code:
if($mode=='showsend'){ $main="showstf"; $smarty->assign("main",$main); }

Replace (only if you want a custom thank you page):

Code:
func_header_location("product.php?productid=".$productid); with: func_header_location("thankyou.php");

4. In product.php:

Replace:
Code:
func_display("customer/home.tpl",$smarty);

with:
Code:
if ($main == 'showstf') func_display("customer/main/send_to_friend.tpl",$smarty); else func_display("customer/home.tpl",$smarty);


5. Alter your skin1/customer/main/send_to_friend.tpl file to have the look and feel that you want. Mine looks like this:

Code:
{* $Id: send_to_friend.tpl,v 1.11.2.5 2007/04/05 10:17:48 twice Exp $ *} <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> {config_load file="$skin_config"} <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Email A Friend</title> {include file="meta.tpl" } <link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}" /> </head> <body{$reading_direction_tag}{if $body_onload ne ''} onload="javascript: {$body_onload}"{/if}> <div style="width: 450px; height: 200px; background-color: #FFF;"> <script type="text/javascript" language="JavaScript 1.2"> <!-- var requiredFields = new Array(); requiredFields[0] = new Array('send_name', "{$lng.lbl_send_your_name|strip_tags|replace:'"':'\"'}", false); requiredFields[1] = new Array('send_from', "{$lng.lbl_send_your_email|strip_tags|replace:'"':'\"'}", false); requiredFields[2] = new Array('send_to', "{$lng.lbl_recipient_email|strip_tags|replace:'"':'\"'}", false); --> </script> {include file="check_required_fields_js.tpl"} {include file="check_email_script.tpl"} {capture name=dialog} <form action="product.php" method="post" name="send"> <input type="hidden" name="mode" value="send" /> <input type="hidden" name="productid" value="{$product.productid}" /> <table> <tr> <td class="FormButton">{$lng.lbl_send_your_name}:</td> <td><font class="Star">*</font></td> <td><input id="send_name" type="text" size="45" name="name" value="{$send_to_friend_info.name|escape}"/>{if $send_to_friend_info.fill_err and $send_to_friend_info.name eq ''}<front class="Star">&lt;&lt;</font>{/if}</td> </tr> <tr> <td class="FormButton">{$lng.lbl_send_your_email}:</td> <td><font class="Star">*</font></td> <td><input id="send_from" type="text" size="45" name="from" value="{$send_to_friend_info.from|escape}" onchange="javascript: checkEmailAddress(this);" />{if ($send_to_friend_info.fill_err and $send_to_friend_info.from eq '') or $send_to_friend_info.from_failed eq "Y"}<front class="Star">&lt;&lt;</font>{/if}</td> </tr> <tr> <td class="FormButton">{$lng.lbl_recipient_email}:</td> <td><font class="Star">*</font></td> <td><input id="send_to" type="text" size="45" name="email" onchange="javascript: checkEmailAddress(this);" value="{$send_to_friend_info.email|escape}"/>{if ($send_to_friend_info.fill_err and $send_to_friend_info.email eq '') or $send_to_friend_info.email_failed eq "Y"}<front class="Star">&lt;&lt;</font>{/if}</td> </tr> {if $active_modules.Image_Verification and $show_antibot.on_send_to_friend eq 'Y'} {include file="modules/Image_Verification/spambot_arrest.tpl" mode="simple" id=$antibot_sections.on_send_to_friend antibot_err=$antibot_friend_err} {/if} <tr> <td colspan="3"><br />{include file="buttons/button.tpl" style="button" button_title=$lng.lbl_send_to_friend href="javascript: if(checkRequired(requiredFields)) document.send.submit();"}</td> </tr> </table> </form> {/capture} {include file="dialog.tpl" title=$lng.lbl_send_to_friend content=$smarty.capture.dialog extra='width="100%"'} </div> </body> </html>

6. If you want a custom thank you page, create a new file called thankyou.php and upload it to the root x-cart directory.
__________________
~ Andrea Beight
Reply With Quote

The following user thanks abeight for this useful post:
fearnothing (01-17-2010)
  #14  
Old 07-17-2008, 02:18 PM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default Re: send_to_friend.tpl pop up

Here's a quick question if anyone knows - I'm now attempting to turn the pop up link into a button, but it isn't working because I have brackets within brackets:

Code:
{include file="buttons/email_a_friend.tpl" style="button" href="javascript:popUp('product.php?productid={$product.productid}&mode=showsend')"}

Is there a way around this?
__________________
~ Andrea Beight
Reply With Quote
  #15  
Old 07-17-2008, 02:24 PM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: send_to_friend.tpl pop up

maybe try...
Code:
{include file="buttons/email_a_friend.tpl" style="button" href="javascript:popUp('product.php?productid=`$product.productid`&mode=showsend')"}
__________________
xcartmods.co.uk
Reply With Quote
  #16  
Old 07-17-2008, 02:30 PM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default Re: send_to_friend.tpl pop up

Thank you, Phil! That works!! Woo hoo!
__________________
~ Andrea Beight
Reply With Quote
  #17  
Old 07-28-2008, 09:51 PM
 
soleag soleag is offline
 

Member
  
Join Date: Mar 2004
Posts: 16
 

Default Re: send_to_friend.tpl pop up

I'm having trouble with this code in 4.1.10. My popup window just displays the product page, no "Send To Friend " template. Should it work in 4.1.10?
__________________
X-Cart 4.0.9: Development Mode
Reply With Quote
  #18  
Old 08-07-2008, 10:24 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: send_to_friend.tpl pop up

Thanks for the mod.

There are a couple of changes I had to make to Andrea's summary in post #13 to get it to work for me.

1 - The code for product.php needs to add the ".tpl" after:
func_display("customer/main/send_to_friend.tpl",$smarty);

(Soleag - this could explain it not working for you if you used this code)

2. In the modified code for skin1/customer/main/send_to_friend.tpl, the send button did not work for me, I believe, because some javascript is missing. I added this before the </head>:
Code:
<script src="/skin1/common.js" language="JavaScript" type="text/javascript"></script>

This could be because I am using a shadowbox and not the popup javascript. Maybe the popup still finds the common.js with a popup. I'm not sure.
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #19  
Old 01-06-2009, 05:34 AM
 
TanyaG TanyaG is offline
 

Advanced Member
  
Join Date: Nov 2007
Posts: 94
 

Default Re: send_to_friend.tpl pop up

Hi, not sure what I’m doing wrong but for some reason my popup window displays template of product page instead of sent_to_friend. Could anybody help me with it. Many thanks
__________________
Tanya

x-cart version: 4.1.7 4.1.9. 4.2
Reply With Quote
  #20  
Old 01-06-2009, 05:39 AM
  Vetrivel's Avatar 
Vetrivel Vetrivel is offline
 

eXpert
  
Join Date: Apr 2008
Posts: 398
 

Default Re: send_to_friend.tpl pop up

Check the 4th step in post 13 of this thread.
Quote:
Originally Posted by TanyaG
Hi, not sure what I▓m doing wrong but for some reason my popup window displays template of product page instead of sent_to_friend. Could anybody help me with it. Many thanks
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:28 AM.

   

 
X-Cart forums © 2001-2020