wooccm_additional_gen

The WooCommerce Checkout Manager wooccm additional gen function.

Description

wooccm_additional_gen( $tab, $abbr, $section, (string) $wooname ); 

Parameters (4)

0. $tab
The tab.
1. $abbr
The abbr.
2. $section
The section.
3. $wooname (string)
The wooname.

Usage

  1. if ( !function_exists( 'wooccm_additional_gen' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-checkout-manager/includes/classes/export.php'; 
  3.  
  4. // The tab. 
  5. $tab = null; 
  6.  
  7. // The abbr. 
  8. $abbr = null; 
  9.  
  10. // The section. 
  11. $section = null; 
  12.  
  13. // The wooname. 
  14. $wooname = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = wooccm_additional_gen($tab, $abbr, $section, $wooname); 
  18.  

Defined (1)

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

/includes/classes/export.php  
  1. function wooccm_additional_gen( $tab, $abbr, $section, $wooname ) { 
  2. global $woocommerce, $wpdb; 
  3. $options = get_option( 'wccs_settings' ); 
  4. $options2 = get_option( 'wccs_settings2' ); // shipping 
  5. $options3 = get_option( 'wccs_settings3' ); // billing 
  6.  
  7. $args = array( 
  8. 'post_type' => 'shop_order',  
  9. 'posts_per_page' => -1,  
  10. 'post_status' => array( 'wc-processing', 'wc-completed' ) 
  11. ); 
  12.  
  13. $loop = new WP_Query( $args ); 
  14. $csv_output = ''; 
  15.  
  16. if ( $wooname == 'additional' ) { 
  17. $optionname = $options['buttons']; 
  18. }  
  19. elseif ( $wooname == 'shipping' ) { 
  20. $optionname = $options2['shipping_buttons']; 
  21. elseif ( $wooname == 'billing' ) { 
  22. $optionname = $options3['billing_buttons']; 
  23.  
  24. if( !empty($abbr) && $section == 1 ) { 
  25. if ( $tab == $wooname ) { 
  26. while ( $loop->have_posts() ) { 
  27. $loop->the_post(); 
  28. $order_id = $loop->post->ID; 
  29. $order = new WC_Order($order_id); 
  30.  
  31. if ( get_post_meta($order_id, $abbr, true) ) { 
  32. $csv_output .= '["'.$order->billing_first_name.' '.$order->billing_last_name.'", "'.get_post_meta($order_id, $abbr, true).'" ], '; 
  33. }  
  34. }elseif ($tab == 'heading' ) {  
  35. $csv_output .= '["Name", "'.$abbr.'"]'; 
  36. } elseif( empty($abbr) && $section == 2 ) { 
  37. if ( $tab == $wooname ) { 
  38.  
  39. while ( $loop->have_posts() ) { 
  40. $loop->the_post(); 
  41. $order_id = $loop->post->ID; 
  42. $order = new WC_Order($order_id); 
  43. foreach( $optionname as $name ) { 
  44. if ( get_post_meta($order_id, $name['cow'], true) ) { 
  45. $listida[] = $order_id;  
  46. $csv_output = array_unique($listida); 
  47. }elseif ($tab == 'heading' ) { 
  48. while ( $loop->have_posts() ) { 
  49. $loop->the_post(); 
  50. $order_id = $loop->post->ID; 
  51. $order = new WC_Order($order_id); 
  52. foreach( $optionname as $n) { 
  53. if ( get_post_meta($order_id, $n['cow'], true) ) {  
  54. $lista[] = $n['label']; 
  55. $csv_output = array_unique($lista); 
  56. return $csv_output;