X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Enable/Disable Profile Modified Email from Admin (https://forum.x-cart.com/showthread.php?t=2642)

adpboss 05-10-2003 09:31 PM

Enable/Disable Profile Modified Email from Admin
 
This is a mod beyond the reach of my current abilites with X-Cart and could really use some assistance.

I would like to be able to have a check box in the admin side of the Modify User profile. The box would be checked by default to notify the customer of changes to their profile.

I need the option to uncheck the box so that when I do annoying little modifications, like capitalising Street Names or correcting Phone Numbers the customer is not bombarded with emails.

I'm sure a lot of people would find this to be a useful mod. If it already exists please tell me. I searched and searched but was unable to turn anything up.

TIA :)

funkydunk 05-12-2003 09:01 AM

Patch for the database to make the option appear in the general settings:

Code:

INSERT INTO xcart_config VALUES ('modify_emails', 'Modification emails sent', 'Y', 'General', 1000, 'Checkbox');

Then amend include/register.php (version 3.3.5 - line 146
change:

Code:

func_send_mail($newuser_info["email"], "mail/profile_modified_subj.tpl", "mail/profile_modified.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
        func_send_mail($config["Company"]["users_department"], "mail/profile_admin_modified_subj.tpl", "mail/profile_admin_modified.tpl", $newuser_info["email"], true);


to:
Code:

if ($config["General"]["modify_emails"]=="Y"){

func_send_mail($newuser_info["email"], "mail/profile_modified_subj.tpl", "mail/profile_modified.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
func_send_mail($config["Company"]["users_department"], "mail/profile_admin_modified_subj.tpl", "mail/profile_admin_modified.tpl", $newuser_info["email"], true);
}


howzat?

adpboss 05-12-2003 09:06 AM

Funky Dunk.

INSERT INTO xcart_config VALUES ('modify_emails', 'Modification emails sent', 'Y', 'General', 1000, 'Checkbox');

General should be in commas. :)

I do believe I owe you a beer or two.

Drop me an email the next time you are in Canada.

:)

cotc2001 06-05-2003 02:47 AM

And then edit the template to include another checkbox???

hopefully coz I can't see anything appear at the bottom of the general settings page :(

adpboss 06-05-2003 03:15 AM

If you ran the insert statement on your dbase, the checkbox should automatically appear.

cotc2001 06-05-2003 03:55 AM

Ahhh just tried it on a different version (3.3.5) and it worked but in 3.3.3 it doesn't which was the one I wanted to do it on (v.heavy mods so not safe to upgrade).

Anyone know how to do it in 3.3.3 ????

BoomBoomBap 12-14-2003 03:27 PM

I've got this working in 3.4.10
Here are the changes:

Patch for the database to make the option appear in the general settings:
Code:

INSERT INTO xcart_config VALUES ('modify_emails', 'Modification emails sent', 'Y', 'General', 1000, 'Checkbox');

Then amend include/register.php (version 3.4.10 - line 198)

Original
Code:

#
# Send mail to registered user (do not send to anonymous)
#
        if(!$anonymous_user)
                if ($usertype=="B")
                        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_partner_notif.tpl", $config["Company"]["users_department"], false);
                else
                        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_notification.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
        if(!$anonymous_user)
        func_send_mail($config["Company"]["users_department"], "mail/signin_admin_notif_subj.tpl", "mail/signin_admin_notification.tpl", $email, true);


New
Code:

#
# Send mail to registered user (do not send to anonymous)
#
if ($config["General"]["modify_emails"]=="Y"){
        if(!$anonymous_user)
                if ($usertype=="B")
                        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_partner_notif.tpl", $config["Company"]["users_department"], false);
                else
                        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_notification.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
        if(!$anonymous_user)
        func_send_mail($config["Company"]["users_department"], "mail/signin_admin_notif_subj.tpl", "mail/signin_admin_notification.tpl", $email, true);
}


Once this mod is implemented, you will find a new checkbox at the bottom of General Settings in the Admin area. Check the box to enable notifications, leave empty to disable them.

Note: the change to register.php is just adding the "if" statement.

What an amazingly simple and effective mod. Thanks !
:D

nerd luv 05-30-2004 11:34 AM

3.4.14
 
I've got a fresh install of 3.4.14 and neither version of the mod worked for me. The checkbox shows up, but unchecking (or checking) it still results in me receiving e-mails everytime a profile is modified.

Has anyone found a way to use this for 3.4.14? Thank you!

adpboss 05-31-2004 05:03 AM

Nerd Luv,

Works fine on my 3.4.14 site. Perhapsyou should post your code so we can see what the problem is.

This is certainly one for Custom Mods (moderators, hint hint)!

nerd luv 05-31-2004 11:48 AM

OK, here's the entire code for include/register.php
It's all in 1 piece, but I divided it into 3 sections here to indicate the section that I changed. (1st piece of original code removed by request)

Here's the bit I changed:
Code:

#
# Send mail to registered user (do not send to anonymous)
#
if ($config["General"]["modify_emails"]=="Y"){
  if(!$anonymous_user)
      if ($usertype=="B")
        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_partner_notif.tpl", $config["Company"]["users_department"], false);
      else
        func_send_mail($email, "mail/signin_notification_subj.tpl", "mail/signin_notification.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
  if(!$anonymous_user)
  func_send_mail($config["Company"]["users_department"], "mail/signin_admin_notif_subj.tpl", "mail/signin_admin_notification.tpl", $email, true);
}


This is original code at the end
Code:

#
# Auto-log in
#
        #if($anonymous_user && $usertype=="C") {
        if($usertype=="C" or ($usertype=="B" and $login=="")) {
                $auto_login = true;
                $login = $uname;
                $login_type = $usertype;
                $logged = "";
        }

}
        } else {
#
# Fields filled with errors
#
        if ($fillerror) $reg_error="F";
        if ($eerror) $reg_error="E";
        if ($uerror) $reg_error="U";
        }
if($anonymous_user) {
        $uname="";
        $passwd1="";
        $passwd2="";
}
#
# Fill $userinfo array if error occured
#
$userinfo=$HTTP_POST_VARS;
$userinfo["login"] = $uname;
$userinfo["newsletter"] = ($newsletter=="on"?"Y":"");

}
else {
#
# REQUEST_METHOD = GET
#
if ($mode=="update") {
        $userinfo = func_userinfo($login,$login_type);
}
elseif ($mode=="delete" && $confirmed=="Y") {

        $olduser_info = func_userinfo($login,$login_type);

        $customer_language = func_get_language ($olduser_info);

        func_delete_profile($login,$login_type);
        $login="";
        $login_type="";
        $smarty->clear_assign("login");
#
# Send mail notifications to customer department and signed customer
#
        $mail_smarty->assign("userinfo",$olduser_info);

#
# Send mail to registered user
#
        if (strstr($olduser_info["login"], $anonymous_username_prefix) )  $anonymous_user=true;
        else $anonymous_user=false;
        if(!$anonymous_user)
        func_send_mail($olduser_info["email"], "mail/profile_deleted_subj.tpl", "mail/profile_deleted.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
        if(!$anonymous_user)
        func_send_mail($config["Company"]["users_department"], "mail/profile_admin_deleted_subj.tpl", "mail/profile_admin_deleted.tpl", $olduser_info["email"], true);

}
}

#require "../include/countries.php";
#require "../include/states.php";

#$smarty->assign("current_category",$current_category);
if ($uerror || $eerror || $fillerror || $error) {
        $userinfo[firstname]=stripslashes($firstname);
        $userinfo[lastname]=stripslashes($lastname);
        $userinfo[company]=stripslashes($company);
        $userinfo[ssn]=stripslashes($ssn);
        $userinfo[b_address]=stripslashes($b_address);
        $userinfo[b_city]=stripslashes($b_city);
        $userinfo[b_state]=stripslashes($b_state);
        $userinfo[b_zipcode]=stripslashes($b_zipcode);
        $userinfo[s_address]=stripslashes($s_address);
        $userinfo[s_city]=stripslashes($s_city);
        $userinfo[s_state]=stripslashes($s_state);
        $userinfo[s_zipcode]=stripslashes($s_zipcode);
        $userinfo[phone]=stripslashes($phone);
        $userinfo[fax]=stripslashes($fax);
        $userinfo[uname]=stripslashes($uname);
        $userinfo[login]=stripslashes($uname);
        $userinfo[passwd1]=stripslashes($passwd1);
        $userinfo[passwd2]=stripslashes($passwd2);
        $userinfo[password_hint]=stripslashes($password_hint);
        $userinfo[password_hint_answer]=stripslashes($password_hint_answer);
        }

if ($userinfo)
foreach ($userinfo as $key=>$value){
        if (is_string($value))
                $userinfo[$key]=htmlspecialchars($value);
}
$smarty->assign("userinfo",$userinfo);
$smarty->assign("registered",$registered);
$smarty->assign("reg_error",$reg_error);

if($mode=="delete") {
        $smarty->assign("main","profile_delete");
}
elseif($mode=="notdelete") {
        $smarty->assign("main","profile_notdelete");
}
else
        $smarty->assign("main","register");

x_session_save();       
?>


Thoughts, anyone? Is there something else I need to modify?

adpboss 05-31-2004 02:47 PM

Please don't post all of the code. I am getting a headache trying to look at it. Just post the relevant stuff. Because you posted all of that the page displays so wide that it is crazy. Please go back and delete all of the extra cr@p.

You are modding the wrong code. You have modded a different area of the file. Go back and look at the code in the examples above.

Around line 158-160 ish. That's where the change needs to happen. There are a lot of lines that are similar, so you need to read what you are changing.

Look for this line in your file and then you will have the correct area.

#
# Send mail to registered user
#
$customer_language = func_get_language ($newuser_info["language"]);

nerd luv 05-31-2004 03:32 PM

Originally I cut and pasted the examples at the top, which is how I eliminate the possibility of me messing up the new code. I searched for the "original code" posted by BoomBoomBap in register.php , and there was only 1 instance, so that is what I replaced with his new code.

The portion of original code that starts with
Code:

$customer_language = func_get_language ($newuser_info["language"]);
was not mentioned prior to your last post so I was unaware that this code needed to be changed. I searched for this and added the new if statement so starting at line 156 I now have

Code:

#
# Send mail to registered user
#
        $customer_language = func_get_language ($newuser_info["language"]);

if ($config["General"]["modify_emails"]=="Y"){

        func_send_mail($newuser_info["email"], "mail/profile_modified_subj.tpl", "mail/profile_modified.tpl", $config["Company"]["users_department"], false);
#
# Send mail to customers department
#
        func_send_mail($config["Company"]["users_department"], "mail/profile_admin_modified_subj.tpl", "mail/profile_admin_modified.tpl", $newuser_info["email"], true);}


which seems to have done the trick. Modified a profile and neither the client nor the administrator received an e-mail. Whew.

nerd luv 06-15-2004 05:58 PM

:oops: Me again!

I am just setting up 3.5.8 and today I noticed that when a customer profile is modified, I don't see the confirmation message. $txt_profile_modified is defined (still at the default "Your profile has been modified."), and skin1/customer/main/register.tpl still calls is with
Code:

{if $smarty.post.mode eq "update" or $smarty.get.mode eq "update"}
{$lng.txt_profile_modified}


Register.php and register.tpl are the only files that would control this, right? The only editing I have done to either is the change above. Has anyone else noticed this?

adpboss 06-15-2004 06:00 PM

Do you have the emails enabled or disabled?

nerd luv 06-15-2004 06:16 PM

They are disabled. It would just be too much e-mail to recieve them, but I'm sure you relate as we're both using this mod!

EDIT: I tried deselecting this option, but the confirmation message still does not appear on the page. Additionally, the confirmation e-mails are blank except for the title.

Also, note that I am now trying this in version 3.5.8. I originally got it working fine in 3.4.14, but 3.5.8 is where I'm finding all these issues.

Wizard 07-08-2004 05:20 PM

Quote:

Originally Posted by funkydunk
Code:

INSERT INTO xcart_config VALUES ('modify_emails', 'Modification emails sent', 'Y', 'General', 1000, 'Checkbox');


Can anyone direct me to where I can read up on how to insert stuff into a MySql database? I do not see a command line in my program to do this...

Mike

adpboss 07-08-2004 05:53 PM

What version are you using please? It should be in your forum signature.

Wizard 07-08-2004 09:48 PM

Sorry Adpboss, I have added the information into my signature as you have requested.

adpboss 07-08-2004 09:55 PM

Cool. That makes it easier to answer your questions because each point release 3.X is different than the last.

In the admin you can go to patch/upgrade and enter it into the Apply SQL Patch, Queries box.

Please do a FULL backup of your database before attempting this.

If the database patches then you are laughing. This is an easy and excellent mod. They included similar email mods in the 4.0 beta.

There is no reason why it shouldn't patch but if you have a problem, just post back here again! :D

Wizard 07-09-2004 01:40 PM

I am feeling real stupid here.... with my old cart I was a wiz and was helping everyone out in the forums and here I cant even keep my head above water.

I tried going into Patch/Upgrade and tried to make this happen and it told me it succesfully did it and I do not see this anywhere in the general setting area.

Help Please...

adpboss 07-09-2004 01:58 PM

I'll help you in a bit. Go relax and have a beer or something.

We'll get through this.

adpboss 07-09-2004 04:04 PM

OK, with version 3.5.x the patch needs to be changed.

Backup backup backup because I am not responsible if you run into a problem, ok?

Run this SQL Query to remove the previous sql query you applied.

Quote:

DELETE FROM xcart_config WHERE name='modify_emails';

Then apply this patch.

Code:

INSERT INTO `xcart_config` VALUES ('modify_emails', 'Enable email notifications for User Account Modifications', 'Y', 'Email', 100, 'checkbox', 'N');

You can find the checkbox and item in your General Settings, under the email subcategory.

Good luck.

Wizard 07-09-2004 05:50 PM

Ok that is working I now see the message with the checkbox.... Thank you Adpboss for sending me to this thread in the first place and sticking it out withme to make sure it came through... I really appreciate it....

Now I do not want to get off topic but you say backup backup backup... I went into backup and clicked the box that said "Write SQL dump to file......" and then saved that file on my harddrive.... Now it is telling me that the dump file is 11megs... I am assuming because it has all my pictures in there BUT it only lets you restore a backup of 2 megs or less... so how does one accomplish restoring a backup?

adpboss 07-09-2004 06:06 PM

This is totally off topic so I'll make it short and sweet. After that you'll have to start your own thread.

What server software are you using? Is PHPMyAdmin installed? I prefer to backup from CPanel and have been lucky that I have not had to make any full restores to date. You could also use PHPMyAdmin.

Personally I never backup from within X-Cart.

Take your images out of the database. Your backups will be faster and easier to restore. Use the filesystem to store your images. You can search the forums for info on "Image Location".

Best of luck. The info is all here, you just might have to spend an evening searching it out.

Wizard 07-09-2004 06:17 PM

Thank you... I will spend some time searching... and I agree didnt want to take it to far off topic thank you

adpboss 07-09-2004 08:07 PM

Updated Mod for 3.5.9

The include/register.php needs to be different if you are using my SQL Query (posted above and in this post).

This change happens around line 190 of include/register.php for version 3.5.9.

Code:

        #
        # Send mail to registered user
        # ADP Modification
                $customer_language = func_get_language ($newuser_info["language"]);
        if ($config["Email"]["modify_emails"]=="Y"){
                func_send_mail($newuser_info["email"], "mail/profile_modified_subj.tpl", "mail/profile_modified.tpl", $config["Company"]["users_department"], false);
        #
        # Send mail to customers department
        #
                func_send_mail($config["Company"]["users_department"], "mail/profile_admin_modified_subj.tpl", "mail/profile_admin_modified.tpl", $newuser_info["email"], true);}
        }

I always add ADP Modification in the comments so I can find my changes later. You should add your own note unless you copy all my mods and are a disciple. ;)

Note that the if statement is now

Code:

if ($config["Email"]["modify_emails"]=="Y")
$config[email] is necessary based on my SQL Insert Query


You also need to run this Insert query on your database. It can be done from the Patch/Upgrade area of the admin (SQL QUERY).

Code:

INSERT INTO `xcart_config` VALUES ('modify_emails', 'Enable email notifications for User Account Modifications', 'Y', 'Email', 100, 'checkbox', 'N');

That will place the checkbox in the General Settings/Email Options.

Thanks to FunkyDunk for the original help. This mod will be redundant in version 4.0 I believe but is very handy for version 3.5, 3.4 and 3.3

Happy X-Carting!

phil_ 08-03-2004 02:09 AM

I just applied the patch (the above post) and it worked straight off on my 3.5.10 installation - great mod guys!

Thanks to all who contributed, Philip.


All times are GMT -8. The time now is 09:34 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.