wooccm_generate_csv

Converting data to CSV [ SETTINGS DATA ].

Description

wooccm_generate_csv( $tab ); 

Parameters (1)

0. $tab
The tab.

Usage

  1. if ( !function_exists( 'wooccm_generate_csv' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-checkout-manager/includes/classes/export.php'; 
  3.  
  4. // The tab. 
  5. $tab = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wooccm_generate_csv($tab); 
  9.  

Defined (1)

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

/includes/classes/export.php  
  1. function wooccm_generate_csv($tab) { 
  2.  
  3. $options = get_option( 'wccs_settings' ); 
  4. $options2 = get_option( 'wccs_settings2' ); 
  5. $options3 = get_option( 'wccs_settings3' ); 
  6.  
  7. $csv_output = ''; 
  8.  
  9. if ( $tab == 'additional' ) { 
  10.  
  11. if ( !empty($options['buttons']) ) { 
  12.  
  13. $total = count($options['buttons']) - 1; 
  14.  
  15. foreach( $options['buttons'] as $i => $btn) { 
  16. if( $i != 999 && !empty($btn['cow']) ) { 
  17. $csv_output .= '['; 
  18.  
  19. foreach($btn as $n => $dataw) { 
  20. $csv_output .= '"'.$dataw.'", '; 
  21.  
  22. if ( $i != $total ) { 
  23. $csv_output .= '], '; 
  24. } else { 
  25. $csv_output .= ']';  
  26. }elseif ($tab == 'billing' ) { 
  27.  
  28. $total = count($options3['billing_buttons']) - 1; 
  29.  
  30. if (!empty($options3['billing_buttons']) ) { 
  31. foreach( $options3['billing_buttons'] as $i => $btn) { 
  32. if( $i != 999 && !empty($btn['cow']) ) { 
  33. $csv_output .= '['; 
  34.  
  35. foreach($btn as $n => $dataw) { 
  36. $csv_output .= '"'.$dataw.'", '; 
  37.  
  38. if ( $i != $total) { 
  39. $csv_output .= '], '; 
  40. } else { 
  41. $csv_output .= ']';  
  42. }  
  43. }elseif ( $tab == 'shipping') { 
  44. $total = count($options2['shipping_buttons']) -1; 
  45.  
  46. if( !empty($options2['shipping_buttons']) ) { 
  47. foreach( $options2['shipping_buttons'] as $i => $btn) { 
  48. if( $i != 999 && !empty($btn['cow']) ) { 
  49. $csv_output .= '['; 
  50.  
  51. foreach($btn as $n => $dataw) { 
  52. $csv_output .= '"'.$dataw.'", ';  
  53.  
  54. if ( $i != $total) { 
  55. $csv_output .= '], '; 
  56. } else { 
  57. $csv_output .= ']';  
  58. elseif ( $tab == 'general') { 
  59.  
  60. if( !empty($options['checkness']) ) { 
  61. $csv_output .= '['; 
  62. foreach( $options['checkness'] as $i => $btn) { 
  63. $csv_output .= '"'.$btn.'", ';  
  64. $csv_output .= ']';  
  65. }elseif ($tab == 'heading' ) { 
  66.  
  67. if (!empty($options3['billing_buttons']) ) { 
  68. $csv_output .= '['; 
  69.  
  70. foreach( $options3['billing_buttons'][0] as $n => $dataw) { 
  71. $csv_output .= '"'.$n.'", '; 
  72.  
  73. $csv_output .= ']';  
  74. }elseif ($tab == 'heading3' ) { 
  75.  
  76. if (!empty($options['buttons']) ) { 
  77. $csv_output .= '['; 
  78.  
  79. foreach( $options['buttons'][0] as $n => $dataw) { 
  80. $csv_output .= '"'.$n.'", '; 
  81.  
  82. $csv_output .= ']';  
  83. }  
  84. }elseif ($tab == 'heading2' ) { 
  85.  
  86. if (!empty($options['checkness']) ) { 
  87. $csv_output .= '['; 
  88. foreach( $options['checkness'] as $n => $btn) { 
  89. $csv_output .= '"'.$n.'", '; 
  90. $csv_output .= ']';  
  91. }  
  92.  
  93.  
  94. return $csv_output;