evolve_woocommerce_view_order

The evolve evolve woocommerce view order function.

Description

evolve_woocommerce_view_order( $order_id ); 

Parameters (1)

0. $order_id
The order id.

Usage

  1. if ( !function_exists( 'evolve_woocommerce_view_order' ) ) { 
  2. require_once '/library/woo-config.php'; 
  3.  
  4. // The order id. 
  5. $order_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = evolve_woocommerce_view_order($order_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/library/woo-config.php  
  1. function evolve_woocommerce_view_order($order_id) { 
  2. global $woocommerce; 
  3.  
  4. $order = wc_get_order( $order_id ); 
  5. $order_item_product = new WC_Order_Item_Product(); 
  6. ?> 
  7. <div class="evolve-order-details woocommerce-content-box full-width"> 
  8. <h2><?php _e('Order Details', 'evolve'); ?></h2> 
  9. <table class="shop_table order_details"> 
  10. <thead> 
  11. <tr> 
  12. <th class="product-name"><?php _e('Product', 'evolve'); ?></th> 
  13. <th class="product-quantity"><?php _e('Quantity', 'evolve'); ?></th> 
  14. <th class="product-total"><?php _e('Total', 'evolve'); ?></th> 
  15. </tr> 
  16. </thead> 
  17. <tfoot> 
  18. <?php 
  19. if ($totals = $order->get_order_item_totals()) 
  20. foreach ($totals as $total) : 
  21. ?> 
  22. <tr> 
  23. <td class="filler-td"> </td> 
  24. <th scope="row"><?php echo $total['label']; ?></th> 
  25. <td class="product-total"><?php echo $total['value']; ?></td> 
  26. </tr> 
  27. <?php 
  28. endforeach; 
  29. ?> 
  30. </tfoot> 
  31. <tbody> 
  32. <?php 
  33. if (sizeof($order->get_items()) > 0) { 
  34.  
  35. foreach ($order->get_items() as $item) { 
  36. $_product = apply_filters('woocommerce_order_item_product', $order->get_product_from_item($item), $item); 
  37. $product = apply_filters( 'woocommerce_order_item_product', $item->get_product(), $item ); 
  38. ?> 
  39. <tr class="<?php echo esc_attr(apply_filters('woocommerce_order_item_class', 'order_item', $item, $order)); ?>"> 
  40. <td class="product-name"> 
  41. <span class="product-thumbnail"> 
  42. <?php 
  43. $cart_item = ''; 
  44. $cart_item_key = ''; 
  45. $thumbnail = apply_filters('woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key); 
  46.  
  47. if (!$_product->is_visible()) 
  48. echo $thumbnail; 
  49. else 
  50. printf('<a href="%s">%s</a>', $_product->get_permalink(), $thumbnail); 
  51. ?> 
  52. </span> 
  53. <div class="product-info"> 
  54. <?php 
  55. if ($_product && !$_product->is_visible()) 
  56. echo apply_filters('woocommerce_order_item_name', $item['name'], $item); 
  57. else 
  58. echo apply_filters('woocommerce_order_item_name', sprintf('<a href="%s">%s</a>', get_permalink($item['product_id']), $item['name']), $item); 
  59.  
  60. wc_display_item_meta($item); 
  61.  
  62. if ($_product && $_product->exists() && $_product->is_downloadable() && $order->is_download_permitted()) { 
  63.  
  64. $download_files = $order_item_product->get_item_downloads(); 
  65. $i = 0; 
  66. $links = array(); 
  67.  
  68. foreach ($download_files as $download_id => $file) { 
  69. $i++; 
  70.  
  71. $links[] = '<small><a href="' . esc_url($file['download_url']) . '">' . sprintf(__('Download file%s', 'evolve'), ( count($download_files) > 1 ? ' ' . $i . ': ' : ': ')) . esc_html($file['name']) . '</a></small>'; 
  72.  
  73. echo '<br/>' . implode('<br/>', $links); 
  74. ?> 
  75. </div> 
  76. </td> 
  77. <td class="product-quantity"> 
  78. <?php echo apply_filters('woocommerce_order_item_quantity_html', $item['qty'], $item); ?> 
  79. </td> 
  80. <td class="product-total"> 
  81. <?php echo $order->get_formatted_line_subtotal($item); ?> 
  82. </td> 
  83. </tr> 
  84. <?php 
  85. $show_purchase_note = $order->has_status( apply_filters( 'woocommerce_purchase_note_order_statuses', array( 'completed', 'processing' ) ) ); 
  86. $purchase_note = $product ? $product->get_purchase_note() : ''; 
  87. if ( $show_purchase_note && $purchase_note ) { 
  88. ?> 
  89. <tr class="product-purchase-note"> 
  90. <td colspan="3"><?php echo wpautop( do_shortcode( wp_kses_post( $purchase_note ) ) ); ?></td> 
  91. </tr> 
  92. <?php 
  93.  
  94.  
  95. do_action('woocommerce_order_items_table', $order); 
  96. ?> 
  97. </tbody> 
  98. </table> 
  99.  
  100. <?php do_action('woocommerce_order_details_after_order_table', $order); ?> 
  101. </div> 
  102.  
  103. <div class="evolve-customer-details woocommerce-content-box full-width"> 
  104. <header> 
  105. <h2><?php _e('Customer details', 'evolve'); ?></h2> 
  106. </header> 
  107. <dl class="customer_details"> 
  108. <?php 
  109. if ($order->get_customer_note()) 
  110. echo '<dt>' . __('Note:', 'evolve') . '</dt> <dd>' . $order->get_customer_note() . '</dd>'; 
  111. if ($order->get_billing_email()) 
  112. echo '<dt>' . __('Email:', 'evolve') . '</dt> <dd>' . $order->get_billing_email() . '</dd>'; 
  113. if ($order->get_billing_phone()) 
  114. echo '<dt>' . __('Telephone:', 'evolve') . '</dt> <dd>' . $order->get_billing_phone() . '</dd>'; 
  115.  
  116. // Additional customer details hook 
  117. ?> 
  118. </dl> 
  119.  
  120. <?php if (get_option('woocommerce_ship_to_billing_address_only') === 'no' && get_option('woocommerce_calc_shipping') !== 'no') : ?> 
  121.  
  122. <div class="col2-set addresses"> 
  123.  
  124. <div class="col-1"> 
  125.  
  126. <?php endif; ?> 
  127.  
  128. <header class="title"> 
  129. <h3><?php _e('Billing Address', 'evolve'); ?></h3> 
  130. </header> 
  131. <address><p> 
  132. <?php 
  133. if (!$order->get_formatted_billing_address()) 
  134. _e('N/A', 'evolve'); 
  135. else 
  136. echo $order->get_formatted_billing_address(); 
  137. ?> 
  138. </p></address> 
  139.  
  140. <?php if (get_option('woocommerce_ship_to_billing_address_only') === 'no' && get_option('woocommerce_calc_shipping') !== 'no') : ?> 
  141.  
  142. </div><!-- /.col-1 --> 
  143.  
  144. <div class="col-2"> 
  145.  
  146. <header class="title"> 
  147. <h3><?php _e('Shipping Address', 'evolve'); ?></h3> 
  148. </header> 
  149. <address><p> 
  150. <?php 
  151. if (!$order->get_formatted_shipping_address()) 
  152. _e('N/A', 'evolve'); 
  153. else 
  154. echo $order->get_formatted_shipping_address(); 
  155. ?> 
  156. </p></address> 
  157.  
  158. </div><!-- /.col-2 --> 
  159.  
  160. </div><!-- /.col2-set --> 
  161.  
  162. <?php endif; ?> 
  163.  
  164. <div class="clear"></div> 
  165.  
  166. </div> 
  167.  
  168. <?php