Zen Cart Logo
Forums / Zen Cart Code Suggestions / Disabling Customers Email

Disabling Customers Email

Views: 81

Results 1 to 6 of 6
19 Dec 2011, 19:02
#1
mshultise avatar

mshultise

Zen Follower

Join Date:
Feb 2005
Location:
Captain Cook, Hawaii
Posts:
172
Plugin Contributions:
0

Disabling Customers Email

I would like to suggest that the solution I offered a few years ago, be incorporated as a permanet solution for disabling a customers email. The problem was discussed here: http://www.zen-cart.com/forum/showthread.php?t=42074

There are times when a customer has asked to be removed from all emails. My solution changes one core file (admin/customer.php) to add a bit of code. This mod just allows the Admin to set a third value (already coded but not used).

By allowing the Admin to set the value, we keep the customer record, purchases and reviews intact, but stop all emails.

Since Admin does not allow overrides, I currently have to remember to upload this patch to every site every update.

It looks like this was planned and not installed yet.

There may be a cleaner coding, but this works as is.

In admin/includes/languages/english

I see:

define('ENTRY_EMAIL_HTML_DISPLAY','HTML');
define('ENTRY_EMAIL_TEXT_DISPLAY','TEXT-Only');
define('ENTRY_EMAIL_NONE_DISPLAY','Never');

All I did was go to admin/customers.php and change the following: around line 790

Change this


} else {
$email_pref_text = ($cInfo->customers_email_format == 'TEXT') ? true : false;
$email_pref_html = !$email_pref_text;
echo zen_draw_radio_field('customers_email_format', 'HTML', $email_pref_html) . ' ' . ENTRY_EMAIL_HTML_DISPLAY . '   ' . zen_draw_radio_field('customers_email_format', 'TEXT', $email_pref_text) . ' ' . ENTRY_EMAIL_TEXT_DISPLAY ;
}

to this


} else {

$email_pref_html = false;
$email_pref_text = false;
$email_pref_none = false;

switch ($cInfo->customers_email_format) {

case 'HTML':
$email_pref_html = true;
break;

case 'TEXT':
$email_pref_text = true;
break;

case 'NONE':
$email_pref_none = true;
break;

default:
echo 'ERROR: email format selection error.';
break;
}
echo zen_draw_radio_field('customers_email_format', 'HTML', $email_pref_html) . ' ' .

ENTRY_EMAIL_HTML_DISPLAY . '   ' .
zen_draw_radio_field('customers_email_format', 'TEXT', $email_pref_text) . ' ' .

ENTRY_EMAIL_TEXT_DISPLAY . '   ' .

zen_draw_radio_field('customers_email_format', 'NONE', $email_pref_none) . ' ' .

ENTRY_EMAIL_NONE_DISPLAY ;

}


08 Jul 2017, 04:33
#2
mshultise avatar

mshultise

Zen Follower

Join Date:
Feb 2005
Location:
Captain Cook, Hawaii
Posts:
172
Plugin Contributions:
0

Re: Disabling Customers Email

Has anyone considered this change? I am sure there is better code that I did.

08 Jul 2017, 13:54
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Disabling Customers Email

Why would a customer not want to receive an email confirmation of their order?

For all other communications from a Zen Cart-based store, there's a setting for each customer to indicate whether/not they want to receive other notifications; why not just set that value?

09 Jul 2017, 01:39
#4
drbyte avatar

drbyte

Sensei

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

Re: Disabling Customers Email

I've always been reluctant to put this power in the hands of the casual admin user who doesn't know how SERIOUS setting the value to NONE really is. IT COMPLETELY PREVENTS CUSTOMERS FROM GETTING ANY EMAILS, EVEN IMPORTANT ONES, FROM YOUR STORE.

And as far as I know only 2 people have ever asked for this.

But, here's how I'd code it. https://github.com/zencart/zencart/pull/1458
It'll be in v1.6.0 whenever it is released.

(You can safely make the same change in v1.5.x)

21 Jul 2017, 21:30
#5
mshultise avatar

mshultise

Zen Follower

Join Date:
Feb 2005
Location:
Captain Cook, Hawaii
Posts:
172
Plugin Contributions:
0

Re: Disabling Customers Email

lat9:

Why would a customer not want to receive an email confirmation of their order?

For all other communications from a Zen Cart-based store, there's a setting for each customer to indicate whether/not they want to receive other notifications; why not just set that value?

Sometimes the customer does not ask, they are dead. The store manager wants to keep the sales information but not keep sending emails to a mailbox no longer monitored.

The store manager sends email to all customers. We could have changed the coding for send all emails to exclude the user but that requires setting the no mail bit to 0 which we would have to do in MySQL. Since most of the coding was already in place to set this value to 0 I thought it was best to have it done correctly. My code was a poor hack, I'm sure.

21 Jul 2017, 21:31
#6
mshultise avatar

mshultise

Zen Follower

Join Date:
Feb 2005
Location:
Captain Cook, Hawaii
Posts:
172
Plugin Contributions:
0

Re: Disabling Customers Email

Thanks Dr. Byte!