Forums / General Questions / Text email not displaying custom payment footer

Text email not displaying custom payment footer

Locked

Views: 2,752

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
30 May 2007, 4:35 PM
#1
dbrewster avatar

dbrewster

Zen Follower

Join Date:
Jul 2005
Location:
Charlottesville, VA
Posts:
376
Plugin Contributions:
0

Text email not displaying custom payment footer

Howdies!

I have a custom purchase order payment module, and I have configured the email order to display the additional data: account name, account number, PO number. It is working for HTML but not working for text emails.

In HTML the email looks like this:

Payment Method
Purchase Order with the following information:
Account name: test acct name
Account number: test acct number
PO Number: test order numberin a text email, it looks like this:
Payment Method

Purchase Order

with the following information:
Account name: %s
Account number: %s
PO Number: %sI was unable to use Dr. Byte's updated email footer detail, it just wasn't printing the info in the HTML email. I had once had a discussion with Dr. Byte about this, and he had proposed the following code, but it did not work:

$html_msg['PAYMENT_METHOD_FOOTER'] = (is_object($GLOBALS[$_SESSION['payment']]) && $GLOBALS[$payment_class]->email_footer != '') ? nl2br($GLOBALS[$payment_class]->email_footer) : $this->info['cc_type'];
```This is what's working for HTML email:

includes/languages/english/modules/payment/po.php
```php
 define('MODULE_PAYMENT_PO_TEXT_EMAIL_FOOTER', 'with the following information:<br>
 Account name:  %s<br>
 Account number:  %s<br>
  PO Number:  %s');
```includes/classes/order.php around line 992
```php
// This is for purchaseorder module email info
    $html_msg['PAYMENT_METHOD_FOOTER'] = (is_object($GLOBALS[$_SESSION['payment']]) ? sprintf($GLOBALS[$payment_class]->email_footer, $this->info['account_name'], $this->info['account_number'], $this->info['po_number']) : ' ');
```I guess the $html_msg means that this is excluded from a TEXT email. I'm wondering how to deliver the info to a text email?

thanks!!! I love you guys.

---Diana
30 May 2007, 4:42 PM
#2
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: Text email not displaying custom payment footer

I guess the $html_msg means that this is excluded from a TEXT email. I'm wondering how to deliver the info to a text email?

The $html_msg array is for the HTML emails. The $email_order would the variable you would look for. The $html_msg['TEXT'] is the global usage for text emails and the $html_msg['HTML'] is for the global usage of the HTML emails. :wink2:

30 May 2007, 4:45 PM
#3
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: Text email not displaying custom payment footer

Additionally to the above, there's also a correction posted by DrByte from this topic:

http://www.zen-cart.com/forum/showthread.php?t=54819

30 May 2007, 7:42 PM
#4
dbrewster avatar

dbrewster

Zen Follower

Join Date:
Jul 2005
Location:
Charlottesville, VA
Posts:
376
Plugin Contributions:
0

Re: Text email not displaying custom payment footer

Thanks for reply, Oracle!

I did use Dr. Byte's fixed version, that didn't work for me at all.

I've tried adding this to includes/classes/order.php

      $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
      $email_order .= (is_object($GLOBALS[$_SESSION['payment']]) ? sprintf($GLOBALS[$payment_class]->email_footer, $this->info['account_name'], $this->info['account_number'], $this->info['po_number']) : ' ');
      EMAIL_SEPARATOR . "\n";
      $email_order .= PAYMENT_METHOD_GV . "\n\n";

and made this change to includes/languages/english/modules/payment/po.php

 define('MODULE_PAYMENT_PO_TEXT_EMAIL_FOOTER', 'with the following information:' . "\n" .
 'Account name: ' . $this->info['account_name'] . "\n" .
 'Account number: ' . $this->info['account_number'] . "\n" .
 'PO Number: ' . $this->info['po_number']);

The %s was not being interpreted for the text email, although it was working for HTML email. This is, of course, not the right way to handle a define, but I just don't know how to get the info out there.

The one "good" result is that the text email and the HTML email look the same now:

Payment Method

Purchase Order

with the following information:
Account name:
Account number:
PO Number:

the problem is how to push the data out to the email.

It is showing correctly in the invoice and checkout screens.

Ideas? (I am unfortunately not a programmer, I can write a little code, but definitely not an accomplished programmer in any language.)

30 May 2007, 9:03 PM
#5
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: Text email not displaying custom payment footer

In that case, I'd call this a bug. :blink:

1 Jun 2007, 11:50 PM
#6
drbyte avatar

drbyte

Sensei

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

Re: Text email not displaying custom payment footer

Diana, can you post a zip of your custom po module and its language file?

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

2 Jun 2007, 7:03 PM
#7
dbrewster avatar

dbrewster

Zen Follower

Join Date:
Jul 2005
Location:
Charlottesville, VA
Posts:
376
Plugin Contributions:
0

Re: Text email not displaying custom payment footer

thanks, Dr. Byte!!!! :clap:

I'm including classes/order.php because it has some related modifications.

(I've included the % handling module for USPS too, in case you want to include that feature in a future release. Flat fee handling for a large order can be costly. Just ignore the shipping bits if you're not interested.)

---Diana

2 Jun 2007, 8:03 PM
#8
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: Text email not displaying custom payment footer

Two things I noticed:

1 -

$this->email_footer = MODULE_PAYMENT_PO_TEXT_EMAIL_FOOTER;

seems to be the one line using that definition - not too sure why ...

2 -

global $HTTP_POST_VARS;

I wonder why this is being used since Zen-Cart does not use VARS anywhere ...

3 Jun 2007, 9:48 PM
#9
dbrewster avatar

dbrewster

Zen Follower

Join Date:
Jul 2005
Location:
Charlottesville, VA
Posts:
376
Plugin Contributions:
0

Re: Text email not displaying custom payment footer

Oracle,

Since I'm just a PHP hack, could you please explain your comments to me?

what is the problem with one line using the PO footer definition? (was that in order.php?)

what's the problem with

global $HTTP_POST_VARS;
```?

As you can see, the PO module is built on an old OSCommerce module. It does work, except for the email footer. The email footer works in HTML email, but not in text email.

---Diana
4 Jun 2007, 12:42 AM
#10
drbyte avatar

drbyte

Sensei

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

Re: Text email not displaying custom payment footer

I'm guessing that this might take care of it:

In the po.php payment module, around line 98, you have the before_process() function. Try inserting this line, as shown:```
function before_process() {
[B] $this->email_footer = sprintf($this->email_footer, $_POST['account_name'], $_POST['account_number'], $_POST['po_number']);
[/B] return false;
}


And then make sure your order.php class file has these two lines set back to the defaults, like this:```
      $email_order .= ($GLOBALS[$payment_class]->email_footer) ? $GLOBALS[$payment_class]->email_footer . "\n\n" : '';
```and this:```
    $html_msg['PAYMENT_METHOD_FOOTER'] = (is_object($GLOBALS[$_SESSION['payment']]) && $GLOBALS[$payment_class]->email_footer != '') ? nl2br($GLOBALS[$payment_class]->email_footer) : $this->info['cc_type'];

I also suggest that you convert the <br> tags in your language file to \n carriage returns so that your text-only emails show up properly:```
define('MODULE_PAYMENT_PO_TEXT_EMAIL_FOOTER', 'with the following information: ' . "\n" . ' Account name:  %s ' . "\n" . ' Account number:  %s' . "\n" . ' PO Number:  %s' . "\n");

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

4 Jun 2007, 1:46 PM
#11
dbrewster avatar

dbrewster

Zen Follower

Join Date:
Jul 2005
Location:
Charlottesville, VA
Posts:
376
Plugin Contributions:
0

Re: Text email not displaying custom payment footer

You are my HERO, Dr. Byte!

SMOOOOOOOOCH! :hug:

Works perfectly.

---Diana :D:D:D:D:D