Zen Cart Logo
Forums / General Questions / 2 different format for confirmation email

2 different format for confirmation email

Locked

Views: 3,894

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
14 Jun 2008, 11:33 AM
#1
ks_b avatar

ks_b

New Zenner

Join Date:
Dec 2007
Posts:
52
Plugin Contributions:
0

2 different format for confirmation email

hi,

is it possible to have 2 different format of confirmation email? One that send to customer different to one that send to admin.

I want to do this because i want to make email that send to admin to be short and easy to read and take out all the unused information but i want to retain it on customer email.

I understand that i have to edit includes\classes\order.php
and i am thinking of just clone some section of code that use to contract and send email and instead of sending it to both customer and admin, just make it send seperately... not sure if that possible.

Please give me some suggestion of how to go doing this.

i am not sure which code actually use to send email to customer and admin i assume it is

zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);

thanks

14 Jun 2008, 1:01 PM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: 2 different format for confirmation email

Instead of going the route you're on, download the SMS on Sale contribution and modify it. This does what you're trying to do without modifying core files that will have to be maintained release after release.

14 Jun 2008, 2:06 PM
#3
ks_b avatar

ks_b

New Zenner

Join Date:
Dec 2007
Posts:
52
Plugin Contributions:
0

Re: 2 different format for confirmation email

ok i have a look into that.. thanks :smile:

14 Jun 2008, 4:04 PM
#4
ks_b avatar

ks_b

New Zenner

Join Date:
Dec 2007
Posts:
52
Plugin Contributions:
0

Re: 2 different format for confirmation email

emm this seem to be a bit too hard for me as i am new to php...

I understand that i have to edit class.msg_owner.php

$email_text = $order->customer['firstname'] . " " .  $order->customer['lastname'] . "\n" . $order->info['total'] . "\n" .  . "\n\n";

and add more information into that line... but i am not sure how to call all the information i want.. I want to have

Name
email
Phone

Products in that order & total like in normal conformation email

Delivery Address

Payment Methods

I don't know how to call all this information... do i have to executes query to get information from database first??

"$order->customer['lastname']" how does php actaully know where to look for this?

please give me a bit more help with php thanks a lot...

14 Jun 2008, 7:23 PM
#5
ks_b avatar

ks_b

New Zenner

Join Date:
Dec 2007
Posts:
52
Plugin Contributions:
0

Re: 2 different format for confirmation email

ok i managed to do everything i wanted now with code

function update(&$callingClass, $eventID) {
       if (!$this->messages_desired()) return;
       global $order;
        
       $email_text = "Name:  " . $order->customer['firstname'] . " " .  $order->customer['lastname'] . "\n" .
                     "Email:  " . $order->customer['email_address'] . "\n" .
                     "Telephone:  " . $order->customer['telephone'] . "\n\n" .

                     EMAIL_TEXT_PRODUCTS .   "\n" .
                     EMAIL_SEPARATOR . "\n" .
                     $order->products_ordered .
                     EMAIL_SEPARATOR . "\n"   .
                     "Sub-Total: " . $order->info['subtotal']  . "\n"   .
                     $order->info['shipping_method']  . ": " . $order->info['shipping_cost'] . "\n"   .
                     "Total: " . $order->info['total'] . "\n\n" .

                     $order->info['comments']   . "\n\n" ;

                     if( $order->info['shipping_method'] != "Takeaway Pickup (Store Pickup)") {
                     $email_text .= EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
                                    EMAIL_SEPARATOR . "\n" .
                                    $order->delivery['street_address']  . " " .  $order->delivery['suburb']  . "\n" .
                                    $order->delivery['city'] . ", " .  $order->delivery['postcode']  . "\n\n" ;
                     }

      $email_text .= EMAIL_TEXT_PAYMENT_METHOD  . "\n" .
                     EMAIL_SEPARATOR . "\n" .
                     $order->info['payment_method'] ;

       $empty_block = array('NOTHING' => 'NADA');
       zen_mail('Shop Owner', $this->owner_phone, "NEW ORDER " . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $empty_block, "msg_owner",'');
   }

except one thing i can't do is that i can't get order number to display in subject line.

I tried
zen_mail('Shop Owner', $this->owner_phone, "NEW ORDER " . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_text, STORE_NAME, EMAIL_FROM, $empty_block, "msg_owner",'');

but doesn't work..

please help thanks

15 Jun 2008, 3:26 PM
#6
ks_b avatar

ks_b

New Zenner

Join Date:
Dec 2007
Posts:
52
Plugin Contributions:
0

Re: 2 different format for confirmation email

anyone??