Forums / Managing Customers and Orders / Email notification if a customer makes a change to their details?

Email notification if a customer makes a change to their details?

Locked

Started by southpacific on 1 Feb 2009, 10:18 PM · Views: 3,237

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
1 Feb 2009, 10:18 PM
#1
southpacific avatar

southpacific

New Zenner

Join Date:
Feb 2009
Location:
Sydney, Australia
Posts:
44
Plugin Contributions:
0

Email notification if a customer makes a change to their details?

Is there any way to be notified by email when a customer makes a change to any of their contact or address details?

I am currently running two databases one for offline sales an one for online (obviously zencart) I am not yet ready to move the offline database online so I would like to be notified about any contact detail changes made by my customers online.

Thanks

Sam

1 Feb 2009, 10:31 PM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Email notification if a customer makes a change to their details?

This facility doesn't exist in Zen Cart's core code so you would need to build it. There is a zen_mail function that would make this easier than it might otherwise be, so the tricky bit would be detecting the changes.

A better approach might be to develop reports that run daily or weekly and return any changes to the customer or address_book tables, as these are date stamped each time there's a change.

Both of these options though would require some programming skills and a fairly good kowledge of the innards of Zen Cart.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

2 Feb 2009, 11:11 PM
#3
southpacific avatar

southpacific

New Zenner

Join Date:
Feb 2009
Location:
Sydney, Australia
Posts:
44
Plugin Contributions:
0

Re: Email notification if a customer makes a change to their details?

Thanks kuroi,

Where would I start? I am a beginner at php but slowly getting my head around it..

I was thinking something simple like:

$email_message = 'Address change:' . "\n\n";
$email_message .= 'Customer ID:' . $customer_id . "\n";
$email_message .= 'Customer:' . $customers_firstname . ' ' . $lastname . "\n";

  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Address change', $email_message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

I tried putting it under this line: ```

<?php if ($messageStack->size('addressbook') > 0) echo $messageStack->output('addressbook'); ?>

Thanks  Sam
8 Feb 2009, 9:29 PM
#4
southpacific avatar

southpacific

New Zenner

Join Date:
Feb 2009
Location:
Sydney, Australia
Posts:
44
Plugin Contributions:
0

Re: Email notification if a customer makes a change to their details?

Does anyone know of a good place to start, either to have an email notification or daily report of customer details changes?

Thanks

10 Feb 2009, 4:20 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Email notification if a customer makes a change to their details?

NOTE: tep_ is a prefix for osC and not for Zen Cart ...

If you look in the /includes/modules/pages/account_edit/header_php.php you will see where updates are made that indicate a change has happened to the account around the lines:

    $sql = "UPDATE " . TABLE_CUSTOMERS_INFO . "
            SET    customers_info_date_account_last_modified = now()
            WHERE  customers_info_id = :customersID";

    $sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');

    $db->Execute($sql);

You could add your email code after that ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

11 Feb 2009, 8:25 AM
#6
southpacific avatar

southpacific

New Zenner

Join Date:
Feb 2009
Location:
Sydney, Australia
Posts:
44
Plugin Contributions:
0

Re: Email notification if a customer makes a change to their details?

Thanks for your reply,

now sure exactly how to use the zen_mail command,

would the script be:

$email_message .= 'Customer:' . $customers_firstname . ' ' . $customers_lastname . "\n";

  zen_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Address change', $email_message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

or even easier:

$email_message .= 'Customer:' . $customers_firstname . ' ' . $customers_lastname . "\n";

   zen_mail( "[email protected]", "$email_message");

Thanks so much for your help. I'm a little bit lost here. If you could give me an example of the code already in zen cart that would help heaps.

Thanks

Sam

:frusty:

11 Feb 2009, 9:27 AM
#7
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Email notification if a customer makes a change to their details?

If you use the developers tool kit (Admin > Tools > Developers Tool Kit) to search on "zen_mail" (pop it in the last input field, select "All Files - Catalog/Admin" and press search. Then you'll find all uses of this function.

There's a FAQ on using the tool kit.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

11 Feb 2009, 1:40 PM
#8
southpacific avatar

southpacific

New Zenner

Join Date:
Feb 2009
Location:
Sydney, Australia
Posts:
44
Plugin Contributions:
0

Re: Email notification if a customer makes a change to their details?

Hi Guys,

I have spent hours on this an still can't seem to work it out.

I am a poor beginner, but are willing to pay anyone $US15 via Paypal to show me how to do this.

Basically I need an email sent to me when ever a customer makes a change to any of their details under their account section, ie,

  • View or change my account information.
    * View or change entries in my address book.
    * Subscribe or unsubscribe from newsletters.
    * View or change my product notification list.

I also need to know what the change is.

My email address is [email protected]

Sam

11 Feb 2009, 5:51 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Email notification if a customer makes a change to their details?

There are two files to update about customer information ...

The first is the Customer Info in:
/includes/modules/pages/account_edit/header_php.php

Find the line:

    $db->perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', $where_clause);

and change to read:

    $db->perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', $where_clause);

// send email when edited
      zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, 'Customer Account Updates',
      'Text Message about customer has updated customer info for account # ' . $_SESSION['customer_id'] . ' ' . $firstname . ' ' . $lastname, STORE_NAME, EMAIL_FROM);

The second is the Customer Address Book in:
/includes/modules/pages/address_book_process/header_php.php

Find the line:

      $db->perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', $where_clause);

and change to read:

      $db->perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', $where_clause);

// send email when edited
      zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, 'Customer Account Updates',
      'Text Message about customer has updated address book for account # ' . $_SESSION['customer_id'] . ' ' . $firstname . ' ' . $lastname, STORE_NAME, EMAIL_FROM);

You can change the:
SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO

to be a particular email address or use the one set up in your email settings ...

See if that helps to get you started ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

5 Apr 2010, 6:28 PM
#10
orange_juice avatar

orange_juice

Zen Follower

Join Date:
Apr 2009
Location:
Athens, Europe
Posts:
125
Plugin Contributions:
0

Re: Email notification if a customer makes a change to their details?

It was very helpful, thank you indeed.

Kind regards,
orange_juice

http://www.dodeca.eu/
Zen Cart is simply Jamming