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.p...-mail_-_Format
and this: https://www.zen-cart.com/tutorials/i...hp?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.
Re: Order confirmation email editing
Quote:
Originally Posted by
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.
Re: Order confirmation email editing
Sorry, should have been more specific... I've tried adding fields to the following section:
Code:
$this->products_ordered_attributes .= $custom_insertable_text;
As an example I tried changing it to:
Code:
$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!
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.
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
Re: Order confirmation email editing
For that you were indeed looking at the right section of code ... ie:
Code:
$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']
*
* 2. 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.
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.
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.
Re: Order confirmation email editing
When I searched the Addons section for "software" I found this one which bills itself as somewhat related to what you're talking about, albeit was written for an older ZC version: http://www.zen-cart.com/index.php?ma...oducts_id=1301
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.