woocommerce_umf_box_order_detail

Inhoud van de box op de order-detail pagina.

Description

woocommerce_umf_box_order_detail( $post ); 

Parameters (1)

0. $post
The post.

Usage

  1. if ( !function_exists( 'woocommerce_umf_box_order_detail' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-upload-my-file/inc/umf-funct.php'; 
  3.  
  4. // The post. 
  5. $post = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = woocommerce_umf_box_order_detail($post); 
  9.  

Defined (1)

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

/inc/umf-funct.php  
  1. function woocommerce_umf_box_order_detail($post) { 
  2. $order=new WC_Order($post->ID); 
  3.  
  4. $j=1; 
  5. /** per product een formulier met gegevens */ 
  6. foreach ( $order->get_items() as $order_item ) { 
  7. $max_upload_count=0; 
  8. $max_upload_count=get_max_upload_count($order, $order_item['product_id']); 
  9. if($max_upload_count!=0) { 
  10. $product=new WC_Product($order_item['product_id']); 
  11. //$item_meta = new WC_Order_Item_Meta( $order_item['item_meta'], $order_item['product_id'] ); 
  12. $item_meta = new WC_Order_Item_Meta( $order_item, $product ); 
  13. $forproduct=$order_item['name'].' ('.$item_meta->display($flat=true, $return=true).')'; 
  14. echo '<strong>'; 
  15. printf( __('File for product: %s:', 'woocommerce-umf'), $forproduct); 
  16. echo '</strong><br>'; 
  17.  
  18. /** Controle of er al een bestand is geupload */ 
  19. $i=1; 
  20. $upload_count=0; 
  21. echo '<ul>'; 
  22. while ($i <= $max_upload_count) { 
  23. echo '<li>'; 
  24. $name = get_post_meta( $post->ID, '_woo_umf_uploaded_file_name_' . $j, true ); 
  25.  
  26. if (is_localhost()) { 
  27.  
  28. $url = get_post_meta( $post->ID, '_woo_umf_uploaded_file_path_' . $j, true ); 
  29.  
  30. } else { 
  31.  
  32. $url = site_url( str_replace( ABSPATH, '', get_post_meta( $post->ID, '_woo_umf_uploaded_file_path_' . $j, true ) ) ); 
  33.  
  34. $forproduct = get_post_meta( $post->ID, '_woo_umf_uploaded_product_name_' . $j, true ); 
  35. /** geen bestand geupload, dus toon upload velden */ 
  36. if( !empty( $url ) && !empty( $name ) ) { 
  37. printf( '<a href="%s" target="_blank">%s</a>', $url, $name ); 
  38. $upload_count++; 
  39. } else { 
  40. echo '<span style="color:red;">'; 
  41. printf( __('File #%s has not been uploaded.', 'woocommerce-umf'), $i ); 
  42. echo '</span>'; 
  43. $i++; 
  44. $j++; 
  45. echo '</li>'; 
  46. echo '</ul>'; 
  47. /** toon aantal nog aan te leveren bestanden */ 
  48. $upload_count=$max_upload_count-$upload_count; 
  49. echo '<p>'; 
  50. printf( __('Files to be uploaded for this item: %s', 'woocommerce-umf'), $upload_count ); 
  51. echo '</p>';