If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Zen Cart Code Suggestions / Disabling Customers Email

Disabling Customers Email

Started by mshultise on 19 Dec 2011, 7:02 PM · Views: 108

Results 1 to 6 of 6
19 Dec 2011, 7:02 PM
#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 ;

}


Aloha from Hawaii! (its a dirty job, but SOMEBODY has to live here...)

8 Jul 2017, 4:33 AM
#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.

Aloha from Hawaii! (its a dirty job, but SOMEBODY has to live here...)

8 Jul 2017, 1:54 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
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?

9 Jul 2017, 1:39 AM
#4
drbyte avatar

drbyte

Sensei

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

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)

.
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 Jul 2017, 9:30 PM
#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.

Aloha from Hawaii! (its a dirty job, but SOMEBODY has to live here...)

21 Jul 2017, 9:31 PM
#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!

Aloha from Hawaii! (its a dirty job, but SOMEBODY has to live here...)