If this is your first visit, check our documentation. To post, register or login.
Forums / Managing Customers and Orders / Add field into order success email - code not working

Add field into order success email - code not working

Started by lightup on 22 Jan 2013, 3:20 PM · Views: 1,034

Results 1 to 5 of 5
22 Jan 2013, 3:20 PM
#1
lightup avatar

lightup

New Zenner

Join Date:
Sep 2010
Posts:
59
Plugin Contributions:
0

Add field into order success email - code not working

Hi guys,

I am trying to add the customer login email address to the top of the the order success email.

Currently the customer login email is in the footer under the "office use only" section.

I have attempted to code it in just under the $EMAIL_FIRST_NAME $EMAIL_LAST_NAME, section of the email.

What I have tried thus far:

Under classes/order.php I have added the line in red:

$html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname'];
$html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname'];
$html_msg['EMAIL_CUSTOMER_EMAIL'] = $this->customer['login_email'];

Within the email/email_template_checkout.html I have added the following in red:

$EMAIL_FIRST_NAME $EMAIL_LAST_NAME,<br />
$EMAIL_CUSTOMER_EMAIL<br />

However when checking the success order email nothing is showing.

If someone could assist me it would be much appreciated.

Thanks,

Elliot

22 Jan 2013, 7:06 PM
#2
drbyte avatar

drbyte

Sensei

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

Re: Add field into order success email - code not working

In the order class, the customer's email address is found in $this->customer['email_address']. 'login_email' won't exist. Hence seeing nothing.

.
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.

22 Jan 2013, 7:38 PM
#3
lightup avatar

lightup

New Zenner

Join Date:
Sep 2010
Posts:
59
Plugin Contributions:
0

Re: Add field into order success email - code not working

DrByte:

In the order class, the customer's email address is found in $this->customer['email_address']. 'login_email' won't exist. Hence seeing nothing.

Thank you for your speedy reply! I had also tried using the 'email_address' but this showed nothing. I looked at the bottom of the email and found this:

Office Use Only:
From:
Email:
Login Name: Test na
Login Email: [email protected]
Telephone: 0123456789
IP Address:
Host Address:
Date and Time: Tue Jan 22 2013 18:10:06 UTC

I saw that the "From" and "Email" were blank so assumed that this is why your suggestion may not have worked thus me trying to utilise the 'login_email' which i found through developers tool kit (obviously didn't work lol)

So even with this change:

$html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname'];
$html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname'];
$html_msg['EMAIL_CUSTOMER_EMAIL'] = $this->customer['email_address'];

The email address is still not showing up, is there anything I am missing?

Thanks.

22 Jan 2013, 7:54 PM
#4
drbyte avatar

drbyte

Sensei

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

Re: Add field into order success email - code not working

These changes you're making will only work for HTML-formatted emails. They will have no effect on text-only emails.

Plus, $EMAIL_TO_ADDRESS is already generally available, so isn't really necessary to set up $EMAIL_CUSTOMER_EMAIL for that.
So, in your email template file, use $EMAIL_TO_ADDRESS instead

For TEXT-ONLY emails, you'd need to remove your other changes from order.php and change this instead://intro area $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" .to```
//intro area
$email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" .
$this->customer['email_address'] . "\n\n" .
EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" .

.
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.

22 Jan 2013, 8:24 PM
#5
lightup avatar

lightup

New Zenner

Join Date:
Sep 2010
Posts:
59
Plugin Contributions:
0

Re: Add field into order success email - code not working

Absolutely fantastic help as always.

Thank you very much.

My final solution was:

$this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n" . $this->customer['email_address'] . "\n\n" .