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

Adding a message text area to tell-a-friend...

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 01-04-2005, 11:25 AM
 
Jerrad Jerrad is offline
 

X-Adept
  
Join Date: Nov 2004
Location: The Netherlands
Posts: 484
 

Default Adding a message text area to tell-a-friend...

I'm trying to add a text area into tell-a-friend, where the customer can
write a message for the person which receives the email.
Without any luck, by the way...

I'm looking for something simular like this:
http://www.cartmods.com/product.php?productid=94

I copied the messagebox from the contact-us form into the tell-a-friend form. I did the same for the email template.
The tell-a-friend form looks fine and seems to work also. But in the email that has been send out, the message part is missing...

Here are the 2 template's i "modified".
customer/main/send_to_friend.tpl
Code:
{* $Id: send_to_friend.tpl,v 1.6 2004/06/24 06:04:34 max Exp $ *} <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}', false); requiredFields[1] = new Array('send_from', '{$lng.lbl_send_your_email|strip_tags}', false); requiredFields[2] = new Array('send_to', '{$lng.lbl_sent_recipient_email|strip_tags|replace:"'":"\'"}', false); </SCRIPT> {include file="check_required_fields_js.tpl"} {include file="check_email_script.tpl"} {capture name=dialog} <font face="Verdana" color="#5D5D5D" style="font-size: 8pt">Wilt u iemand anders attent maken op bovenstaand artikel? Vul onderstaand formulier in en deze persoon krijgt via een mailtje dit artikel te zien. Leuk om een ander op de hoogte te brengen van de (aanbiedingen en nieuwe) artikelen van Leukstewinkel.nl! U heeft ook nog de mogelijkheid om een persoonlijke boodschap te vermelden. </font> </p> <TABLE border="0"> <FORM action="product.php?mode=send" method="post" name="send"> <INPUT type="hidden" name="productid" value="{$product.productid}"> <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"></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" onchange="javascript: checkEmailAddress(this);"></TD> </TR> <TR> <TD class="FormButton">{$lng.lbl_sent_recipient_email}:</TD> <TD><FONT class="Star">*</FONT></TD> <TD><INPUT id="send_to" type="text" size="45" name="email" onchange="javascript: checkEmailAddress(this);"></TD> </TR> <TR valign="middle"> <TD class="FormButton" valign="top">{$lng.lbl_message}:</TD> <TD></TD> <TD nowrap> <TEXTAREA cols="44" rows="8" name="body">{$contact.body}</TEXTAREA> </TD> </TR> <TR> <TD colspan="3"> {include file="buttons/button.tpl" style="button" button_title=$lng.lbl_send_to_friend href="javascript: if(checkRequired('')) document.send.submit();"}</TD> </TR> </FORM> </TABLE> {/capture} {include file="dialog_new.tpl" title=$lng.lbl_send_to_friend content=$smarty.capture.dialog extra="width=100%"}

mail/html/send2friend.tpl
Code:
{* $Id: send2friend.tpl,v 1.2.2.1 2004/10/21 07:51:07 max Exp $ *} {config_load file="$skin_config"} {include file="mail/html/mail_header.tpl"} {$lng.lbl_hello} {$name} {$lng.eml_has_recommended}: {$lng.lbl_message}:{$contact.body} {$product.product} <HR> {$product.descr} {$lng.lbl_price}: {include file="currency.tpl" value=$product.taxed_price} {$lng.eml_please_click_link}: {$catalogs.customer}/product.php?productid={$product.productid} {include file="mail/html/signature.tpl"}

I'm sure i'm doing something stupid, therefore i hope somebody
can point me in the right direction. And if possible; also show me how
to add a friend's name field into tell-a-friend.

Many, many thanks in advance!!
__________________
X-Cart 4.0.12
Heavy modified with paid, free and forum mods.
PHP 5.2.5 | MYSQL 5.0.51a
Reply With Quote
  #2  
Old 01-04-2005, 03:49 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

heres the one that I did in 4.0.9


skin1/customer/main/send_to_friend.tpl

Code:
{* $Id: send_to_friend.tpl,v 1.6.2.2 2004/12/10 13:14:52 max Exp $ *} {* SHAN - MSG FIELD ADDED *} <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_sent_recipient_email|strip_tags|replace:'"':'\"'}", false); </SCRIPT> {include file="check_required_fields_js.tpl"} {include file="check_email_script.tpl"} {capture name=dialog} <TABLE border="0"> <FORM action="product.php" method="post" name="send"> <INPUT type="hidden" name="mode" value="send"> <INPUT type="hidden" name="productid" value="{$product.productid}"> <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"></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" onchange="javascript: checkEmailAddress(this);"></TD> </TR> <TR> <TD class="FormButton">{$lng.lbl_sent_recipient_email}:</TD> <TD><FONT class="Star">*</FONT></TD> <TD><INPUT id="send_to" type="text" size="45" name="email" onchange="javascript: checkEmailAddress(this);"></TD> </TR> <TR> <TD class="FormButton" valign="top">Add A Message:</TD> <TD><FONT class="Star"></FONT></TD> <TD><textarea name="msg" id="msg" cols="40" rows="4"></textarea></TD> </TR> <TR> <TD colspan="3"> {include file="buttons/button.tpl" style="button" button_title=$lng.lbl_send_to_friend href="javascript: if(checkRequired('')) document.send.submit();"}</TD> </TR> </FORM> </TABLE> {/capture} {include file="dialog.tpl" title=$lng.lbl_send_to_friend content=$smarty.capture.dialog extra="width=100%"}


skin1/mail/html/sendtofriend.tpl

Code:
{* $Id: send2friend.tpl,v 1.2.2.1 2004/10/21 07:51:07 max Exp $ *} {config_load file="$skin_config"} {include file="mail/html/mail_header.tpl"} {* SHAN - MSG FIELD ADDED *} {$name} {$lng.eml_has_recommended}: {$product.product} - {$lng.lbl_price}: {include file="currency.tpl" value=$product.taxed_price} {$product.descr} {$lng.eml_please_click_link} {if $msg} {$name} also added a message for you ...... {$msg} {/if}="{$catalogs.customer}/product.php?productid={$product.productid}">{$catalogs.customer}/product.php?productid={$product.productid}</A> {include file="mail/html/signature.tpl"}

send_to_friend.php

Code:
# # $Id: send_to_friend.php,v 1.1.2.1 2004/10/14 06:15:50 max Exp $ # if ( !defined('XCART_START') ) { header("Location: home.php"); die("Access denied"); } if(!$productid) func_header_location ("error_message.php?access_denied&id=48"); if($mode == 'send') { if($email && $from && $name) { $mail_smarty->assign ("product", $product_info); $mail_smarty->assign ("name", $name); $mail_smarty->assign ("msg", $msg); func_send_mail ($email, "mail/send2friend_subj.tpl", "mail/send2friend.tpl", $from, false); $top_message["content"] = func_get_langvar_by_name("txt_recommendation_sent"); } else { $top_message["content"] = func_get_langvar_by_name("err_filling_form"); $top_message["type"] = "E"; } func_header_location("product.php?productid=".$productid); } ?>
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #3  
Old 01-04-2005, 04:27 PM
 
Jerrad Jerrad is offline
 

X-Adept
  
Join Date: Nov 2004
Location: The Netherlands
Posts: 484
 

Default

Thanks for the reply, Shan!!
But unfortunaly it doesn't work for me...

I copied your two tpl's exactly but strange enough a message
won't show up in the email.

Any idea why it doesn't work with me?
And thanks again for trying to help!
__________________
X-Cart 4.0.12
Heavy modified with paid, free and forum mods.
PHP 5.2.5 | MYSQL 5.0.51a
Reply With Quote
  #4  
Old 01-04-2005, 04:31 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

as this info is stored in an array you can add extra fields to the form and then just use the field name to display it.

i created my mod as a pop up window for the site I worked on but what i posted should be about right.

ill have a look see
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #5  
Old 01-04-2005, 04:43 PM
 
Jerrad Jerrad is offline
 

X-Adept
  
Join Date: Nov 2004
Location: The Netherlands
Posts: 484
 

Default

Thanks for the quick reply, Shan!
If I understand it right I can use every name for a field? And when I put that name in the email tpl it will show up in the tell-a-friend email?

I'm looking forward for any advise/solutions from you.
Thanks again!
__________________
X-Cart 4.0.12
Heavy modified with paid, free and forum mods.
PHP 5.2.5 | MYSQL 5.0.51a
Reply With Quote
  #6  
Old 01-04-2005, 04:56 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

sorry forgot to add my send_to_friend.php file where the extra msg field gets assigned to smarty

i edited the post above
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #7  
Old 01-04-2005, 05:20 PM
 
Jerrad Jerrad is offline
 

X-Adept
  
Join Date: Nov 2004
Location: The Netherlands
Posts: 484
 

Default

Wonderful - that did the trick!!

Many, many thanks for that, Shan!
__________________
X-Cart 4.0.12
Heavy modified with paid, free and forum mods.
PHP 5.2.5 | MYSQL 5.0.51a
Reply With Quote
  #8  
Old 01-05-2005, 12:32 AM
 
ghhoz ghhoz is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 40
 

Default

Wow thanks for this - I have added this to our cart.
__________________
Cheers from Melanie
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xcart V4.0.4 (Unix) - LIVE
AOM, Fancy Categories
Marketing Manager,
Reward Points & Refer Rewards
Advanced Site Map
Easy Checkout

Gift & Homeware House
www.giftandhomewarehouse.com.au
Reply With Quote
  #9  
Old 01-08-2005, 12:24 PM
 
jdedba jdedba is offline
 

Advanced Member
  
Join Date: Dec 2004
Posts: 96
 

Default Where the send_to_friend.php should be?

Shan,

Where should I put the send_to_friend.php file?

Thanks a lot.

~~~~~~~~~
Version 4.0.9
__________________
version 4.1.1
Reply With Quote
  #10  
Old 01-08-2005, 12:35 PM
 
markwhoo markwhoo is offline
 

X-Adept
  
Join Date: Nov 2003
Posts: 799
 

Default Re: Where the send_to_friend.php should be?

Quote:
Originally Posted by jdedba
Shan,

Where should I put the send_to_friend.php file?

Thanks a lot.

~~~~~~~~~
Version 4.0.9

This should overwrite the current send_to_friend.php file that already exists in the xcart root filr area.
__________________
vs 4.1.12
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 05:11 AM.

   

 
X-Cart forums © 2001-2020