PageRenderTime 52ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/catalog/account_history_info.php

https://github.com/cybotech/oscommerce2
PHP | 231 lines | 206 code | 15 blank | 10 comment | 21 complexity | 1eeba7bb0dc1a6d9151070c387b32553 MD5 | raw file
  1. <?php
  2. /*
  3. $Id$
  4. osCommerce, Open Source E-Commerce Solutions
  5. http://www.oscommerce.com
  6. Copyright (c) 2007 osCommerce
  7. Released under the GNU General Public License
  8. */
  9. require('includes/application_top.php');
  10. if (!tep_session_is_registered('customer_id')) {
  11. $navigation->set_snapshot();
  12. tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  13. }
  14. if (!isset($HTTP_GET_VARS['order_id']) || (isset($HTTP_GET_VARS['order_id']) && !is_numeric($HTTP_GET_VARS['order_id']))) {
  15. tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
  16. }
  17. $customer_info_query = tep_db_query("select o.customers_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS . " s where o.orders_id = '". (int)$HTTP_GET_VARS['order_id'] . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.public_flag = '1'");
  18. $customer_info = tep_db_fetch_array($customer_info_query);
  19. if ($customer_info['customers_id'] != $customer_id) {
  20. tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
  21. }
  22. require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_HISTORY_INFO);
  23. $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
  24. $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
  25. $breadcrumb->add(sprintf(NAVBAR_TITLE_3, $HTTP_GET_VARS['order_id']), tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $HTTP_GET_VARS['order_id'], 'SSL'));
  26. require(DIR_WS_CLASSES . 'order.php');
  27. $order = new order($HTTP_GET_VARS['order_id']);
  28. require(DIR_WS_INCLUDES . 'template_top.php');
  29. ?>
  30. <table border="0" width="100%" cellspacing="0" cellpadding="0">
  31. <tr>
  32. <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  33. <tr>
  34. <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  35. <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_history.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  36. </tr>
  37. </table></td>
  38. </tr>
  39. <tr>
  40. <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  41. </tr>
  42. <tr>
  43. <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  44. <tr>
  45. <td class="main" colspan="2"><b><?php echo sprintf(HEADING_ORDER_NUMBER, $HTTP_GET_VARS['order_id']) . ' <small>(' . $order->info['orders_status'] . ')</small>'; ?></b></td>
  46. </tr>
  47. <tr>
  48. <td class="smallText"><?php echo HEADING_ORDER_DATE . ' ' . tep_date_long($order->info['date_purchased']); ?></td>
  49. <td class="smallText" align="right"><?php echo HEADING_ORDER_TOTAL . ' ' . $order->info['total']; ?></td>
  50. </tr>
  51. </table></td>
  52. </tr>
  53. <tr>
  54. <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  55. <tr class="infoBoxContents">
  56. <?php
  57. if ($order->delivery != false) {
  58. ?>
  59. <td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  60. <tr>
  61. <td class="main"><b><?php echo HEADING_DELIVERY_ADDRESS; ?></b></td>
  62. </tr>
  63. <tr>
  64. <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>
  65. </tr>
  66. <?php
  67. if (tep_not_null($order->info['shipping_method'])) {
  68. ?>
  69. <tr>
  70. <td class="main"><b><?php echo HEADING_SHIPPING_METHOD; ?></b></td>
  71. </tr>
  72. <tr>
  73. <td class="main"><?php echo $order->info['shipping_method']; ?></td>
  74. </tr>
  75. <?php
  76. }
  77. ?>
  78. </table></td>
  79. <?php
  80. }
  81. ?>
  82. <td width="<?php echo (($order->delivery != false) ? '70%' : '100%'); ?>" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  83. <tr>
  84. <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  85. <?php
  86. if (sizeof($order->info['tax_groups']) > 1) {
  87. ?>
  88. <tr>
  89. <td class="main" colspan="2"><b><?php echo HEADING_PRODUCTS; ?></b></td>
  90. <td class="smallText" align="right"><b><?php echo HEADING_TAX; ?></b></td>
  91. <td class="smallText" align="right"><b><?php echo HEADING_TOTAL; ?></b></td>
  92. </tr>
  93. <?php
  94. } else {
  95. ?>
  96. <tr>
  97. <td class="main" colspan="3"><b><?php echo HEADING_PRODUCTS; ?></b></td>
  98. </tr>
  99. <?php
  100. }
  101. for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
  102. echo ' <tr>' . "\n" .
  103. ' <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" .
  104. ' <td class="main" valign="top">' . $order->products[$i]['name'];
  105. if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
  106. for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
  107. echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
  108. }
  109. }
  110. echo '</td>' . "\n";
  111. if (sizeof($order->info['tax_groups']) > 1) {
  112. echo ' <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";
  113. }
  114. echo ' <td class="main" align="right" valign="top">' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" .
  115. ' </tr>' . "\n";
  116. }
  117. ?>
  118. </table></td>
  119. </tr>
  120. </table></td>
  121. </tr>
  122. </table></td>
  123. </tr>
  124. <tr>
  125. <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  126. </tr>
  127. <tr>
  128. <td class="main"><b><?php echo HEADING_BILLING_INFORMATION; ?></b></td>
  129. </tr>
  130. <tr>
  131. <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  132. </tr>
  133. <tr>
  134. <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  135. <tr class="infoBoxContents">
  136. <td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  137. <tr>
  138. <td class="main"><b><?php echo HEADING_BILLING_ADDRESS; ?></b></td>
  139. </tr>
  140. <tr>
  141. <td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br>'); ?></td>
  142. </tr>
  143. <tr>
  144. <td class="main"><b><?php echo HEADING_PAYMENT_METHOD; ?></b></td>
  145. </tr>
  146. <tr>
  147. <td class="main"><?php echo $order->info['payment_method']; ?></td>
  148. </tr>
  149. </table></td>
  150. <td width="70%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  151. <?php
  152. for ($i=0, $n=sizeof($order->totals); $i<$n; $i++) {
  153. echo ' <tr>' . "\n" .
  154. ' <td class="main" align="right" width="100%">' . $order->totals[$i]['title'] . '</td>' . "\n" .
  155. ' <td class="main" align="right">' . $order->totals[$i]['text'] . '</td>' . "\n" .
  156. ' </tr>' . "\n";
  157. }
  158. ?>
  159. </table></td>
  160. </tr>
  161. </table></td>
  162. </tr>
  163. <tr>
  164. <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  165. </tr>
  166. <tr>
  167. <td class="main"><b><?php echo HEADING_ORDER_HISTORY; ?></b></td>
  168. </tr>
  169. <tr>
  170. <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  171. </tr>
  172. <tr>
  173. <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  174. <tr class="infoBoxContents">
  175. <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  176. <?php
  177. $statuses_query = tep_db_query("select os.orders_status_name, osh.date_added, osh.comments from " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh where osh.orders_id = '" . (int)$HTTP_GET_VARS['order_id'] . "' and osh.orders_status_id = os.orders_status_id and os.language_id = '" . (int)$languages_id . "' and os.public_flag = '1' order by osh.date_added");
  178. while ($statuses = tep_db_fetch_array($statuses_query)) {
  179. echo ' <tr>' . "\n" .
  180. ' <td class="main" valign="top" width="70">' . tep_date_short($statuses['date_added']) . '</td>' . "\n" .
  181. ' <td class="main" valign="top" width="70">' . $statuses['orders_status_name'] . '</td>' . "\n" .
  182. ' <td class="main" valign="top">' . (empty($statuses['comments']) ? '&nbsp;' : nl2br(tep_output_string_protected($statuses['comments']))) . '</td>' . "\n" .
  183. ' </tr>' . "\n";
  184. }
  185. ?>
  186. </table></td>
  187. </tr>
  188. </table></td>
  189. </tr>
  190. <?php
  191. if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php');
  192. ?>
  193. <tr>
  194. <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  195. </tr>
  196. <tr>
  197. <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  198. <tr class="infoBoxContents">
  199. <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  200. <tr>
  201. <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  202. <td class="smallText"><?php echo tep_draw_button(IMAGE_BUTTON_BACK, 'triangle-1-w', tep_href_link(FILENAME_ACCOUNT_HISTORY, tep_get_all_get_params(array('order_id')), 'SSL')); ?></td>
  203. <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  204. </tr>
  205. </table></td>
  206. </tr>
  207. </table></td>
  208. </tr>
  209. </table>
  210. <?php
  211. require(DIR_WS_INCLUDES . 'template_bottom.php');
  212. require(DIR_WS_INCLUDES . 'application_bottom.php');
  213. ?>