Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

extra email on account opening


dahui

Recommended Posts

the php specialsits may gladly correct this little howto, as this if definately from a beginner for beginners only! :-"

 

by default osc is not sending an email to the admin on account opening, only on order placement, presuming in admin 'Send Extra Order Emails To' in mystore configuration is filled with an email address.

 

if so, we could use this address and functionality to receive email on account opening as well.

 

this could be easily done by altering 2 files (for single language + 1 for every additional language)

 

these 2 files are:

catalog/create_account.php

catalog/includes/languages/english/create_account.php

 

let's start with the catalog/create_account.php

search for the code about line 232

// build the message content
     $name = $firstname . ' ' . $lastname;

     if (ACCOUNT_GENDER == 'true') {
        if ($gender == 'm') {
          $email_text = sprintf(EMAIL_GREET_MR, $lastname);
        } else {
          $email_text = sprintf(EMAIL_GREET_MS, $lastname);
        }
     } else {
       $email_text = sprintf(EMAIL_GREET_NONE, $firstname);
     }

     $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
     tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

     tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
   }
 }

 

this will build the mail to customer on account creation

 

we have to add some code to it:

 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
     $email_text2 = EMAIL_TEXT2;
         tep_mail('shopadmin', SEND_EXTRA_ORDER_EMAILS_TO, 'A new account has been created!', $email_text2, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);
     }

 

so what does it do?

      if (SEND_EXTRA_ORDER_EMAILS_TO != '') {

will check of the mail in admin is set or empty

 

if it is set than we will start with a new variable called $email_text2 that will refer to EMAIL_TEXT2, which we will fill later in the language file

      $email_text2 = EMAIL_TEXT2;

 

then the tep_mail function will prceed the email to us with the following parameters:

 tep_mail('shopadmin', SEND_EXTRA_ORDER_EMAILS_TO, 'A new account has been created!', $email_text2, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);

to: shopadmin

to mailaddress: as set in admin for extra order mail

subject: A new account has been created!

content: Variable $email_text2 (we will fill that in langauge file right now)

from: STORE_NAME as set in admin

from mailaddress: STORE_OWNER_EMAIL_ADDRESS as set in admin

 

so the new // build the message content in create_account.php should look like this:

// build the message content
     $name = $firstname . ' ' . $lastname;

     if (ACCOUNT_GENDER == 'true') {
        if ($gender == 'm') {
          $email_text = sprintf(EMAIL_GREET_MR, $lastname);
        } else {
          $email_text = sprintf(EMAIL_GREET_MS, $lastname);
        }
     } else {
       $email_text = sprintf(EMAIL_GREET_NONE, $firstname);
     }

     $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
     tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
     $email_text2 = EMAIL_TEXT2;
         tep_mail('shopadmin', SEND_EXTRA_ORDER_EMAILS_TO, 'A new account has been created!', $email_text2, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);
     }

     tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
   }
 }

 

and now the language file catalog/includes/languages/english/create_account.php

 

just simply add a new define to the existing language file:

define('EMAIL_TEXT2', '

Firstname             :   ' . $firstname . '
Lastname             :   ' . $lastname . '
Date of Birth         :   ' . $dob . '

Address               :   ' . $street_address . '
Postcode              :   ' . $postcode . '
City                     :   ' . $city . '

eMail-Address       :   ' . $email_address . '
Telefonnumber      :   ' . $telephone . '
Telefaxnumber      :   ' . $fax . '

LOGIN                  :   ' . $email_address . '
PASSWORT           :   ' . $password . '
');

no need to explain what you will see in the mail ;)

 

Voila thats it!

 

hope it'll be usefull for at least one of you out there.

any comments, critics, advises, corrections ... welcome, I STILL DO LEARN TOO ;)

 

dahui

Link to comment
Share on other sites

  • 1 month later...
the php specialsits may gladly correct this little howto, as this if definately from a beginner for beginners only! :-"

 

by default osc is not sending an email to the admin on account opening, only on order placement, presuming in admin 'Send Extra Order Emails To' in mystore configuration is filled with an email address.

 

if so, we could use this address and functionality to receive email on account opening as well.

 

this could be easily done by altering 2 files (for single language + 1 for every additional language)

 

these 2 files are:

catalog/create_account.php

catalog/includes/languages/english/create_account.php

 

let's start with the catalog/create_account.php

search for the code about line 232

// build the message content
? ? ?$name = $firstname . ' ' . $lastname;

? ? ?if (ACCOUNT_GENDER == 'true') {
? ? ? ? if ($gender == 'm') {
? ? ? ? ? $email_text = sprintf(EMAIL_GREET_MR, $lastname);
? ? ? ? } else {
? ? ? ? ? $email_text = sprintf(EMAIL_GREET_MS, $lastname);
? ? ? ? }
? ? ?} else {
? ? ? ?$email_text = sprintf(EMAIL_GREET_NONE, $firstname);
? ? ?}

? ? ?$email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
? ? ?tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

? ? ?tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
? ?}
?}

 

this will build the mail to customer on account creation

 

we have to add some code to it:

 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
? ? ?$email_text2 = EMAIL_TEXT2;
? ? ? ? ?tep_mail('shopadmin', SEND_EXTRA_ORDER_EMAILS_TO, 'A new account has been created!', $email_text2, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);
? ? ?}

 

so what does it do?

 ? ? ?if (SEND_EXTRA_ORDER_EMAILS_TO != '') {

will check of the mail in admin is set or empty

 

if it is set than we will start with a new variable called $email_text2 that will refer to EMAIL_TEXT2, which we will fill later in the language file

 ? ? ?$email_text2 = EMAIL_TEXT2;

 

then the tep_mail function will prceed the email to us with the following parameters:

 tep_mail('shopadmin', SEND_EXTRA_ORDER_EMAILS_TO, 'A new account has been created!', $email_text2, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);

to: shopadmin

to mailaddress: as set in admin for extra order mail

subject: A new account has been created!

content: Variable $email_text2 (we will fill that in langauge file right now)

from: STORE_NAME as set in admin

from mailaddress: STORE_OWNER_EMAIL_ADDRESS as set in admin

 

so the new // build the message content in create_account.php should look like this:

// build the message content
? ? ?$name = $firstname . ' ' . $lastname;

? ? ?if (ACCOUNT_GENDER == 'true') {
? ? ? ? if ($gender == 'm') {
? ? ? ? ? $email_text = sprintf(EMAIL_GREET_MR, $lastname);
? ? ? ? } else {
? ? ? ? ? $email_text = sprintf(EMAIL_GREET_MS, $lastname);
? ? ? ? }
? ? ?} else {
? ? ? ?$email_text = sprintf(EMAIL_GREET_NONE, $firstname);
? ? ?}

? ? ?$email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
? ? ?tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

? ? ?if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
? ? ?$email_text2 = EMAIL_TEXT2;
? ? ? ? ?tep_mail('shopadmin', SEND_EXTRA_ORDER_EMAILS_TO, 'A new account has been created!', $email_text2, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);
? ? ?}

? ? ?tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
? ?}
?}

 

and now the language file catalog/includes/languages/english/create_account.php

 

just simply add a new define to the existing language file:

define('EMAIL_TEXT2', '

Firstname ? ? ? ? ? ? : ? ' . $firstname . '
Lastname ? ? ? ? ? ? : ? ' . $lastname . '
Date of Birth ? ? ? ? : ? ' . $dob . '

Address ? ? ? ? ? ? ? : ? ' . $street_address . '
Postcode ? ? ? ? ? ? ?: ? ' . $postcode . '
City ? ? ? ? ? ? ? ? ? ? : ? ' . $city . '

eMail-Address ? ? ? : ? ' . $email_address . '
Telefonnumber ? ? ?: ? ' . $telephone . '
Telefaxnumber ? ? ?: ? ' . $fax . '

LOGIN ? ? ? ? ? ? ? ? ?: ? ' . $email_address . '
PASSWORT ? ? ? ? ? : ? ' . $password . '
');

no need to explain what you will see in the mail ;)

 

Voila thats it!

 

hope it'll be usefull for at least one of you out there.

any comments, critics, advises, corrections ... welcome, I STILL DO LEARN TOO ;)

 

dahui

 

This would be pretty neat. but when I get the email all i get is

 

Firstname :

Lastname :

Date of Birth :

 

Address :

Postcode :

City :

 

Email-Address :

Telephonenumber :

Telefaxnumber :

 

LOGIN :

PASSWORD :

 

 

Blank information

 

Also that and there is nothing in the subject of the e-mail is there a way to add something to where 'New Account Created' is put in the subject?

 

Andy

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...
  • 5 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...