diff --git a/uc_order/templates/uc-order--admin.tpl.php b/uc_order/templates/uc-order--admin.tpl.php
index edefddf..3ea74d0 100644
--- a/uc_order/templates/uc-order--admin.tpl.php
+++ b/uc_order/templates/uc-order--admin.tpl.php
@@ -7,27 +7,25 @@
 ?>
 
 <p>
-<?php echo t('Order number:'); ?> <?php echo $order_admin_link; ?><br />
-<?php echo t('Customer:'); ?> <?php echo $order_first_name; ?> <?php echo $order_last_name; ?> - <?php echo $order_email; ?><br />
-<?php echo t('Order total:'); ?> <?php echo $order_total; ?><br />
-<?php echo t('Shipping method:'); ?> <?php echo $order_shipping_method; ?>
+<?php print t('Order number:'); ?> <?php print $order_admin_link; ?><br />
+<?php print t('Customer:'); ?> <?php print $order_first_name; ?> <?php print $order_last_name; ?> - <?php print $order_email; ?><br />
+<?php print t('Order total:'); ?> <?php print $order_total; ?><br />
+<?php print t('Shipping method:'); ?> <?php print $order_shipping_method; ?>
 </p>
 
 <p>
-<?php echo t('Products:'); ?><br />
-<?php foreach ($products as $product) { ?>
-- <?php echo $product->qty; ?> x <?php echo $product->title . ' - ' . uc_currency_format($product->price * $product->qty); ?><br />
-&nbsp;&nbsp;<?php echo t('SKU: ') . $product->model; ?><br />
-    <?php if (is_array($product->data['attributes']) && count($product->data['attributes']) > 0) { ?>
-    <?php foreach ($product->data['attributes'] as $attribute => $option) {
-      echo '&nbsp;&nbsp;' . t('@attribute: @options', array('@attribute' => $attribute, '@options' => implode(', ', (array)$option))) . '<br />';
-    } ?>
-    <?php } ?>
+<?php print t('Products:'); ?><br />
+<?php foreach ($products as $product): ?>
+- <?php print $product->qty; ?> x <?php print $product->title . ' - ' . $product->total_price; ?><br />
+&nbsp;&nbsp;<?php print t('SKU: ') . $product->model; ?><br />
+<?php foreach ($product->attributes as $attribute): ?>
+&nbsp;&nbsp;<?php print $attribute; ?><br />
+<?php endforeach; ?>
 <br />
-<?php } ?>
+<?php endforeach; ?>
 </p>
 
 <p>
-<?php echo t('Order comments:'); ?><br />
-<?php echo $order_comments; ?>
+<?php print t('Order comments:'); ?><br />
+<?php print $order_comments; ?>
 </p>
diff --git a/uc_order/templates/uc-order--customer.tpl.php b/uc_order/templates/uc-order--customer.tpl.php
index 0987b21..088d9e8 100644
--- a/uc_order/templates/uc-order--customer.tpl.php
+++ b/uc_order/templates/uc-order--customer.tpl.php
@@ -10,58 +10,59 @@
   <tr>
     <td>
       <table width="100%" border="0" cellspacing="0" cellpadding="5" align="center" bgcolor="#FFFFFF" style="font-family: verdana, arial, helvetica; font-size: small;">
-        <?php if ($business_header) { ?>
-        <tr valign="top">
-          <td>
-            <table width="100%" style="font-family: verdana, arial, helvetica; font-size: small;">
-              <tr>
-                <td>
-                  <?php echo $site_logo; ?>
-                </td>
-                <td width="98%">
-                  <div style="padding-left: 1em;">
-                  <span style="font-size: large;"><?php echo $store_name; ?></span><br />
-                  <?php echo $site_slogan; ?>
-                  </div>
-                </td>
-                <td nowrap="nowrap">
-                  <?php echo $store_address; ?><br /><?php echo $store_phone; ?>
-                </td>
-              </tr>
-            </table>
-          </td>
-        </tr>
-        <?php } ?>
+        <?php if ($business_header): ?>
+          <tr valign="top">
+            <td>
+              <table width="100%" style="font-family: verdana, arial, helvetica; font-size: small;">
+                <tr>
+                  <td>
+                    <?php print $site_logo; ?>
+                  </td>
+                  <td width="98%">
+                    <div style="padding-left: 1em;">
+                      <span style="font-size: large;"><?php print $store_name; ?></span><br />
+                      <?php print $site_slogan; ?>
+                    </div>
+                  </td>
+                  <td nowrap="nowrap">
+                    <?php print $store_address; ?><br />
+                    <?php print $store_phone; ?>
+                  </td>
+                </tr>
+              </table>
+            </td>
+          </tr>
+        <?php endif; ?>
 
         <tr valign="top">
           <td>
 
-            <?php if ($thank_you_message) { ?>
-            <p><b><?php echo t('Thanks for your order, !order_first_name!', array('!order_first_name' => $order_first_name)); ?></b></p>
+            <?php if ($thank_you_message): ?>
+              <p><b><?php print t('Thanks for your order, !order_first_name!', array('!order_first_name' => $order_first_name)); ?></b></p>
 
-            <?php if (isset($_SESSION['new_user'])) { ?>
-            <p><b><?php echo t('An account has been created for you with the following details:'); ?></b></p>
-            <p><b><?php echo t('Username:'); ?></b> <?php echo $order_new_username; ?><br />
-            <b><?php echo t('Password:'); ?></b> <?php echo $order_new_password; ?></p>
-            <?php } ?>
+              <?php if (isset($_SESSION['new_user'])): ?>
+                <p><b><?php print t('An account has been created for you with the following details:'); ?></b></p>
+                <p><b><?php print t('Username:'); ?></b> <?php print $order_new_username; ?><br />
+                <b><?php print t('Password:'); ?></b> <?php print $order_new_password; ?></p>
+              <?php endif; ?>
 
-            <p><b><?php echo t('Want to manage your order online?'); ?></b><br />
-            <?php echo t('If you need to check the status of your order, please visit our home page at !store_link and click on "My account" in the menu or login with the following link:', array('!store_link' => $store_link)); ?>
-            <br /><br /><?php echo $site_login_link; ?></p>
-            <?php } ?>
+              <p><b><?php print t('Want to manage your order online?'); ?></b><br />
+              <?php print t('If you need to check the status of your order, please visit our home page at !store_link and click on "My account" in the menu or login with the following link:', array('!store_link' => $store_link)); ?>
+              <br /><br /><?php print $site_login_link; ?></p>
+            <?php endif; ?>
 
             <table cellpadding="4" cellspacing="0" border="0" width="100%" style="font-family: verdana, arial, helvetica; font-size: small;">
               <tr>
                 <td colspan="2" bgcolor="#006699" style="color: white;">
-                  <b><?php echo t('Purchasing Information:'); ?></b>
+                  <b><?php print t('Purchasing Information:'); ?></b>
                 </td>
               </tr>
               <tr>
                 <td nowrap="nowrap">
-                  <b><?php echo t('E-mail Address:'); ?></b>
+                  <b><?php print t('E-mail Address:'); ?></b>
                 </td>
                 <td width="98%">
-                  <?php echo $order_email; ?>
+                  <?php print $order_email; ?>
                 </td>
               </tr>
               <tr>
@@ -70,21 +71,21 @@
                   <table width="100%" cellspacing="0" cellpadding="0" style="font-family: verdana, arial, helvetica; font-size: small;">
                     <tr>
                       <td valign="top" width="50%">
-                        <b><?php echo t('Billing Address:'); ?></b><br />
-                        <?php echo $order_billing_address; ?><br />
-                        <br />
-                        <b><?php echo t('Billing Phone:'); ?></b><br />
-                        <?php echo $order_billing_phone; ?><br />
-                      </td>
-                      <?php if (uc_order_is_shippable($order)) { ?>
-                      <td valign="top" width="50%">
-                        <b><?php echo t('Shipping Address:'); ?></b><br />
-                        <?php echo $order_shipping_address; ?><br />
+                        <b><?php print t('Billing Address:'); ?></b><br />
+                        <?php print $order_billing_address; ?><br />
                         <br />
-                        <b><?php echo t('Shipping Phone:'); ?></b><br />
-                        <?php echo $order_shipping_phone; ?><br />
+                        <b><?php print t('Billing Phone:'); ?></b><br />
+                        <?php print $order_billing_phone; ?><br />
                       </td>
-                      <?php } ?>
+                      <?php if ($shippable): ?>
+                        <td valign="top" width="50%">
+                          <b><?php print t('Shipping Address:'); ?></b><br />
+                          <?php print $order_shipping_address; ?><br />
+                          <br />
+                          <b><?php print t('Shipping Phone:'); ?></b><br />
+                          <?php print $order_shipping_phone; ?><br />
+                        </td>
+                      <?php endif; ?>
                     </tr>
                   </table>
 
@@ -92,172 +93,115 @@
               </tr>
               <tr>
                 <td nowrap="nowrap">
-                  <b><?php echo t('Order Grand Total:'); ?></b>
-                </td>
-                <td width="98%">
-                  <b><?php echo $order_total; ?></b>
-                </td>
-              </tr>
-              <tr>
-                <td nowrap="nowrap">
-                  <b><?php echo t('Payment Method:'); ?></b>
+                  <b><?php print t('Order Grand Total:'); ?></b>
                 </td>
                 <td width="98%">
-                  <?php echo $order_payment_method; ?>
+                  <b><?php print $order_total; ?></b>
                 </td>
               </tr>
 
+              <?php if ($order_payment_method): ?>
+                <tr>
+                  <td nowrap="nowrap">
+                    <b><?php print t('Payment Method:'); ?></b>
+                  </td>
+                  <td width="98%">
+                    <?php print $order_payment_method; ?>
+                  </td>
+                </tr>
+              <?php endif; ?>
+
               <tr>
                 <td colspan="2" bgcolor="#006699" style="color: white;">
-                  <b><?php echo t('Order Summary:'); ?></b>
+                  <b><?php print t('Order Summary:'); ?></b>
                 </td>
               </tr>
 
-              <?php if (uc_order_is_shippable($order)) { ?>
               <tr>
-                <td colspan="2" bgcolor="#EEEEEE">
-                  <font color="#CC6600"><b><?php echo t('Shipping Details:'); ?></b></font>
+                <td nowrap="nowrap">
+                  <b><?php print t('Order #:'); ?></b>
+                </td>
+                <td width="98%">
+                  <?php print $order_link; ?>
                 </td>
               </tr>
-              <?php } ?>
 
               <tr>
-                <td colspan="2">
-
-                  <table border="0" cellpadding="1" cellspacing="0" width="100%" style="font-family: verdana, arial, helvetica; font-size: small;">
-                    <tr>
-                      <td nowrap="nowrap">
-                        <b><?php echo t('Order #:'); ?></b>
-                      </td>
-                      <td width="98%">
-                        <?php echo $order_link; ?>
-                      </td>
-                    </tr>
-
-                    <tr>
-                      <td nowrap="nowrap">
-                        <b><?php echo t('Order Date: '); ?></b>
-                      </td>
-                      <td width="98%">
-                        <?php echo $order_created; ?>
-                      </td>
-                    </tr>
-
-                    <?php if ($shipping_method && uc_order_is_shippable($order)) { ?>
-                    <tr>
-                      <td nowrap="nowrap">
-                        <b><?php echo t('Shipping Method:'); ?></b>
-                      </td>
-                      <td width="98%">
-                        <?php echo $order_shipping_method; ?>
-                      </td>
-                    </tr>
-                    <?php } ?>
-
-                    <tr>
-                      <td nowrap="nowrap">
-                        <?php echo t('Products Subtotal:'); ?>&nbsp;
-                      </td>
-                      <td width="98%">
-                        <?php echo $order_subtotal; ?>
-                      </td>
-                    </tr>
-
-                    <?php
-                    foreach ($line_items as $item) {
-                      if ($item['line_item_id'] == 'subtotal' || $item['line_item_id'] == 'total') {
-                        continue;
-                      } ?>
-
-                    <tr>
-                      <td nowrap="nowrap">
-                        <?php echo $item['title']; ?>:
-                      </td>
-                      <td>
-                        <?php echo uc_currency_format($item['amount']); ?>
-                      </td>
-                    </tr>
-
-                    <?php } ?>
-
-                    <tr>
-                      <td>&nbsp;</td>
-                      <td>------</td>
-                    </tr>
-
-                    <tr>
-                      <td nowrap="nowrap">
-                        <b><?php echo t('Total for this Order:'); ?>&nbsp;</b>
-                      </td>
-                      <td>
-                        <b><?php echo $order_total; ?></b>
-                      </td>
-                    </tr>
-
-                    <tr>
-                      <td colspan="2">
-                        <br /><br /><b><?php echo t('Products on order:'); ?>&nbsp;</b>
-
-                        <table width="100%" style="font-family: verdana, arial, helvetica; font-size: small;">
-
-                          <?php
-                          if (is_array($order->products)) {
-                            foreach ($order->products as $product) {
-                          ?>
-                          <tr>
-                            <td valign="top" nowrap="nowrap">
-                              <b><?php echo $product->qty; ?> x </b>
-                            </td>
-                            <td width="98%">
-                              <b><?php echo $product->title . ' - ' . uc_currency_format($product->price * $product->qty); ?></b>
-                              <?php if ($product->qty > 1) {
-                                echo t('(!price each)', array('!price' => uc_currency_format($product->price)));
-                              } ?>
-                              <br />
-                              <?php echo t('SKU: ') . $product->model; ?><br />
-                              <?php if (is_array($product->data['attributes']) && count($product->data['attributes']) > 0) { ?>
-                              <?php
-                                foreach ($product->data['attributes'] as $attribute => $option) {
-                                  echo '<li>' . t('@attribute: @options', array('@attribute' => $attribute, '@options' => implode(', ', (array)$option))) . '</li>';
-                                } ?>
-                              <?php } ?>
-                              <br />
-                            </td>
-                          </tr>
-                          <?php }
-                              }?>
-                        </table>
-
-                      </td>
-                    </tr>
-                  </table>
-
+                <td nowrap="nowrap">
+                  <b><?php print t('Order Date: '); ?></b>
+                </td>
+                <td width="98%">
+                  <?php print $order_created; ?>
                 </td>
               </tr>
 
-              <?php if ($help_text || $email_text || $store_footer) { ?>
+              <?php if ($shipping_method && $shippable): ?>
+                <tr>
+                  <td nowrap="nowrap">
+                    <b><?php print t('Shipping Method:'); ?></b>
+                  </td>
+                  <td width="98%">
+                    <?php print $order_shipping_method; ?>
+                  </td>
+                </tr>
+              <?php endif; ?>
+
+              <?php foreach ($line_items as $item): ?>
+                <tr>
+                  <td nowrap="nowrap"><?php print $item['title']; ?>:</td>
+                  <td><?php print $item['amount']; ?></td>
+                </tr>
+              <?php endforeach; ?>
+
               <tr>
                 <td colspan="2">
-                  <hr noshade="noshade" size="1" /><br />
-
-                  <?php if ($help_text) { ?>
-                  <p><b><?php echo t('Where can I get help with reviewing my order?'); ?></b><br />
-                  <?php echo t('To learn more about managing your orders on !store_link, please visit our <a href="!store_help_url">help page</a>.', array('!store_link' => $store_link, '!store_help_url' => $store_help_url)); ?>
-                  <br /></p>
-                  <?php } ?>
-
-                  <?php if ($email_text) { ?>
-                  <p><?php echo t('Please note: This e-mail message is an automated notification. Please do not reply to this message.'); ?></p>
-
-                  <p><?php echo t('Thanks again for shopping with us.'); ?></p>
-                  <?php } ?>
-
-                  <?php if ($store_footer) { ?>
-                  <p><b><?php echo $store_link; ?></b><br /><b><?php echo $site_slogan; ?></b></p>
-                  <?php } ?>
+                  <br /><br /><b><?php print t('Products on order:'); ?>&nbsp;</b>
+
+                  <table width="100%" style="font-family: verdana, arial, helvetica; font-size: small;">
+
+                    <?php foreach ($products as $product): ?>
+                      <tr>
+                        <td valign="top" nowrap="nowrap">
+                          <b><?php print $product->qty; ?> x </b>
+                        </td>
+                        <td width="98%">
+                          <b><?php print $product->title . ' - ' . $product->total_price; ?></b>
+                          <?php print $product->individual_price; ?><br />
+                          <?php print t('SKU: ') . $product->model; ?><br />
+                          <ul>
+                          <?php foreach ($product->attributes as $attribute): ?>
+                            <li><?php print $attribute; ?>
+                          <?php endforeach; ?>
+                          </ul><br />
+                        </td>
+                      </tr>
+                    <?php endforeach; ?>
+                  </table>
                 </td>
               </tr>
-              <?php } ?>
+
+              <?php if ($help_text || $email_text || $store_footer): ?>
+                <tr>
+                  <td colspan="2">
+                    <hr noshade="noshade" size="1" /><br />
+
+                    <?php if ($help_text): ?>
+                      <p><b><?php print t('Where can I get help with reviewing my order?'); ?></b><br />
+                      <?php print t('To learn more about managing your orders on !store_link, please visit our <a href="!store_help_url">help page</a>.', array('!store_link' => $store_link, '!store_help_url' => $store_help_url)); ?>
+                      <br /></p>
+                    <?php endif; ?>
+
+                    <?php if ($email_text): ?>
+                      <p><?php print t('Please note: This e-mail message is an automated notification. Please do not reply to this message.'); ?></p>
+                      <p><?php print t('Thanks again for shopping with us.'); ?></p>
+                    <?php endif; ?>
+
+                    <?php if ($store_footer): ?>
+                      <p><b><?php print $store_link; ?></b><br /><b><?php print $site_slogan; ?></b></p>
+                    <?php endif; ?>
+                  </td>
+                </tr>
+              <?php endif; ?>
 
             </table>
           </td>
diff --git a/uc_order/uc_order.module b/uc_order/uc_order.module
index 15eaade..17fc2b0 100644
--- a/uc_order/uc_order.module
+++ b/uc_order/uc_order.module
@@ -1789,6 +1789,8 @@ function _uc_order_get_screen_titles() {
  * Preprocesses a formatted invoice with an order's data.
  */
 function template_preprocess_uc_order(&$variables) {
+  $order = &$variables['order'];
+
   switch ($variables['op']) {
     case 'checkout-mail':
       $variables['thank_you_message'] = TRUE;
@@ -1803,16 +1805,31 @@ function template_preprocess_uc_order(&$variables) {
       break;
   }
 
-  $variables['products'] = $variables['order']->products;
-  if (!is_array($variables['products'])) {
-    $variables['products'] = array();
+  $variables['shippable'] = uc_order_is_shippable($order);
+
+  $variables['products'] = $order->products;
+  foreach ($order->products as &$product) {
+    $product->total_price = uc_currency_format($product->price * $product->qty);
+    if ($product->qty > 1) {
+      $product->individual_price = t('(!price each)', array('!price' => uc_currency_format($product->price)));
+    }
+    else {
+      $product->individual_price = '';
+    }
+
+
+    $product->attributes = array();
+    if (isset($product->data['attributes'])) {
+      foreach ($product->data['attributes'] as $attribute => $option) {
+        $product->attributes[] = t('@attribute: @options', array('@attribute' => $attribute, '@options' => implode(', ', (array)$option)));
+      }
+    }
   }
 
-  $variables['line_items'] = $variables['order']->line_items;
-  $items = _uc_line_item_list();
-  foreach ($items as $item) {
+  $variables['line_items'] = $order->line_items;
+  foreach (_uc_line_item_list() as $item) {
     if (isset($item['display_only']) && $item['display_only'] == TRUE) {
-      $result = $item['callback']('display', $variables['order']);
+      $result = $item['callback']('display', $order);
       if (is_array($result)) {
         foreach ($result as $line) {
           $variables['line_items'][] = array(
@@ -1826,14 +1843,14 @@ function template_preprocess_uc_order(&$variables) {
       }
     }
   }
-  if (!is_array($variables['line_items'])) {
-    $variables['line_items'] = array();
+  foreach ($variables['line_items'] as &$item) {
+    $item['amount'] = uc_currency_format($item['amount']);
   }
   usort($variables['line_items'], 'uc_weight_sort');
 
   // Generate tokens to use as template variables.
   $types = array(
-    'uc_order' => $variables['order'],
+    'uc_order' => $order,
   );
 
   $token_info = token_info();
