Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Order confirmation email editing

Order confirmation email editing

Views: 1,910

Results 1 to 13 of 13
19 Apr 2012, 1:28 AM
#1
daviator avatar

daviator

New Zenner

Join Date:
Mar 2012
Posts:
26
Plugin Contributions:
0

Order confirmation email editing

Hello,
I have seen several posts, tutorials and wiki entries on editing the order email but I cannot make it work.

Here is what I need to do:
Email to customer can stay as-is (HTML)
Email to Admin needs to be plain text (and it is set to TEXT in the Configuration).

I then need the order emails to the admin to look something like the following:

Order Date: April 11, 2012 14:48:01
first: Joe
last: Blow
addr1: 123 Any Street
addr2: Apt 6A
city: Honor
etc.
etc.

But each time I try to add fields nothing changes (unless I forget a ; then it breaks) and the emails look exactly like the customer emails.

I have read this: http://www.zen-cart.com/wiki/index.php/Customisation_-_E-mail_-_Format

and this: https://www.zen-cart.com/tutorials/index.php?article=113

But no joy...

My client has a system that takes the inbound emails, gathers the data and then if needed, emails out a download link and software key as some of their products are downloadable.

I know this should be a snap but I have very little hair left after trying for days.

Any ideas would be greatly appreciated.

19 Apr 2012, 2:44 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: Order confirmation email editing

Daviator:

But each time I try to add fields nothing changes (unless I forget a ; then it breaks) and the emails look exactly like the customer emails.
Specifics about what exactly you're doing (ie: the part you say isn't working) would help us help you understand what you're doing incorrectly.

19 Apr 2012, 12:35 PM
#3
daviator avatar

daviator

New Zenner

Join Date:
Mar 2012
Posts:
26
Plugin Contributions:
0

Re: Order confirmation email editing

Sorry, should have been more specific... I've tried adding fields to the following section:

 $this->products_ordered_attributes .= $custom_insertable_text;

As an example I tried changing it to:

$this->products_ordered_attributes .= $EMAIL_FIRST_NAME;

But nothing changes on my emails. I know enough about PHP to be dangerous. But I can usually copy, paste, move and comment out code. I.e. rearranged items on my product info page.

Thanks again!

19 Apr 2012, 5:48 PM
#4
drbyte avatar

drbyte

Sensei

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

Re: Order confirmation email editing

Is the need here specifically to send out license keys?
Or is there actually something more than that which needs to be accomplished?

The license-key-generation-and-sending can be built-in so that there's no need to have an external system parse the info and send out keys.

19 Apr 2012, 6:03 PM
#5
daviator avatar

daviator

New Zenner

Join Date:
Mar 2012
Posts:
26
Plugin Contributions:
0

Re: Order confirmation email editing

I believe it's just to send out keys if need as some products are actual boxed CDs.

I looked and didn't see a way (or plug-in) to send out keys automatically after a purchase so if you know if a way that would be awesome!

Thanks!
David

19 Apr 2012, 6:34 PM
#6
drbyte avatar

drbyte

Sensei

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

Re: Order confirmation email editing

For that you were indeed looking at the right section of code ... ie: ```
$this->notify('NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS', $custom_insertable_text);

/* START: ADD MY CUSTOM DETAILS

    1. calculate/prepare custom information to be added to this product entry in order-confirmation, perhaps as a function call to custom code to build a serial number etc:
  • Possible parameters to pass to custom functions at this point:
  • Product ID ordered (for this line item): $this->products[$i]['id']
    
  • Quantity ordered (of this line-item): $this->products[$i]['qty']
    
  • Order number: $zf_insert_id
    
  • Attribute Option Name ID: (int)$this->products[$i]['attributes'][$j]['option_id']
    
  • Attribute Option Value ID: (int)$this->products[$i]['attributes'][$j]['value_id']
    
  • Attribute Filename: $attributes_values->fields['products_attributes_filename']
    
    1. Add that data to the $this->products_ordered_attributes variable, using this sort of format:
  •  $this->products_ordered_attributes .=  {INSERT CUSTOM INFORMATION HERE};
    

*/

$this->products_ordered_attributes .= $custom_insertable_text;

/* END: ADD MY CUSTOM DETAILS */


Specifically, you'll want to write an observer class to monitor the NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS notifier and have it do the license key lookup and return the license code so it can be automatically inserted into the email along with the specific product's information.
There are several forum threads discussing this, and maybe even some addons which use this and might serve as examples for you.
19 Apr 2012, 7:04 PM
#7
daviator avatar

daviator

New Zenner

Join Date:
Mar 2012
Posts:
26
Plugin Contributions:
0

Re: Order confirmation email editing

Hello DrByte,
I'd be happy to write "an observer class to monitor the NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS notifier and have it do the license key lookup and return the license code so it can be automatically inserted into the email along with the specific product's information." if I had a clue on how to do this. :)

Thanks and I will browse the threads but last time I checked (a couple of weeks ago) not much was written on how to actually pull this off. Nor could I find a plugin that does it.

19 Apr 2012, 11:22 PM
#8
daviator avatar

daviator

New Zenner

Join Date:
Mar 2012
Posts:
26
Plugin Contributions:
0

Re: Order confirmation email editing

I see a few threads that say it's "possible" but most of them only link back to each other as a reference and none mention how to actually do it. A search of free and commercial plugins was fruitless.

Hence my original question on how to edit the inbound emails for my clients existing systems.

20 Apr 2012, 1:13 PM
#10
daviator avatar

daviator

New Zenner

Join Date:
Mar 2012
Posts:
26
Plugin Contributions:
0

Re: Order confirmation email editing

I tried it on a test site and it's not working with zencart 1.5. Therefore I'd like to go back to my original post and see if anyone has an idea as to why the added fields are not appearing.

20 Apr 2012, 3:00 PM
#11
daviator avatar

daviator

New Zenner

Join Date:
Mar 2012
Posts:
26
Plugin Contributions:
0

Re: Order confirmation email editing

I have tried and tried to edit the order.php file to change the plain text content that is emailed with an order. No matter what I add no changes occur to my incoming emails.

I have added several new variables to the email_extras.php file including the sample below:

define('FIRST_NAME_C','first:');

I have then tried adding it (and existing variables) to the includes/classes/order.php file but it (or any other variable ever appear in my emails):

I tried like this: (line 894ish)

$this->products_ordered_attributes .= $custom_insertable_text;
$EMAIL_FFIRST_NAME_C;

And like this:

$this->products_ordered_attributes .= $EMAIL_FFIRST_NAME_C;

I've read all I could in this forum, in the wiki, in the tutorials and via Google but I'm beginning to think that it's just broken. (Sorry for a new thread on this but my old one got diverted down a dead-end path).

20 Apr 2012, 5:59 PM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Order confirmation email editing

Having all the posts in one place would keep this thread from going down the same path. I have been trying to edit aspects of admin copies of order confirmation and contact e-mails also, with some success and some failure.

20 Apr 2012, 7:51 PM
#13
daviator avatar

daviator

New Zenner

Join Date:
Mar 2012
Posts:
26
Plugin Contributions:
0

Re: Order confirmation email editing

My other thread was diverted due to the reason I wanted to edit the email. Hence the reason it's not mentioned here. I truly think that it was "broken" along the way as the instructions I keep reading are for a much older version than 1.5. I've also seen responses like "OH yeah, you can do that.".... OK... but how (besides linking me back to the tutorial that doesn't work)