Zen Cart Logo
Forums / General Questions / Send additional registration info to admin create account email - create_account.php

Send additional registration info to admin create account email - create_account.php

Views: 5,620

Results 1 to 6 of 6
26 Sep 2011, 8:42 AM
#1
buddyh avatar

buddyh

New Zenner

Join Date:
Aug 2010
Location:
London
Posts:
21
Plugin Contributions:
0

Send additional registration info to admin create account email - create_account.php

Hi,
I have added some extra fields to the registration process on my stoer and added the corresponding columns in my db. Everything works very nicely, however I am trying to get the extra data sent to the admin create account email when new users sign up.

I can see from the emails I am getting that I am hacking the right part of the create_account.php file, I am clearly just not understanding what the code is doing. Here's what I have..

// send additional emails

    if (SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_STATUS == '1' and SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO !='') {

      if ($_SESSION['customer_id']) {

        $account_query = "select customers_firstname, customers_lastname, customers_email_address, customers_telephone, customers_mobile, customers_fax, customers_qualified_unqualified, customers_how_long, customers_academy_details, customers_qualifications, customers_products_used

                            from " . TABLE_CUSTOMERS . "

                            where customers_id = '" . (int)$_SESSION['customer_id'] . "'";



        $account = $db->Execute($account_query);

      }

 // ######################  ADDITIONAL CUSTOMER INFORMATION SENT TO EMAIL NOTIFICATION #################### //
      $extra_info=email_collect_extra_info($name,$email_address,$telephone,$mobile,$qualified,$how_long,$academy_details,$qualifications,$products_used,$fax, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_mobile'], $account->fields['customers_qualified_unqualified'],  $account->fields['customers_how_long'],  $account->fields['customers_academy_details'],  $account->fields['customers_qualifications'],  $account->fields['customers_products_used'],  $account->fields['customers_fax']);

      $html_msg['EXTRA_INFO'] = $extra_info['HTML'];

      if (trim(SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT) != 'n/a') zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT . ' ' . EMAIL_SUBJECT,

      $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'welcome_extra');

    } //endif send extra emails
3 Oct 2011, 8:31 AM
#2
buddyh avatar

buddyh

New Zenner

Join Date:
Aug 2010
Location:
London
Posts:
21
Plugin Contributions:
0

Re: Send additional registration info to admin create account email - create_account.php

Can anyone help me with this? I'm having a little trouble understanding what this code is doing.

Thanks :)

27 Jul 2012, 2:03 PM
#3
twistafix avatar

twistafix

New Zenner

Join Date:
Jun 2012
Posts:
13
Plugin Contributions:
0

Re: Send additional registration info to admin create account email - create_account.php

BuddyH:

Can anyone help me with this? I'm having a little trouble understanding what this code is doing.

Thanks :)

Hi Buddy, I know it's a while since you posted this, but I just stumbled upon it looking to do the same thing. Did you get it working? You did not say what the problem with it was, I have a limited understanding of php, but I think I can see a potential problem in your code.

$extra_info=email_collect_extra_info($name,$email_address,$telephone,$mobile,$qualified,$how_long,$academy_details,$qualifications,$products_used,$fax, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_mobile'], $account->fields['customers_qualified_unqualified'],  $account->fields['customers_how_long'],  $account->fields['customers_academy_details'],  $account->fields['customers_qualifications'],  $account->fields['customers_products_used'],  $account->fields['customers_fax']); 

I think the above should be written as

$extra_info=email_collect_extra_info($name,$email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_mobile'], $account->fields['customers_qualified_unqualified'],  $account->fields['customers_how_long'],  $account->fields['customers_academy_details'],  $account->fields['customers_qualifications'],  $account->fields['customers_products_used'],  $account->fields['customers_fax']); 

I've not tried this with my own code yet but will be looking into it so will check back once I have.

9 Aug 2012, 7:41 PM
#4
twistafix avatar

twistafix

New Zenner

Join Date:
Jun 2012
Posts:
13
Plugin Contributions:
0

Re: Send additional registration info to admin create account email - create_account.php

twistafix:

Hi Buddy, I know it's a while since you posted this, but I just stumbled upon it looking to do the same thing. Did you get it working? You did not say what the problem with it was, I have a limited understanding of php, but I think I can see a potential problem in your code.

$extra_info=email_collect_extra_info($name,$email_address,$telephone,$mobile,$qualified,$how_long,$academy_details,$qualifications,$products_used,$fax, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_mobile'], $account->fields['customers_qualified_unqualified'], $account->fields['customers_how_long'], $account->fields['customers_academy_details'], $account->fields['customers_qualifications'], $account->fields['customers_products_used'], $account->fields['customers_fax']);

> 
> I think the above should be written as
> 
> ```php
$extra_info=email_collect_extra_info($name,$email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_mobile'], $account->fields['customers_qualified_unqualified'],  $account->fields['customers_how_long'],  $account->fields['customers_academy_details'],  $account->fields['customers_qualifications'],  $account->fields['customers_products_used'],  $account->fields['customers_fax']); 

I've not tried this with my own code yet but will be looking into it so will check back once I have.

Well, I have tried what I suggested above and the extra field info is not included in the email sent to admin. Just to clarify, the file being edited is

includes/modules/MY_TEMPLATE/create_account.php

I also added wholesale_extrafield to the section of code above the part we are talking about, so that it now looks like this

$account_query = "select customers_firstname, customers_lastname, customers_email_address, customers_telephone, customers_fax, wholesale_extrafield
                            from " . TABLE_CUSTOMERS . "
                            where customers_id = '" . (int)$_SESSION['customer_id'] . "'";

        $account = $db->Execute($account_query);

but it makes no difference.

Does anyone have any ideas how to include the extra information in the email sent to the admin upon account creation?

Thanks :)

9 Aug 2012, 7:58 PM
#5
drbyte avatar

drbyte

Sensei

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

Re: Send additional registration info to admin create account email - create_account.php

No. There's a lot more to merely using the email_collect_extra_info() function than just stuffing more parameters onto the end of it.

Try adding a new line like this instead, still in the create_account.php file:```
$extra_info=email_collect_extra_info($name,$email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_fax']);
[B]$extra_info['TEXT'] .= "\n" . 'Wholesale: ' . $account->fields['wholesale_extrafield'];[/B]

9 Aug 2012, 8:57 PM
#6
twistafix avatar

twistafix

New Zenner

Join Date:
Jun 2012
Posts:
13
Plugin Contributions:
0

Re: Send additional registration info to admin create account email - create_account.php

DrByte:

No. There's a lot more to merely using the email_collect_extra_info() function than just stuffing more parameters onto the end of it.

Try adding a new line like this instead, still in the create_account.php file:```
$extra_info=email_collect_extra_info($name,$email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_fax']);
[B]$extra_info['TEXT'] .= "\n" . 'Wholesale: ' . $account->fields['wholesale_extrafield'];[/B]


DrByte, that worked perfectly, thank you :smile:

I can see from your suggestion where I was going wrong, and also that I need to check the how the functions work before trying to mess with them lol

Thanks again :smile: