Email Template for Product Promotions

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
Pat_king
Ensign (ENS)
Ensign (ENS)
Posts: 14
Joined: Thu Jan 03, 2008 9:40 pm

Email Template for Product Promotions

Post by Pat_king » Thu Jun 25, 2009 10:30 pm

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Email Template for Product Promotions

Post by mazhar » Fri Jun 26, 2009 4:42 am

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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Email Template for Product Promotions

Post by mazhar » Fri Jun 26, 2009 7:57 am

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.

Pat_king
Ensign (ENS)
Ensign (ENS)
Posts: 14
Joined: Thu Jan 03, 2008 9:40 pm

Re: Email Template for Product Promotions

Post by Pat_king » Sun Jun 28, 2009 10:43 pm

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

Pat_king
Ensign (ENS)
Ensign (ENS)
Posts: 14
Joined: Thu Jan 03, 2008 9:40 pm

Re: Email Template for Product Promotions

Post by Pat_king » Mon Jun 29, 2009 12:05 am

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Email Template for Product Promotions

Post by mazhar » Mon Jun 29, 2009 4:42 am

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.

Pat_king
Ensign (ENS)
Ensign (ENS)
Posts: 14
Joined: Thu Jan 03, 2008 9:40 pm

Re: Email Template for Product Promotions

Post by Pat_king » Tue Jun 30, 2009 4:29 am

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Email Template for Product Promotions

Post by mazhar » Tue Jun 30, 2009 4:41 am

May be you have disabled image display in your Email account.

Pat_king
Ensign (ENS)
Ensign (ENS)
Posts: 14
Joined: Thu Jan 03, 2008 9:40 pm

Re: Email Template for Product Promotions

Post by Pat_king » Tue Jun 30, 2009 5:00 am

No i enabled image display, loop to render products is not working mazhar.........
Last edited by Pat_king on Tue Jun 30, 2009 5:15 am, edited 1 time in total.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Email Template for Product Promotions

Post by mazhar » Tue Jun 30, 2009 5:14 am

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.

Pat_king
Ensign (ENS)
Ensign (ENS)
Posts: 14
Joined: Thu Jan 03, 2008 9:40 pm

Re: Email Template for Product Promotions

Post by Pat_king » Tue Jun 30, 2009 10:12 pm

Hi mazhar, problem with parameter name.i got that right, now its working, thanks once again for your help...cheers


Best Regards,
Pat

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Email Template for Product Promotions

Post by mazhar » Wed Jul 01, 2009 6:11 am

Sounds good

Post Reply