Zen Cart Logo
Forums / Bug Reports / [Duplicate] "Show Newsletter Checkbox" setting bug

[Duplicate] "Show Newsletter Checkbox" setting bug

Locked

Views: 2,382

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
21 Sep 2009, 4:53 AM
#1
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

[Duplicate] "Show Newsletter Checkbox" setting bug

When the "Show Newsletter Checkbox" setting is set to 0 the system automatically subscribes new customer to the newsletter.

At first I thought that customers were subscribing by going to the My Account link, which in my template includes the newsletter options link (see this thread)

However when I disabled that newsletter options link under My Account I saw that new customers were still getting subscribed to the newsletter anyhow.

When that setting is set to 0 it should stop subscribing new customers and it should disable this page: index.php?main_page=account_newsletters

Why is this important? To transfer subscribers from the ZC newsletter list to the custom newsletter list it would be nice if a store owner knew which customers subscribed on their own instead of automatically...

21 Sep 2009, 11:45 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: [Duplicate] "Show Newsletter Checkbox" setting bug

This is a duplicate report of the one already discussed here: http://www.zen-cart.com/forum/showthread.php?t=131942

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

21 Sep 2009, 7:37 PM
#3
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Re: [Duplicate] "Show Newsletter Checkbox" setting bug

Thank you.

If I read it correctly, that post only discusses setting 1 and 2, not setting 0. Did the bug fix also take care of the problem with setting 0?

Thanks.

21 Sep 2009, 7:41 PM
#4
drbyte avatar

drbyte

Sensei

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

Re: [Duplicate] "Show Newsletter Checkbox" setting bug

It should. What happened when you made the change?

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

21 Sep 2009, 7:48 PM
#5
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Re: [Duplicate] "Show Newsletter Checkbox" setting bug

I didn't change any code yet. :)

Your code on that post:

  if (ACCOUNT_NEWSLETTER_STATUS == '1' || ACCOUNT_NEWSLETTER_STATUS == '2') {
    $newsletter = 0;
    if (isset($_POST['newsletter'])) {
      $newsletter = zen_db_prepare_input($_POST['newsletter']);
    }
  }

Does not show the status 0. I do not have programming expertise, but maybe I could modify that code and include a snippet like this?

ACCOUNT_NEWSLETTER_STATUS == '0' ||

For my case this is really irrelevant at this point, since I am not using the ZC default newsletter any longer. But I just thought it might be useful for future users...

6 Oct 2009, 7:01 PM
#6
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Re: [Duplicate] "Show Newsletter Checkbox" setting bug

Dr Byte,

I tested this out.

In my case, this works only when you also add the '0' setting. So it was a new bug after all ;)

This is the code that works for me:

if (ACCOUNT_NEWSLETTER_STATUS == '0' || ACCOUNT_NEWSLETTER_STATUS == '1' || ACCOUNT_NEWSLETTER_STATUS == '2') {
  $newsletter = 0;
  if (isset($_POST['newsletter'])) {
    $newsletter = zen_db_prepare_input($_POST['newsletter']);
  }

This is the code you suggested:

  if (ACCOUNT_NEWSLETTER_STATUS == '1' || ACCOUNT_NEWSLETTER_STATUS == '2') {
    $newsletter = 0;
    if (isset($_POST['newsletter'])) {
      $newsletter = zen_db_prepare_input($_POST['newsletter']);
    }
  }

It was pure luck I think, but I guess I am starting to learn something here...

:smile:

6 Oct 2009, 7:16 PM
#7
drbyte avatar

drbyte

Sensei

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

Re: [Duplicate] "Show Newsletter Checkbox" setting bug

Actually, no, what you've done is basically make the entire "if" statement moot. So, that's not the best solution, since it will cause one of the settings not to work properly.

The code I suggested is correct, but it's also helpful to change this line earlier in the file:

  $newsletter = (ACCOUNT_NEWSLETTER_STATUS == '1' ? false : true);

to:```
$newsletter = (ACCOUNT_NEWSLETTER_STATUS == '1'[B] || ACCOUNT_NEWSLETTER_STATUS == '0'[/B] ? false : true);


Thanks for testing.

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

6 Oct 2009, 8:13 PM
#8
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Re: [Duplicate] "Show Newsletter Checkbox" setting bug

Glad I asked...

Thank you for the new solution. If it does not work I will post back. I will keep an eye on the counter.

:smile:

6 Oct 2009, 8:38 PM
#9
hedron avatar

hedron

Zen Follower

Join Date:
Feb 2009
Posts:
138
Plugin Contributions:
0

Re: [Duplicate] "Show Newsletter Checkbox" setting bug

Actually, it works fine. I just tested it.