Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Send to friend View modes: 
User avatar
Member
Member
ctaleck IPAGlobal - 5/6/2009 10:24:25 AM
   
Send to friend
Has anyone successfully configured the E-mail template for the Send to friend Web part? Any sample code provided would be helpful.

Specifically, I need to figure out how to show the URL of the page being sent. Curiously, the Web part had {%document%} in there already, but it does not show anything.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 5/11/2009 3:36:23 PM
   
RE:Send to friend
Hi,

You need to specify the transformation in the web part. This transformation is used by resolving the {%document%} macro. For example, in the transformation you can use this (sample from e-commerce site):

<h1 style="margin-top:15px">
<%# HTMLEncode(ResHelper.LocalizeString(Convert.ToString(Eval("SKUName")))) %></h1>
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<h3>Description</h3>
<div class="productDescription">
<%# Eval("SKUDescription") %>
</div></td>
</tr>
<tr>
<td align="left" class="ProductPrice">
<h3> Our price: <%# EcommerceFunctions.GetFormatedPrice(Eval("SKUPrice"), Eval("SKUDepartmentID")) %></h3>
</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:top;">
<a href="<%# Eval("SKUImagePath") %>">
<%# EcommerceFunctions.GetProductImage(Eval("SKUImagePath"), 200, Eval("SKUName"))%>
</a></td>
</tr>
</table>


So, as you can see you can use the transformation for products but you can also use simple transformation e.g. by only using Eval or GetDocumentURL functions.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
ctaleck IPAGlobal - 5/12/2009 3:09:24 PM
   
RE:Send to friend
OK, I am using the transformation from the "Corporate Site" sample with some modifications.

However, it appears the settings of the other Web Part properties are not correct. For example, what should be the "Content Path"? Currently, my e-mail shows ALL the URLs for my entire site. Clearly not what I wanted.

    <webpart controlid="SendToFriend" type="SendToFriend" guid="c12def83-e2e2-4742-a042-aa629bdb90fb">
<property name="path"></property>
<property name="emailsubject">Sent from IPAGlobal.com</property>
<property name="selecttopn"></property>
<property name="filteroutduplicates">False</property>
<property name="wherecondition"></property>
<property name="emailfrom">ctaleck@ipaglobal.com</property>
<property name="container"></property>
<property name="emailtemplate"><p>{%message%}</p>
<p>{%document%}</p></property>
<property name="transformationname">CMS.Root.SendToFriend</property>
<property name="emailto"></property>
<property name="contentafter"></div></property>
<property name="disablemacros">False</property>
<property name="selectonlypublished">True</property>
<property name="headertext">Send to colleague</property>
<property name="combinewithdefaultculture"></property>
<property name="sitename"></property>
<property name="containertitle"></property>
<property name="maxrelativelevel">-1</property>
<property name="useupdatepanel">False</property>
<property name="hideonsubpages">False</property>
<property name="disableviewstate">False</property>
<property name="customtimezone"></property>
<property name="timezonetype">inherit</property>
<property name="classnames">CMS.MenuItem</property>
<property name="showfordocumenttypes"></property>
<property name="orderby"></property>
<property name="culturecode"></property>
<property name="visible">True</property>
<property name="displaytoroles"></property>
<property name="contentbefore"><div id="SendLink" class="PrintLink">
<a onclick="$('SendBody').setStyle('display', 'block');$('SendLink').setStyle('display', 'none');" href="javascript:void(0);">
<img class="PrintImage" src="~/App_Themes/IPAGlobalGreenSite/Images/sendemail.gif" alt="Send to colleague" width="24" />
Send to colleague
</a>
</div>
<div id="SendBody" class="grayBox" style="display:none;"></property>
</webpart>


Also, it appears the e-mails being sent are not going through. I can see the e-mail sent in the queue, however I never receive them. Probably a spam filter, but I thought I'd mention it.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 5/18/2009 5:29:36 AM
   
RE:Send to friend
Hi,

What is your transformation you are using? Could you please post it here?
The Path property should be set to current document "." (dot) if you want to send only current document.

Regarding the e-mail queue, please see this article.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
ctaleck IPAGlobal - 5/18/2009 10:09:57 AM
   
RE:Send to friend
Hmm. A dot. I didn't know about that setting. I was following this logic from the Developers Guide:
Leaving the Path value empty
In many cases, you can lease the Path value empty. In this case, the Path value is set to the alias path of the currently displayed document.

In case of list controls/webparts, such as CMSRepater/Document repeater or CMSDataGrid/Document datalist, the path is set to <current alias path>/% if the current document is not of the same type as the required document in the ClassNames (document types) property. Otherwise, the path is set to the current alias path which leads to automatic selection of the current document.
I ended up using {%currentdocument.nodealiaspath%} which also worked. I guess the Send to friend is like a repeater and so is using the <current alias path>/% setting instead of the current document.

Here is my transformation:
<div>
This e-mail was sent to you from Independent Project Analysis, Inc.<br />
<a href="http://www.IPAGlobal.com">http://www.IPAGlobal.com</a><br /><br />
</div>
<div>
You may find this page interesting: <a href="<%# GetDocumentUrl() %>" ><%# Eval("DocumentName") %></a><br />
<%# GetAbsoluteUrl(GetDocumentUrl()) %><br /><br />
</div>
<div>The following is the senders message:<br /></div>
I had to add the GetAbsoluteUrl command to get a full URL spelled out. The HREF seems to work fine without it (you must have a BASE tag in the output somewhere).

User avatar
Member
Member
rdiepenbrock - 7/10/2009 2:37:40 PM
   
RE:Send to friend
Is there a way to set up a link that will pass the id (page, document, node) to the SendtoFriend form, if the form is on a separate page or in a pop up window?

As it is now, the form works, but it must be on the page that is being sent out. I would like to separate the page from the email form (in much the same way the PrintLink is structured).

Thanks,
Richard

User avatar
Member
Member
kentico_pavelk - 7/20/2009 8:24:37 AM
   
RE:Send to friend
Hi Richard,

I have already answered this question via e-mail. I post here the answer so other users know about it.

Unfortunately, this is not built-in feature. I have forwarded this to our Product manager and he will consider it. Now you may need to develop such web part by yourself. Current Send to friend control works in different way.


Best Regards,
Pavel Knotek

User avatar
Member
Member
Elijah - 7/21/2009 7:41:34 AM
   
RE:Send to friend
I wanted this same functionality (send a link to a document instead of the document itself) a year or so ago, so I created a web part to do the job.

I have currently only sold it to private clients, but I'll probably be posting it to the marketplace soon, as I see it's a requested feature.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/21/2009 8:33:29 AM
   
RE:Send to friend
Hi Elijah,

in my opinion other users will appreciate your addition to Market place. You are welcome:-)

Best regards,
Helena Grulichova