Forums / Addon Payment Modules / Can I send extra emails based on payment method?

Can I send extra emails based on payment method?

Started by joyjoy on 16 May 2012, 8:00 AM · Views: 3,891

Results 1 to 20 of 37
16 May 2012, 8:00 AM
#1
joyjoy avatar

joyjoy

Totally Zenned

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

Can I send extra emails based on payment method?

Hi, can someone help and direct me on this. I'm trying to create a different order confirmation email for orders that are paid using specific payment methods such as bank transfer, money gram, western union.

Is there a way to have a 2nd automated email that's sent out based on the payment module? Any help is appreciated. I've seen a older post on this but there was not follow up so I'm not sure how it worked out.

I'm also using Mailbeez but I can't figure out how to incorporate this into that system. Thank you!

16 May 2012, 2:14 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I send extra emails based on payment method?

In the order class file:
/includes/classes/order.php

down near the bottom of the file you will see:

    // send additional emails

You could add your own conditions for additional emails based on the Payment module used ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 May 2012, 3:00 PM
#3
Join Date:
Jul 2010
Location:
Findon, UK
Posts:
90
Plugin Contributions:
0

Re: Can I send extra emails based on payment method?

Ajeh,

I have had long look at /includes/classes/order.php as I want to change the word "delivered" in the standard email that are sent out when you change an order from "processed" to "delivered". However, I haven't been able to find what to change.
Can you help ?
many thanks in advance.

Kim

16 May 2012, 3:08 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I send extra emails based on payment method?

The Order Statuses are set on the Payment Modules ... go to Modules ... Payment ... and edit the Payment Module(s) you want changed ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 May 2012, 5:18 PM
#5
Join Date:
Jul 2010
Location:
Findon, UK
Posts:
90
Plugin Contributions:
0

Re: Can I send extra emails based on payment method?

I wish it was that simple. However, I can't see "delivered" in any of the payments modules I'm using. I've also tried to search for "delivered" in "Developers Tool kit" but can't see which files I need to edit. I want to change the "delivered" to "posted" as customers get confused when they receive an confirmation mail with the word "delivered" and haven't received what they have ordered.

16 May 2012, 5:27 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I send extra emails based on payment method?

To change the text for the Order Statuses ... go to the Localization ... Order Status ... and you can change it on there ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 May 2012, 7:32 PM
#7
Join Date:
Jul 2010
Location:
Findon, UK
Posts:
90
Plugin Contributions:
0

Re: Can I send extra emails based on payment method?

Blimey, you were right. It is that simple. Many, many thanks. I have actually bought Zencart Ebook (and read it) and been through they first 10 php-files to see if I could change it there. Great. Thanks again. (and I feel a bit stupid not finding that menu myself).

16 May 2012, 10:11 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I send extra emails based on payment method?

Give yourself time and you will learn all of the handy dandy built in features of Zen Cart ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 May 2012, 10:29 PM
#9
joyjoy avatar

joyjoy

Totally Zenned

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

Re: Can I send extra emails based on payment method?

Hi Ajeh, thank you for the tip on the orders.php configuration. However...I'm still struggilng. I'm having a hard time figuring out where one processing function ends and another one begins. I've never worked on something as complex as this and I really don't know where to start. Do you know if there's any tutorial about this or if you're able to give me some of your time it would be appreciated. I've searched the forums and although there have been other posts, solutions/follow ups are never posted. Thank you.

17 May 2012, 3:56 AM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I send extra emails based on payment method?

Can you be specific on what it is you are trying to do? :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

17 May 2012, 7:41 AM
#11
joyjoy avatar

joyjoy

Totally Zenned

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

Re: Can I send extra emails based on payment method?

I have installed a Money Gram and Western Union payment method. I would like the instructions on making a Money Gram or Western Union payment to be sent out to the customer after the order confirmation email is sent. I am just not sure how to create this action. I haven't had any luck so far. Thank you.

17 May 2012, 12:40 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I send extra emails based on payment method?

You could add to the order.php class file the code in RED:

// bof: add Payment method content
switch(true) {
  case ($this->info['payment_module_code'] == 'moneyorder'):
    $email_order .= 'Money Order Text Here!' . "\n";
    break;
  case ($this->info['payment_module_code'] == '    paypalwpp'):
    $email_order .= 'PayPal Express Text Here!' . "\n";
    break;
  default:
    $email_order .= 'NO CLUE ON PAYMENT';
    break;
}
// eof: add Payment method content

    // include disclaimer
```And you will need to do that again every time you upgrade.

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

19 May 2012, 1:27 AM
#13
joyjoy avatar

joyjoy

Totally Zenned

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

Re: Can I send extra emails based on payment method?

Hello again, thank you for your help. The code you helped me with will insert a little blurb into the order confirmation email. I am looking into sending an additional email that is generated based on the payment module selected. I've modified the order confirmation email to reflect payment info in the past but many customers have overlooked it. I think having an email sent with payment details and a defined subject would be the solution to the problem. Can you suggest what to change in the Send additional emails command on the order.php? Please. Thank you again. You're always so helpful.

19 May 2012, 1:41 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I send extra emails based on payment method?

For sending an additional email for each Payment method ...

Add the code in RED:

      zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
      $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);

// bof: send extra email based on Payment
switch(true) {
  case ($this->info['payment_module_code'] == 'moneyorder'):
    zen_mail('', 'testmoneyorder@your_domain_name.com', SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
    $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
    break;
  case ($this->info['payment_module_code'] == 'paypalwpp'):
    zen_mail('', 'testpaypalexpress@your_domain_name.com', SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
    $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
    break;
  default:
    zen_mail('', 'testunknown@your_domain_name.com', SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
    $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
    break;
}
// eof: send extra email based on Payment

NOTE: there is a typo in the previous code:

  case ($this->info['payment_module_code'] == '    paypalwpp'):

change to:

  case ($this->info['payment_module_code'] == 'paypalwpp'):

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 May 2012, 5:48 AM
#15
joyjoy avatar

joyjoy

Totally Zenned

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

Re: Can I send extra emails based on payment method?

Hi again. I really, really appreciate your help. You are literally putting this together for me but for the life of me I cannot get this to work properly. I have made edits the files over 40 times and placed mock orders to generate the effect I'm needing. However, the additional emails keep getting sent to my admin - not the customer email. I don't know how to remove the "order confirmation" details as I don't want the email to appear as a duplicate to my customers. Here's what I'm trying to do.

If an order is placed using Money Gram I would like the customer to receive the generic "Order Confirmation" email. I would like to use the "Send Additonal Email" function to then send an additional email to the customer with the Money Gram payment instructions. I would like the additional email sent only to the customer, not to my admin address. If possible I would like to be able to reference the order and order total in the additional email sent but it's not necessary. I would hope to be able to customize the additional email to read something as such:

Dear $customer_name,

Thank you so much for placing an order with us. Please submit your payment of $order_total for order number $order_number. You may use the following details to complete your Money Gram Money Transfer...

Sorry to keep bothering you. Believe me, I am trying - it's just not working out. :( I appreciate your help again. Thank you!!

21 May 2012, 2:40 PM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I send extra emails based on payment method?

Wouldn't two emails to the customer be more confusing than just adding the extra information to the original email so they have it all together? :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 May 2012, 6:27 PM
#17
joyjoy avatar

joyjoy

Totally Zenned

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

Re: Can I send extra emails based on payment method?

Ajeh:

Wouldn't two emails to the customer be more confusing than just adding the extra information to the original email so they have it all together? :unsure:

That's what I thought but I think that many people just assume its a generic email confirmation and don't bother reading through .I end up having to respond to email after email to restate the same information. I'm hoping the payment instructions email will help to eliminate some of that. I have even tried to create an observer to do this but I'm not good enough in php to understand where my errors are. Thank you.

22 May 2012, 2:28 AM
#18
joyjoy avatar

joyjoy

Totally Zenned

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

Re: Can I send extra emails based on payment method?

Can anyone help me with this? I'm not too familiar with this part of the php files on zen cart and I have tried, tried and tried and failed. I've been trying to set this up for days now. Please, it's one of the last bits I need to wrap up here. Thank you!!

22 May 2012, 3:17 AM
#19
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I send extra emails based on payment method?

You can try using the code in RED:

    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);

// bof: send extra email based on Payment to customer
switch(true) {
  case ($this->info['payment_module_code'] == 'moneyorder'):
    $html_msg_text = '';
    zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], 'My MoneyOrder Subject ' . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, 'My moneyorder text', STORE_NAME, EMAIL_FROM, $html_msg_text, 'checkout', $this->attachArray);
    break;
  case ($this->info['payment_module_code'] == 'paypalwpp'):
    $html_msg_text = '';
    zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], 'My PayPal Express Subject ' . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, 'My PayPal Express text', STORE_NAME, EMAIL_FROM, $html_msg_text, 'checkout', $this->attachArray);
    break;
  default:
    $html_msg_text = '';
    zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], 'My Unknown Subject ' . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, 'My unknown text for: ' . $this->info['payment_module_code'], STORE_NAME, EMAIL_FROM, $html_msg_text, 'checkout', $this->attachArray);
    break;
}
// eof: send extra email based on Payment to customer

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 May 2012, 4:57 AM
#20
joyjoy avatar

joyjoy

Totally Zenned

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

Re: Can I send extra emails based on payment method?

Hi again, thank you. However, I'm still getting the additional email send to my admin instead of the customer. I was also trying to work with this thread that has the same results but uses an auto loader and observer code instead. I can get the email send then but I don't know how to incorporate the customer details(name, order number and total) into the email message. Any suggestions? Thank you, I am really thankful that you've taken the time to respond to be and try to help me out with this. Thank you.

Here's the auto loader/observer thread, I forgot to reference it:
http://www.zen-cart.com/showthread.php?138557-How-to-Create-an-additional-Custom-Email