X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Adding a message text area to tell-a-friend... (https://forum.x-cart.com/showthread.php?t=11274)

Jerrad 01-04-2005 11:25 AM

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!!

shan 01-04-2005 03:49 PM

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);
}

?>


Jerrad 01-04-2005 04:27 PM

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! :D

shan 01-04-2005 04:31 PM

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

Jerrad 01-04-2005 04:43 PM

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! :D

shan 01-04-2005 04:56 PM

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

i edited the post above

Jerrad 01-04-2005 05:20 PM

Wonderful - that did the trick!! :D :D :D

Many, many thanks for that, Shan!

ghhoz 01-05-2005 12:32 AM

Wow thanks for this - I have added this to our cart.

jdedba 01-08-2005 12:24 PM

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

markwhoo 01-08-2005 12:35 PM

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.


All times are GMT -8. The time now is 03:37 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.