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 21 to 37 of 37
22 May 2012, 5:00 AM
#21
joyjoy avatar

joyjoy

Totally Zenned

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

Can I send extra emails based on payment method?

DrByte if you're there...

I've tried to use your auto loader/observer code to generate a 2nd email to a customer after an order is placed. This email would be generated based on the payment type. Here's the thread I've reviewed:

http://www.zen-cart.com/showthread.php?138557-How-to-Create-an-additional-Custom-Email

Do you have any suggestions how to tweak it to get what I'm hoping for? Thank you!

22 May 2012, 5:12 AM
#22
joyjoy avatar

joyjoy

Totally Zenned

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

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

Wait!! It worked! There was a significant lag - about 15 minutes, but it worked! I noticed that when I was working with the auto-loader/observer setup it was instantaneous. Also, I am still getting double emails on the order confirmation to admin. But at least it worked! Thank you so much again. I'll try to tweak this a bit more and update with the best fit. Thank you.

22 May 2012, 9:55 PM
#23
joyjoy avatar

joyjoy

Totally Zenned

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

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

Ahhhh, I'm back. I ran a few more test orders and the lag is just not going to work. Sometimes the email was sent right away, others about 10-15 minutes after the order was placed and another that took over an hour. I don't know what determines this but from trial and error I am finding that the option of running an auto loader/observer command is smoother. Can anyone take a look at this thread:
http://www.zen-cart.com/showthread.p...l-Custom-Email

I'm trying to understand how I would be able to include details from the order such as customer name, customer order number and order total. Thank you.

23 May 2012, 2:59 AM
#24
drbyte avatar

drbyte

Sensei

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

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

Ajeh's instructions are correct.

And as for the lag, you need to understand that the emails are sent RIGHT AWAY. The lag is NOT from Zen Cart. The lag is completely external, and is probably a one-time quirk and not an indicator of regular response.

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

23 May 2012, 3:16 AM
#25
joyjoy avatar

joyjoy

Totally Zenned

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

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

Dr.Byte! Thank you for your input. Yes I assume that the lag was external as it was hit and miss. However after doing many, many mock orders, 107 to be precise I do find that the auto loader/observer has a consistent response each time. I also like that these files are outside of the zen-cart files so that it makes for easy upgrading in the future.

Also, my admin is getting duplicate order emails for the additional email command, no biggie but if it can be avoided that would be best.

Is there a way that this can be made to reflect the order details such as customer name, order number and order total? Can it also be scripted so that it will only be run when a particular payment module is used at checkout?

23 May 2012, 3:27 AM
#26
joyjoy avatar

joyjoy

Totally Zenned

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

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

Oh one more thing. If I just stick with the modified code to the order.php file under classes, I'm stick stuck trying to figure out how to incorporate the order details into that additional email, such as customer name, order number and order total.

If I can get this going I can deal with the lag time and the duplicate admin emails. I haven't been able to figure that part out though. Thank you again.

23 May 2012, 10:37 PM
#27
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 are there any zen-cart programmers willing to address this? I am more than willing to make a donation towards the development of zen-cart as I think this would be more beneficial than using a third party developer. Thank you.

23 May 2012, 10:47 PM
#28
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?

Could you perhaps give an example of what you want the 2nd email to the customer to look like and for what payment module it is?

What subject?

What text in the email, including whatever from the order you want to see in it?

Search your order.php for:
zen_email

What lines come up and what do they read?

Do you have Notifiers sending emails out associated with the order.php class?

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!

23 May 2012, 11:31 PM
#29
joyjoy avatar

joyjoy

Totally Zenned

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

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

Ahhh, I wrote a long reply and then it didn't post. Here it goes again.

Currently, my order.php file is the default file. I could not get the additional email to work the way I needed so I reverted back. Using the order.php method I was experiencing inconsistencies in the delivery time of the additional email. Some were instantly, others a few minutes later and even more with a bigger delay of over an hour. I did over 100 mock orders to test this out and repeatedly had conflicting results. I was also getting duplicates of the admin order confirmation with each message being sent. I would get the admin confirmation with the regular customer confirmation then I would receive it again once the additional email was sent. However with the observer method it was instantanous each time without any trouble.

Here is the thread with the auto load/observer method that was provided by DrByte:
http://www.zen-cart.com/showthread.p...l-Custom-Email

Using this method I was able to acheive the additional email that was delivered instantly along with the customer order confirmation. However, i don't know how to incorporate the order details into the email. Here's what I would like the message to say:

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

Thank you again so much. I didn't think this would be this difficult. :blink:

24 May 2012, 12:48 AM
#30
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 link does not work ...

Can you try to post it again?

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!

25 May 2012, 12:54 AM
#32
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?

Found the thread, but I am not seeing anything about the autoloader or notifier that you are referring to ... :unsure:

Can you get any more specific on this?

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!

25 May 2012, 1:01 AM
#33
joyjoy avatar

joyjoy

Totally Zenned

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

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

In that thread, the fourth message down DrByte send an attachment for the code to install to utilize the auto load/observer method. Thank you.

25 May 2012, 2:30 AM
#34
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?

See if this helps get you going ...

  function update(&$class, $eventID, $paramsArray = array()) {
    global $order;
    global $order_totals;

    for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
      if ($order_totals[$i]['title'] = 'Total:') {
        $this_order_total = strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']);
      }
    }

    define('EMAIL_SUBJECT_CC_MSG', 'An important note about your recent purchase.');
    if ($order->info['payment_module_code'] == 'moneygram') {
      define('EMAIL_TEXT_CC_MSG',
      'Dear ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'] . "\n\n" .
      'Thank you so much for placing an order with us. Please submit your payment of ' . $this_order_total . ' for order number ' . $paramsArray[0] . '. You may use the following details to complete your Money Gram Money Transfer...' . "\n\n"
      );
    }
    if ($order->info['payment_module_code'] == 'moneyorder') {
      define('EMAIL_TEXT_CC_MSG',
      'Dear ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'] . "\n" .
      'Thank you so much for placing an order with us. Please submit your payment of ' . $this_order_total . ' for order number ' . $paramsArray[0] . '. You may use the following details to complete your Money Order ...' . "\n\n"
      );
    }
    zen_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_SUBJECT_CC_MSG, EMAIL_TEXT_CC_MSG, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br(EMAIL_TEXT_CC_MSG)),'ccnotice');
  }

NOTE: I do not know your payment module info on payment_module_code for moneygram so I just stuck in there moneygram ... use the right one for this ...

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!

25 May 2012, 4:51 AM
#35
joyjoy avatar

joyjoy

Totally Zenned

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

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

Thank you so much!! It worked! How do I make a donation to the zen-cart team? Please send me the link. Thank you, thank you!

25 May 2012, 5:23 AM
#36
joyjoy avatar

joyjoy

Totally Zenned

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

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

joyjoy:

Thank you so much!! It worked! How do I make a donation to the zen-cart team? Please send me the link. Thank you, thank you!

Okay, false alarm but oh so close!! Turns out it's sending the extra email for all orders regardless of the payment module. I'll try to play with it and see if I can figure it out. If anything jumps out at you that would fix this please post. I will follow up as well. Thank you!

25 May 2012, 1:46 PM
#37
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?

Could you post your code that you have for:
/includes/classes/observers/class.sendExtraCcEmailNotice.php

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!