Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1
    Join Date
    Jun 2007
    Posts
    24
    Plugin Contributions
    0

    Default adding new templates to newsletter module

    Hi,

    Sorry if this is a simple question. Is there a way of adding more templates to the newsletter module? I only get "product_notification" and "newsletter". I have various subscribers and would like to send out emails using different templates without having to alter the default newsletter template everytime.

    Thanks

    Christoph

  2. #2
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: adding new templates to newsletter module

    What sort of changes do you mean by "new template" ?
    I'm trying to understand the "why" behind your question.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2007
    Posts
    24
    Plugin Contributions
    0

    Default Re: adding new templates to newsletter module

    OK, what I am trying to do is send a newsletter out to various groups of subscribers. Those groups should get different types of emails with different layout. The only way I seem to be able to achieve this is by manually altering the (single) newsletter template. What I would like to be able is to have a template for group1, group2 etc and then send them a newsletter based on that template. Does this make it clearer?

    Thanks

    Christoph

  4. #4
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: adding new templates to newsletter module

    Quote Originally Posted by christoph_lutz View Post
    Does this make it clearer?
    Not really.

    What do you need to change between templates? The only thing in the templates is name/message/copyright/disclaimer ... and the newsletter template also includes an unsubscribe link.

    How are you preparing your newsletter content? Would it make sense to put your custom styling etc directly into the HTML of the newsletter?
    Or am I missing something about what you're trying to accomplish by using alternate templates?
    What specific distinction are you aiming for?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Jun 2007
    Posts
    24
    Plugin Contributions
    0

    Default Re: adding new templates to newsletter module

    I am preparing the html content outside in a text editor. The problem is that I would like different logos, fundamentally different layout etc. I have experimented with having a "template" that just puts out the html I paste in and nothing else but that means that things like name, copyright, disclaimer etc could not be done easily and if I want those then I'd need to use the template and then I am restricted again to the kind of html framework that comes in the single template...

    Christoph

  6. #6
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: adding new templates to newsletter module

    Okay.

    How do you currently differentiate between subscriber groups when sending these various newsletters?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Jun 2007
    Posts
    24
    Plugin Contributions
    0

    Default Re: adding new templates to newsletter module

    i have amended the subscribe to newsletter option where users can tick different categories, so I can select those when sending a newsletter

    Christoph

  8. #8
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: adding new templates to newsletter module

    1. edit /includes/functions/functions_email.php
    around line 329, find this section. Add the additional code as shown:
    Code:
        if (!file_exists($template_filename)) {
          if (isset($block['EMAIL_TEMPLATE_FILENAME']) && file_exists($template_filename_base . $block['EMAIL_TEMPLATE_FILENAME'] . '.html')) {
            $template_filename = $template_filename_base . $block['EMAIL_TEMPLATE_FILENAME'] . '.html';
          } elseif (file_exists($template_filename_base . str_replace(array('_extra','_admin'),'',$module) . '.html')) {
    2. /admin/includes/modules/newsletter.php
    around line 99, find this section. Add the new line, as shown:
    Code:
          $html_msg['EMAIL_FIRST_NAME'] = $audience->fields['customers_firstname'];
          $html_msg['EMAIL_LAST_NAME']  = $audience->fields['customers_lastname'];
          $html_msg['EMAIL_MESSAGE_HTML'] = $this->content_html;
          $html_msg['EMAIL_TEMPLATE_FILENAME'] = $whatever_filename_you_specify_here;
    
          zen_mail($audience->fields['customers_firstname'] . ' ' . $audience->fields['customers_lastname'], $audience->fields['customers_email_address'], $this->title, $this->content, STORE_NAME, EMAIL_FROM, $html_msg, 'newsletters');
    3. Now make whatever additional code edits (to the newsletters.php file) would be required to get the $html_msg['EMAIL_TEMPLATE_FILENAME'] variable to contain the name of the template you want loaded.
    The way it's coded above, it'll expect files named like this:
    /email/email_template_*******.html
    ... where ******* is the name you get inserted into the $html_msg['EMAIL_TEMPLATE_FILENAME'] variable.

    Since you've made some code edits to allow you to select groups, perhaps you can link a text string with those groups which could be used as the filename piece.

    4. repeat #2 & #3 for the product_notifications module file if necessary.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Jun 2007
    Posts
    24
    Plugin Contributions
    0

    Default Re: adding new templates to newsletter module

    Thanks for your reply and the code and the explanation. I have made the amendmends but don't understand the last step - how do I now compose a message and send it to the right group of people? What do you mean by text string? Would it not be that I should select the template from the drop-down that currently says "newsletter" and "product_notification"?

    Thanks

    christoph

  10. #10
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: adding new templates to newsletter module

    Quote Originally Posted by christoph_lutz View Post
    Thanks for your reply and the code and the explanation. I have made the amendmends but don't understand the last step - how do I now compose a message and send it to the right group of people? What do you mean by text string? Would it not be that I should select the template from the drop-down that currently says "newsletter" and "product_notification"?
    That dropdown determines which module to run from the modules/newsletters folder.
    If you want to add something to that dropdown and write a new module to go with it, feel free.

    I've only given you the steps on how to reference additional templates from within the code.

    I have no idea how you've altered things to collect additional newsletter choices, nor do I know how you currently select which audience to send to.

    If you use a built-in audience feature from the query_builder tools, then you should be able to match an audience name with a template name so that there are no interface changes required to the newsletter screen. Sorry if that's too much tech talk -- you sounded like you had a handle on programming when you said you altered things to allow additional newsletter choices.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Why my new templates installed doesn't appear in the templates selection?
    By dijah in forum Templates, Stylesheets, Page Layout
    Replies: 14
    Last Post: 14 Apr 2014, 11:08 AM
  2. Adding New Products to newsletter.
    By madmickc in forum General Questions
    Replies: 7
    Last Post: 9 Jun 2010, 04:14 AM
  3. Adding new variable in Email templates
    By erko in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 18 May 2010, 08:07 AM
  4. newsletter templates
    By wickedklown in forum General Questions
    Replies: 3
    Last Post: 1 Dec 2009, 09:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR