Forums / Bug Reports / [Done v1.5.0] minor email table error in orders.php

[Done v1.5.0] minor email table error in orders.php

Locked

Views: 2,483

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
14 May 2010, 4:33 AM
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,875
Plugin Contributions:
7

[Done v1.5.0] minor email table error in orders.php

in /includes/classes/order.php
the code results in a missed starting <tr> tag and a final extra <tr> in the email.

Suggested change from:

    //order totals area
    $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . ' ' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' .'</td> </tr>' . "\n"[B] . '<tr>'[/B];
    for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
      $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
      $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' .($order_totals[$i]['text']) .'</td> </tr>' . "\n" [B]. '<tr>'[/B];
    }

to:

    //order totals area
    $html_ot .= '[B]<tr>[/B]<td class="order-totals-text" align="right" width="100%">' . ' ' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' .'</td> </tr>' . "\n";
    for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
      $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
      $html_ot .= '[B]<tr>[/B]<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' .($order_totals[$i]['text']) .'</td> </tr>' . "\n";
    }

whether you get rid of the "nowrap" tags and put them in the css is another matter.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

14 May 2010, 5:24 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: [Done v1.5.0] minor email table error in orders.php

torvista:

whether you get rid of the "nowrap" tags and put them in the css is another matter.
Email typically doesn't support most CSS usage, hence the choice to embed it into the HTML.

However, the incorrect nesting is fixed in v1.5.0

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

1 Sep 2010, 1:40 AM
#3
choccybox avatar

choccybox

New Zenner

Join Date:
Aug 2010
Posts:
25
Plugin Contributions:
0

Re: [Done v1.5.0] minor email table error in orders.php

Hi,

In the includes/classes/orders.php files there is a code for outputting the order totals in the order confirmation email. The coding is:

$html_ot .= '<td class="order-totals-text" align="right" width="100%">' . ' ' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' .'</td> </tr>' . "\n" . '<tr>';
for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
  $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
  $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' .($order_totals[$i]['text']) .'</td> </tr>' . "\n" . '<tr>';
}
$html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2"> ' . $html_ot . ' </table>';

Now this gives a html output of:

<table border="0" width="100%" cellspacing="0" cellpadding="2"> <td class="order-totals-text" align="right" width="100%"> </td> <td class="order-totals-num" align="right" nowrap="nowrap">---------</td> </tr> <tr><td class="order-totals-text" align="right" width="100%">Sub-Total:</td> <td class="order-totals-num" align="right" nowrap="nowrap">$8.00</td> </tr> <tr><td class="order-totals-text" align="right" width="100%">Per Item Rates (Shipping to BS (145.00grams)):</td> <td class="order-totals-num" align="right" nowrap="nowrap">$3.30</td> </tr> <tr><td class="order-totals-text" align="right" width="100%">Total:</td> <td class="order-totals-num" align="right" nowrap="nowrap">$11.30</td> </tr> <tr> </table>

Forgive me if i'm wrong, but there seems to be a missing <tr> before the first <td> tag. e.g.

<table border="0" width="100%" cellspacing="0" cellpadding="2"> **<TR>**<td class="order-totals-text" align="right" width="100%"> </td> <td class="order-totals-num" align="right" nowrap="nowrap">---------</td> </tr>

Therefore shouldn't the orders.php code be:

$html_ot .= '**<TR>**<td class="order-totals-text" align="right" width="100%">' . ' ' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' .'</td> </tr>' . "\n" . '<tr>';
for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
  $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
  $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' .($order_totals[$i]['text']) .'</td> </tr>' . "\n" . '<tr>';
}
$html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2"> ' . $html_ot . ' </table>';
1 Sep 2010, 7:48 AM
#4
choccybox avatar

choccybox

New Zenner

Join Date:
Aug 2010
Posts:
25
Plugin Contributions:
0

Re: [Done v1.5.0] minor email table error in orders.php

I tested the code suggested:

//order totals area
 $html_ot .= '<tr><td class="order-totals-text" align="right" width="100%">' . ' ' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' .'</td> </tr>' . "\n";
 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
   $html_ot .= '<tr><td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' .($order_totals[$i]['text']) .'</td> </tr>' . "\n";
 }

And html emails now seem to work fine in hotmail, gmail, yahoo & windows live mail.

Thanks guys!