Forums / General Questions / v1.3.0 / v1.3.0.1 How to send test newsletter to self

v1.3.0 / v1.3.0.1 How to send test newsletter to self

Locked

Started by drbyte on 13 Jun 2006, 7:44 AM · Views: 2,316

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
13 Jun 2006, 7:44 AM
#1
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

v1.3.0 / v1.3.0.1 How to send test newsletter to self

IF YOU ARE USING v1.3.0.0, or v1.3.0.1, the following may be of benefit.
Versions v1.3.0.2 and higher have this ALREADY built-in.

A few code changes will help you send a test newsletter to the email address of your current Admin account:

  1. via phpMyAdmin or Install SQL Patches, run the following SQL statement:```
    INSERT INTO query_builder ( query_id , query_category , query_name , query_description , query_string ) VALUES ( NULL, 'email,newsletters', 'Administrator', 'Just the email account of the current administrator', 'select 'ADMIN' as customers_firstname, admin_name as customers_lastname, admin_email as customers_email_address from TABLE_ADMIN where admin_id = $SESSION:admin_id');

2. edit /includes/functions/audience.php. Around line 99 you find the following block:```php
function parsed_query_string($read_string) {
   // extract table names from sql strings, so that prefixes are supported.
   // this will also in the future be used to reconstruct queries from query_keys_list field in query_builder table.

  $allwords = explode( " ", $read_string );
  reset( $allwords );
  while( list( $key, $val ) = each( $allwords ) ) {
    // find "{TABLE_" and extract that tablename
    if( substr( $val, 0, 7) == "{TABLE_"  && substr( $val, -1) == "}" ) { //check for leading and trailing {} braces
    $val = substr( $val, 2, strlen($val)-2);  // strip off braces.  Could also use str_replace(array('{','}'),'',$val);
    //now return the value of the CONSTANT with the name that $val has.  ie: TABLE_CUSTOMERS = zen_customers
    $val = constant($val);
    } elseif ( substr( $val, 0, 6) == "TABLE_" ) {
    //return the value of the CONSTANT with the name that $val has.  ie: TABLE_CUSTOMERS = zen_customers
    $val = constant($val);
    }
    $good_string .= $val.' ';
   }
   return $good_string;
}
```replace that with this:```php
function parsed_query_string($read_string) {
  // extract table names from sql strings, so that prefixes are supported.
  // this will also in the future be used to reconstruct queries from query_keys_list field in query_builder table.

  $allwords = explode( " ", $read_string );
  reset( $allwords );
  while( list( $key, $val ) = each( $allwords ) ) {
    // find "{TABLE_" and extract that tablename
    if( substr( $val, 0, 7) == "{TABLE_"  && substr( $val, -1) == "}" ) { //check for leading and trailing {} braces
      $val = substr( $val, 2, strlen($val)-2);  // strip off braces.  Could also use str_replace(array('{','}'),'',$val);
      //now return the value of the CONSTANT with the name that $val has.  ie: TABLE_CUSTOMERS = zen_customers
      $val = constant($val);
    } elseif ( substr( $val, 0, 6) == "TABLE_" ) {
    //return the value of the CONSTANT with the name that $val has.  ie: TABLE_CUSTOMERS = zen_customers
      $val = constant($val);
    } elseif ( substr( $val, 0, 9) == '$SESSION:' ) {
      //return the value of the SESSION var indicated
      $param = str_replace('$SESSION:', '', $val);
      $val = $_SESSION[$param];
    }
    $good_string .= $val.' ';
   }
   return $good_string;
}

.
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.

13 Jun 2006, 10:49 PM
#2
lawman avatar

lawman

Zen Follower

Join Date:
Mar 2006
Posts:
102
Plugin Contributions:
0

Re: v1.3.0 / v1.3.0.1 How to send test newsletter to self

Works Great! :thumbsup: Thx Doc B.

6 Aug 2006, 10:34 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: v1.3.0 / v1.3.0.1 How to send test newsletter to self

NOTE: This is ALREADY BUILT-IN to Zen Cart v1.3.0.2 and higher.

.
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.

11 Oct 2006, 2:27 PM
#4
clairecallaghan avatar

clairecallaghan

New Zenner

Join Date:
Feb 2004
Posts:
44
Plugin Contributions:
0

Re: v1.3.0 / v1.3.0.1 How to send test newsletter to self

Hi

i followed the above instructions > still selects whole mailing list rather than just administrator

can you offer any help?

thanks

12 Oct 2006, 1:21 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: v1.3.0 / v1.3.0.1 How to send test newsletter to self

What options do you have in the audience pull-down list?
What version of Zen Cart are you using?

.
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.

12 Oct 2006, 8:02 AM
#6
clairecallaghan avatar

clairecallaghan

New Zenner

Join Date:
Feb 2004
Posts:
44
Plugin Contributions:
0

Re: v1.3.0 / v1.3.0.1 How to send test newsletter to self

hi version 1.3.0.1

and the options are

all newsletter subscribers
dormant customers > 3 months
acitve customers in past 3 months (subscribers)
acitve customers in past 3 months (regardless of subscription status)
administrator

any ideas

thanks