Okay, then one approach could be to use the query_name value from the query-builder data (ie: the audiences list) to determine which template to use.
- Rename your special queries like this:
Subscriber Group: Bleeding Edge Racers
or
Subscriber Group: All Stars ~ Heavy Hitters
- Create corresponding email template files.
The email templates for the example names above would be:
/email/email_template_bleedingedgerac.html
/email/email_template_allstars.html
Explanation:
The template names will be built from the query_name (audience names) starting with 'Subscriber Group: ' followed by up to 15 chars for the template name (or until a ~ is found).
Converted to lower-case letters to find the template filename.
If a filename matching the pattern isn't found, the module name will be used instead.
- Make the following code edits to the admin/includes/newsletters/newsletter.php:```
function send($newsletter_id) {
global $db;
[B] // Look for audience names starting with 'Subscriber Group: ' and accept up to 15 chars for template name (takes name up to ~ or if no ~ then 15 max chars)
$my_template_name = str_replace('Subscriber Group: ', '', $this->query_name);
$my_template_name = preg_replace('/^[0-9a-zA-Z_]/', '', $my_template_name);
$pos = strpos($my_template_name, '');
$my_template_name = strtolower(substr($my_template_name, 0, ($pos > 0 && $pos < 15 ? $pos : 15) ));
[/B]
$audience_select = get_audience_sql_query($this->query_name, 'newsletters');
$audience = $db->Execute($audience_select['query_string']);
$records = $audience->RecordCount();
if ($records==0) return 0;
$i=0;
while (!$audience->EOF) {
$i++;
$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;
[B] $html_msg['EMAIL_TEMPLATE_FILENAME'] = $my_template_name;[/B]
This all requires that you implement the functions_email changes I mentioned earlier.
.
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.