Page 1 of 1
Email Template for Product Promotions
Posted: Thu Jun 25, 2009 10:30 pm
by Pat_king
How to create email template for promotional Products .Is that possible to create custom email templates using Nvelocity for product listing...........
Check the attachment image for example....................
Regards,
Pat
Re: Email Template for Product Promotions
Posted: Fri Jun 26, 2009 4:42 am
by mazhar
Yes its possible. Please have a look at following thread
viewtopic.php?f=42&t=8571
It will explain how you can set NVelocity parameters for Email templates and how to send Emails manually. All you need is to create an Email template, adjust template layout and product dispaly using your custom NVelocity parameter for example for all those promoted products you can send some $promotedproducts parameter having all those products.
Re: Email Template for Product Promotions
Posted: Fri Jun 26, 2009 7:57 am
by mazhar
Here is the template file which could be used for this sort Email list operations. Unzip it and place it under Website/App_Data/EmailTempaltes/1/ folder. Then go to Administration > Configure > Email > Templates and create a new Email Template and assign it newly placed file for message body.
This Email template is general purpose I just put the logic how to render the products. Currently it will render complete store products, because I don't know how you are handling your promotions. You can update template code to output only those products that meet your promotion criteria.
Re: Email Template for Product Promotions
Posted: Sun Jun 28, 2009 10:43 pm
by Pat_king
Thanks Mazhar this is really helpful for me to develop further..... this is what i m looking for .....
Now i m working in Nvelocity to list promotional products ........
Thanks once again
Best Regards,
Pat
Re: Email Template for Product Promotions
Posted: Mon Jun 29, 2009 12:05 am
by Pat_king
Hi mazhar , i m sending a Nvelocity parameter to render products with special offers and generating list ,it works fine. But if i m sending it from the email list option(in admin side) will it work.
Regards,
Pat
Re: Email Template for Product Promotions
Posted: Mon Jun 29, 2009 4:42 am
by mazhar
Pat_king wrote:Hi mazhar , i m sending a Nvelocity parameter to render products with special offers and generating list ,it works fine. But if i m sending it from the email list option(in admin side) will it work.
Regards,
Pat
For this you need to make a change to marketing pages in admin side. In fact you need to put your custom NVelocity variable in Email template. For this edit
Code: Select all
Admin/Marketing/Email/Preview.aspx.cs
and then locate following method in it
Code: Select all
protected void PreviewButton_Click(object sender, System.EventArgs e)
{
//GENERATE MESSAGE
EmailTemplate listTemplate = GetTemplate();
listTemplate.Parameters["store"] = Token.Instance.Store;
if (_EmailList.Users.Count > 0)
{
listTemplate.Parameters["customer"] = UserDataSource.LoadMostRecentForEmail(_EmailList.Users[0].Email);
}
listTemplate.Parameters["list"] = _EmailList;
//Here will be your code to find out products you want to send in promotion Email and finally add them as NVelocity parameter
listTemplate.Parameters["promotionproducts"] = Token.Instance.Store.Products;
listTemplate.ToAddress = _EmailList.Users[0].Email;
System.Net.Mail.MailMessage[] messages;
try
{
messages = listTemplate.GenerateMailMessages();
}
catch(Exception ex)
{
EmailTemplateErrorLabel.Text = String.Format(EmailTemplateErrorLabel.Text,listTemplate.Name, ex.Message);
EmailTemplateErrorLabel.Visible = true;
return;
}
System.Net.Mail.MailMessage message = messages[0];
PreviewFromAddress.Text = message.From.ToString();
//PreviewToAddress.Text = ToAddress.Text + " (" + message.To + ")";
PreviewToAddress.Text = ToAddress.Text;
PreviewSubject.Text = message.Subject;
PreviewMessage.Text = message.Body;
if (message.IsBodyHtml)
{
PreviewMessage.Text = message.Body;
}
else
{
PreviewMessage.Text = "<PRE>" + Server.HtmlEncode(message.Body) + "</PRE>";
}
//SWAP THE PANELS
CustomizePanel.Visible = false;
PreviewPanel.Visible = true;
}
See the
Code: Select all
//Here will be your code to find out products you want to send in promotion Email and finally add them as NVelocity parameter
listTemplate.Parameters["promotionproducts"] = Token.Instance.Store.Products;
Here you will find out your products and then put them in Email template parameters and finally update your Email template to use this new NVelocity parameter.
Re: Email Template for Product Promotions
Posted: Tue Jun 30, 2009 4:29 am
by Pat_king
Hi mazhar, I assigned the parameter in the preview file, on clicking the preview button it shows the promotional products .But it is not getting displayed in the email. I m unable to figure out the problem.
Regards ,
Pat
Re: Email Template for Product Promotions
Posted: Tue Jun 30, 2009 4:41 am
by mazhar
May be you have disabled image display in your Email account.
Re: Email Template for Product Promotions
Posted: Tue Jun 30, 2009 5:00 am
by Pat_king
No i enabled image display, loop to render products is not working mazhar.........
Re: Email Template for Product Promotions
Posted: Tue Jun 30, 2009 5:14 am
by mazhar
Make sure that your NVelocity code is good and is working. Also could you provide your custom code where you are passing Nvelocity parameter to Email template. May be its not working when it comes to Email list.
Re: Email Template for Product Promotions
Posted: Tue Jun 30, 2009 10:12 pm
by Pat_king
Hi mazhar, problem with parameter name.i got that right, now its working, thanks once again for your help...cheers
Best Regards,
Pat
Re: Email Template for Product Promotions
Posted: Wed Jul 01, 2009 6:11 am
by mazhar
Sounds good