Zen Cart Logo
Forums / All Other Contributions/Addons / Newsletter-Only Subscriptions for v1.3x

Newsletter-Only Subscriptions for v1.3x

Views: 295,600

Results 81 to 100 of 1,165
16 Jun 2006, 11:30 PM
#81
ctcentralinfo avatar

ctcentralinfo

Totally Zenned

Join Date:
Apr 2005
Posts:
853
Plugin Contributions:
0

Newsletter-Only Subscriptions for v1.3x

NotGoddess:

I assume you are using Image Handler 2.0 for v1.3 (Tim Kroeger) ?
Taking a quick look I don't see any overlap.
I'll check when I get to my dev machine in a few hours, but I don't see the connect. I have IH2 on a cart and haven't run into issues.

The function that checks for a valid email is:
zen_validate_email() which is in includes/functions/functions_email.php

Are you familiar with using WinMerge or similar file diff utility? If so you can try comparing the contrib to the existing files to see if any has changed.
Pay special attention to the file includes/modules/pages/subscribe/header_php.php as that is where the check is performed.

Unfortunately it's not something I can diagnose from here. :(

-Ng_

[oann- looks like you'll want the sidebox width patch. on my site or outlined in this thread (just need a few spaces or br's before input/submit)]

I am wondering if this might be the cause of the issues I am having with the mod. I installed a products type mod that Moku created.

He said:

You may have to change the default ID for "product_type_id". The default I used
is "7", but please manually check that this ID is not already used on your
"zc_product_types" table!

This might be causing the issue instead of image handler.

16 Jun 2006, 11:50 PM
#82
ctcentralinfo avatar

ctcentralinfo

Totally Zenned

Join Date:
Apr 2005
Posts:
853
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

I have another question, I don't have HTML TEXT-Only in my newsletter subscription sidebox. How do I get those to show up?

17 Jun 2006, 2:21 AM
#83
notgoddess avatar

notgoddess

Zen Follower

Join Date:
Jan 2005
Location:
Waukee, Iowa
Posts:
206
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

ctcentralinfo:

I installed a products type mod that Moku created.
I'd advise you to compare these to files:

/includes/modules/pages/subscribe/header_php.php
/includes/functions/functions_email.php

and compare them to what is included in the contribution (use WinMerge or your fave diff utility).

The first file does all the validation, and the second has the function (zen_validate_email) that the first calls. Either the function is not being called, or it was changed somewhere.

Something I did notice is that I failed to add a 'default' fallback-ie you go to main_page=subscribe and don't have the post value 'act' set, the email won't get added to the database, but you do get the 'thanks for subscribing' message.
(bonk) I will fix this in the next release (out Sunday-ish).

Check your subscription manager to see if they fake emails are actually being added. If they aren't this is most likely the issue (tho if it is then you get to investigate why you suddenly are sending some, but not all post info, since the page is also sent via post).

17 Jun 2006, 2:22 AM
#84
notgoddess avatar

notgoddess

Zen Follower

Join Date:
Jan 2005
Location:
Waukee, Iowa
Posts:
206
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

ctcentralinfo:

I have another question, I don't have HTML TEXT-Only in my newsletter subscription sidebox. How do I get those to show up?
Check your email settings. The option only shows up if you enable HTML mail in your admin settings (if you choose not to send HTML mail, then it defaults to text).

-Ng_

17 Jun 2006, 3:45 AM
#85
ctcentralinfo avatar

ctcentralinfo

Totally Zenned

Join Date:
Apr 2005
Posts:
853
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

First of all I would like to say you create a great mod. That being said I have know idea why this the function is not being called. These are the files. I used both winmerge and textpad and Nothing seems to be wrong. Here are the files:

includes/modules/pages/subscribe/header_php.php

} elseif (zen_validate_email($email_address) == false) {
$error = true;
$messageStack->add('subscribe', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
} else {
// check if email address exists in CUSTOMERS table or in SUBSCRIBERS table
$check_cust_email_query = "select count(*) as total from " . TABLE_CUSTOMERS .
" where customers_email_address = '" . zen_db_input($email_address) . "'";
$check_cust_email = $db->Execute($check_cust_email_query);

  	$check_news_email_query = "select count(*) as total from " . TABLE_SUBSCRIBERS .
  		" where email_address = '" . zen_db_input($email_address) . "'";
  $check_news_email = $db->Execute($check_news_email_query);

  if ($check_cust_email->fields['total'] > 0) {
  	$error = true;
  	$messageStack->add('subscribe', SUBSCRIBE_DUPLICATE_CUSTOMERS_ERROR);
  } elseif ($check_news_email->fields['total'] > 0) {
  	$error = true;
  	$messageStack->add('subscribe', SUBSCRIBE_DUPLICATE_NEWSONLY_ERROR);
  } else {
  		// we generate a random confirmation code so we can use it as an 
  		// extra security measure to prevent spoofs/scams.
  		
  		$confirm_code = substr(base64_encode(crypt(str_shuffle(time()))),4,6);

  		$db->Execute('insert into ' . TABLE_SUBSCRIBERS . 
  			' (email_address, email_format, subscribed_date, confirmed) ' .
  			"VALUES ('".$email_address."', '".$email_format."', now(), '".$confirm_code."')"
    );

  // Send confirmation request.
  // get the proper uri
  	$confirm_uri = zen_href_link(FILENAME_SUBSCRIBE_CONFIRM, 'confirm='.$confirm_code.'&email=' . $email_address, 'NONSSL');
  	
  	// initial welcome
  	$email_text .=  EMAIL_WELCOME;
  	$html_msg['EMAIL_WELCOME'] = str_replace('\n','',EMAIL_WELCOME);
  	
  	// add in regular email welcome text
  	$email_text .= "\n\n" . EMAIL_TEXT . sprintf(EMAIL_CONFIRMATION_TEXT, $confirm_uri ). EMAIL_CONTACT . EMAIL_CLOSURE;
  	
  	$html_msg['EMAIL_MESSAGE_HTML']  = str_replace('\n','',EMAIL_TEXT );
  	$html_msg['EMAIL_CONFIRMATION_LINK']  = str_replace('\n','', sprintf(EMAIL_CONFIRMATION_TEXT, '<a href="'.$confirm_uri.'">'.$confirm_uri.'</a>' ));
  	$html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\n','',EMAIL_CONTACT);
  	$html_msg['EMAIL_CLOSURE']       = nl2br(EMAIL_CLOSURE);
  	
  	// include create-account-specific disclaimer
  	$email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS). "\n\n";
  	$html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">'. STORE_OWNER_EMAIL_ADDRESS .' </a>');
  	
  	// send welcome email
  	zen_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'newsletter_subscription');
  	
  }

}
}

$breadcrumb->add(NAVBAR_TITLE);

?>

includes/functions/functions_email.php

function zen_validate_email($email) {
$valid_address = true;

// fail if contains no @ symbol
if (!strstr($email,'@')) return false;

// split the email address into user and domain parts
// need to update to trap for addresses in the format of "first@last"@someplace.com
// this method will most likely break in that case
list( $user, $domain ) = explode( "@", $email );
$valid_ip_form = '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';
$valid_email_pattern = '^[a-z0-9]+[a-z0-9_\.\'\-]*@[a-z0-9]+[a-z0-9\.\-]*\.(([a-z]{2,6})|([0-9]{1,3}))$';
//preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9\._-]+)+$/', $email))
//preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*?[a-z]+$/is');
$space_check = '[ ]';

// strip beginning and ending quotes, if and only if both present
if( (ereg('^["]', $user) && ereg('["]$', $user)) ){
  $user = ereg_replace ( '^["]', '', $user );
  $user = ereg_replace ( '["]$', '', $user );
  $user = ereg_replace ( $space_check, '', $user ); //spaces in quoted addresses OK per RFC (?)
  $email = $user."@".$domain; // contine with stripped quotes for remainder
}

// fail if contains spaces in domain name
if (strstr($domain,' ')) return false;

// if email domain part is an IP address, check each part for a value under 256
if (ereg($valid_ip_form, $domain)) {
  $digit = explode( ".", $domain );
  for($i=0; $i<4; $i++) {
    if ($digit[$i] > 255) {
      $valid_address = false;
      return $valid_address;
      exit;
    }
    // stop crafty people from using internal IP addresses
    if (($digit[0] == 192) || ($digit[0] == 10)) {
      $valid_address = false;
      return $valid_address;
      exit;
    }
  }
}

if (!ereg($space_check, $email)) { // trap for spaces in
  if ( eregi($valid_email_pattern, $email)) { // validate against valid email patterns
    $valid_address = true;
  } else {
    $valid_address = false;
    return $valid_address;
    exit;
  }
}
return $valid_address;

}
?>

17 Jun 2006, 3:57 AM
#86
notgoddess avatar

notgoddess

Zen Follower

Join Date:
Jan 2005
Location:
Waukee, Iowa
Posts:
206
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

okay. do this to confirm if it might be the issue I described above (act='subscribe' post field not passing):
edit the subscribe/header_php.php file:
Comment out line 31 and add if(1) { below it like so:

//  if (isset($_POST['act']) && ($_POST['act'] == 'subscribe')) {
	if(1) {

If it now gives an error about the email, reply back w/ which error.

-Ng_

17 Jun 2006, 9:14 PM
#87
ctcentralinfo avatar

ctcentralinfo

Totally Zenned

Join Date:
Apr 2005
Posts:
853
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

NotGoddess:

okay. do this to confirm if it might be the issue I described above (act='subscribe' post field not passing):
edit the subscribe/header_php.php file:
Comment out line 31 and add if(1) { below it like so:

// if (isset($_POST['act']) && ($_POST['act'] == 'subscribe')) {
if(1) {

> If it now gives an error about the email, reply back w/ which error.
> 
> -Ng_

I just clicked subscribe without adding anything,
This is the error I am getting

> Is your email address correct? It should contain at least 6 characters. Please try again.
17 Jun 2006, 11:58 PM
#88
notgoddess avatar

notgoddess

Zen Follower

Join Date:
Jan 2005
Location:
Waukee, Iowa
Posts:
206
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

What that indicates is that the 'act' and 'email' etc aren't getting passed at all.

I just noticed that you have 'nice' urls. I'm wondering if the sefu is doing it...
edit the sidebar template and change the 'post' to 'get'

includes/templates/yourTemplate/sideboxes/tpl_subscribe.php ::

   $content .= zen_draw_form('subscribe', zen_href_link(FILENAME_SUBSCRIBE, '', 'SSL'), 'get', '');

You should then see the email/act in the browser address bar.

-Ng_

18 Jun 2006, 1:15 AM
#89
ctcentralinfo avatar

ctcentralinfo

Totally Zenned

Join Date:
Apr 2005
Posts:
853
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

NotGoddess:

What that indicates is that the 'act' and 'email' etc aren't getting passed at all.

I just noticed that you have 'nice' urls. I'm wondering if the sefu is doing it...
edit the sidebar template and change the 'post' to 'get'

includes/templates/yourTemplate/sideboxes/tpl_subscribe.php ::

$content .= zen_draw_form('subscribe', zen_href_link(FILENAME_SUBSCRIBE, '', 'SSL'), 'get', '');

> 
> You should then see the email/act in the browser address bar.
> 
> -Ng_

You are right, I turned off the sefu urls and changed the files you originally told me to mod back and it started to work fine. 

This is the URL I got when I changed 'post' tp 'get'

> <http://www.books-japan-online.com/test/subscribe.html?y=6&x=32&email_format=HTML&email=Enter+email+address&act=subscribe>

but I still didn't get the error I wanted.
18 Jun 2006, 11:34 AM
#90
wildgarden avatar

wildgarden

New Zenner

Join Date:
Apr 2006
Posts:
32
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

sleepless:

I was able to set this up and added my email addresses. It doesn't recognize newsletter only subscribers.

Hi, I have set up the newsletter subscribe and it seems to be storing the emails correctly which is great! Now I am wanting to send an email newsletter to these subscribers only but the newsletter manager doesn't seem to recognise them, only the customers that have signed up. From what I understand, this isn't possible with the addon and I can only email them individually? or am I missing something?

18 Jun 2006, 1:39 PM
#91
notgoddess avatar

notgoddess

Zen Follower

Join Date:
Jan 2005
Location:
Waukee, Iowa
Posts:
206
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

You should see two newsletter groups in the newsletter dropdown list:

Customer Account Newsletter Subscribers
and
All Newsletter Subscribers

They should have numbers behind them e.g. (4)

The 'all' list should have a higher number than the customer account list (if you have newsletter only subscribers). That's the one you use to mail to everyone.

19 Jun 2006, 12:48 AM
#93
wildgarden avatar

wildgarden

New Zenner

Join Date:
Apr 2006
Posts:
32
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

NotGoddess:

You should see two newsletter groups in the newsletter dropdown list:

Customer Account Newsletter Subscribers
and
All Newsletter Subscribers

They should have numbers behind them e.g. (4)

The 'all' list should have a higher number than the customer account list (if you have newsletter only subscribers). That's the one you use to mail to everyone.

I think something is wrong with mine cos I'm only getting 'All newsletter subscribers' which seems to be pulling from customer database only. Even though I can see Newsletter subscribers in the Subscription Management. Any ideas what might be wrong?

19 Jun 2006, 1:09 AM
#94
wildgarden avatar

wildgarden

New Zenner

Join Date:
Apr 2006
Posts:
32
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

wildgarden:

I think something is wrong with mine cos I'm only getting 'All newsletter subscribers' which seems to be pulling from customer database only. Even though I can see Newsletter subscribers in the Subscription Management. Any ideas what might be wrong?

Once again I worked it out on my own! I removed and reinstalled the subscription manager and it's now showing all newsletter subscribers

19 Jun 2006, 1:09 AM
#95
notgoddess avatar

notgoddess

Zen Follower

Join Date:
Jan 2005
Location:
Waukee, Iowa
Posts:
206
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

It sounds like the query_builder didn't get updated.

Try putting this in from your sql patches page:
(remember to add your db prefix to the query_builder bit if you have one):

UPDATE query_builder SET 
 query_name='Customer Account Newsletter Subscribers', 
 query_description='Returns name and email address of newsletter subscribers who have a customer account.'
 WHERE query_string='select customers_firstname, customers_lastname, customers_email_address from TABLE_CUSTOMERS where customers_newsletter = \'1\'';
 
INSERT INTO query_builder 
  (query_category, query_name, query_description, query_string, query_keys_list)
	VALUES ('email,newsletters', 'Newsletter Subscribers',
	'Returns name and email address of all Customer Account subscribers and all Newsletter-Only subscribers.',
	'select c.customers_firstname, c.customers_lastname, s.email_address as customers_email_address from TABLE_SUBSCRIBERS as s left join TABLE_CUSTOMERS as c on c.customers_id = s.customers_id ', '');

Note that I purposely changed the name of the new query, removing the 'All' bit just in case the query is already in there.

I'm still a few hours out from the next update-doesn't look like I'll make it tonight, so try that solution.

-Ng_

19 Jun 2006, 3:10 AM
#96
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,841
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

Has anyone noticed that there is a limit to the size of the email address entered in the subscribe box? I counted out to be 30 characters, well I have a customer that has a 31 character email address. so she could not sign up through the subscribe box, in her case she just subscribed when creating her account, but it doesn't solve the problem for newsletter only subscribers with long email addresses.

19 Jun 2006, 3:10 AM
#97
notgoddess avatar

notgoddess

Zen Follower

Join Date:
Jan 2005
Location:
Waukee, Iowa
Posts:
206
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

I'm not quite ready to release the update yet, but it should be in the next couple days.

In the meantime I've added another patch on my site to fix the subscription manager-it wasn't properly saving/setting the email format.

http://notgoddess.com/scripts/newsletter-subscribe (scroll down to 'known issues'..the patch is there).

Thank you to Wildgarden for noticing this.

-Ng_

19 Jun 2006, 3:20 AM
#98
notgoddess avatar

notgoddess

Zen Follower

Join Date:
Jan 2005
Location:
Waukee, Iowa
Posts:
206
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

barco57:

Has anyone noticed that there is a limit to the size of the email address entered in the subscribe box?

Just edit the templates to take out the maxlength.
includes/templates/yourtemplate/sideboxes/tpl_subscribe.php
and
includes/templates/yourtemplate/templates/tpl_subscribe_header.php

-Ng_

19 Jun 2006, 4:21 AM
#99
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,841
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

Thanks for the quick response. I just went in and changed it to 35 characters and I'll wait and see if I have any problems with that.

22 Jun 2006, 6:54 PM
#100
frypanman avatar

frypanman

New Zenner

Join Date:
Apr 2006
Posts:
20
Plugin Contributions:
0

Re: Newsletter-Only Subscriptions for v1.3x

Hi,
I love your mod it works very well. My only difficulty is cosmetic. I use firefox so didn't notice at first but in IE I was told that the subscribe box is 2x as wide as the the other boxes and sure enough it was. I checked the size in the layout menu and the boxes and columns are all set to 150px so I can't figure out how IE is figureing it scince I there is no specific size reference in the template or mod. Do you have any idea how I might fix this if it is fiaable? Thanks for any help