wccs_install_pro

The WooCommerce Checkout Manager wccs install pro function.

Description

wccs_install_pro(); 

Usage

  1. if ( !function_exists( 'wccs_install_pro' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-checkout-manager/woocommerce-checkout-manager.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wccs_install_pro(); 
  7.  

Defined (1)

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

/woocommerce-checkout-manager.php  
  1. function wccs_install_pro() { 
  2. $options = get_option( 'wccs_settings' ); 
  3. $options2 = get_option( 'wccs_settings2' ); 
  4. $options3 = get_option( 'wccs_settings3' ); 
  5.  
  6. update_option('wooccm_update_notice', 'no'); 
  7.  
  8. if ( function_exists( 'icl_register_string' ) ) { 
  9. icl_register_string('WooCommerce Checkout Manager', 'is a required field.', 'is a required field.'); 
  10.  
  11. if (empty($options['checkness']['position'])) { 
  12. $options['checkness']['position'] = 'after_order_notes'; 
  13.  
  14. if (empty($options['checkness']['wooccm_notification_email'])) { 
  15. $options['checkness']['wooccm_notification_email'] = get_option('admin_email'); 
  16.  
  17. if ( empty($options['checkness']['payment_method_d']) ) { 
  18. $options['checkness']['payment_method_d'] = 'Payment Method'; 
  19.  
  20. if ( empty($options['checkness']['time_stamp_title']) ) { 
  21. $options['checkness']['time_stamp_title'] = 'Order Time'; 
  22.  
  23. if ( empty($options['checkness']['payment_method_t']) ) { 
  24. $options['checkness']['payment_method_t'] = '1'; 
  25.  
  26. if ( empty($options['checkness']['shipping_method_d']) ) { 
  27. $options['checkness']['shipping_method_d'] = 'Shipping Method'; 
  28.  
  29. if ( empty($options['checkness']['shipping_method_t']) ) { 
  30. $options['checkness']['shipping_method_t'] = '1'; 
  31.  
  32.  
  33. if ( empty($options2['shipping_buttons']) ) { 
  34. $shipping = array( 'country' => 'Country', 'first_name' => 'First Name', 'last_name' => 'Last Name', 'company' => 'Company Name', 'address_1' => 'Address', 'address_2' => '', 'city' => 'Town/ City', 'state' => 'State', 'postcode' => 'Zip'); 
  35.  
  36. $ship = 0; 
  37. foreach( $shipping as $name => $value ) : 
  38.  
  39. $options2['shipping_buttons'][$ship]['label'] = __(''.$value.'', 'woocommerce'); 
  40. $options2['shipping_buttons'][$ship]['cow'] = $name; 
  41. $options2['shipping_buttons'][$ship]['checkbox'] = 'true'; 
  42. $options2['shipping_buttons'][$ship]['order'] = $ship + 1; 
  43. $options2['shipping_buttons'][$ship]['type'] = 'wooccmtext'; 
  44.  
  45. if ( $name == 'country') { 
  46. $options2['shipping_buttons'][$ship]['position'] = 'form-row-wide'; 
  47. }  
  48.  
  49. if ( $name == 'first_name') { 
  50. $options2['shipping_buttons'][$ship]['position'] = 'form-row-first'; 
  51. }  
  52.  
  53. if ( $name == 'last_name') { 
  54. $options2['shipping_buttons'][$ship]['position'] = 'form-row-last'; 
  55. $options2['shipping_buttons'][$ship]['clear_row'] = true; 
  56.  
  57. if ( $name == 'company') { 
  58. $options2['shipping_buttons'][$ship]['position'] = 'form-row-wide'; 
  59.  
  60. if ( $name == 'address_1') { 
  61. $options2['shipping_buttons'][$ship]['position'] = 'form-row-wide'; 
  62. $options2['shipping_buttons'][$ship]['placeholder'] = __('Street address', 'woocommerce'); 
  63.  
  64. if ( $name == 'address_2') { 
  65. $options2['shipping_buttons'][$ship]['position'] = 'form-row-wide'; 
  66. $options2['shipping_buttons'][$ship]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce'); 
  67. }  
  68.  
  69. if ( $name == 'city') { 
  70. $options2['shipping_buttons'][$ship]['position'] = 'form-row-wide'; 
  71. $options2['shipping_buttons'][$ship]['placeholder'] = __('Town / City', 'woocommerce'); 
  72.  
  73. if ( $name == 'state') { 
  74. $options2['shipping_buttons'][$ship]['position'] = 'form-row-first'; 
  75.  
  76. if ( $name == 'postcode') { 
  77. $options2['shipping_buttons'][$ship]['position'] = 'form-row-last'; 
  78. $options2['shipping_buttons'][$ship]['placeholder'] = __('Postcode / Zip', 'woocommerce'); 
  79. $options2['shipping_buttons'][$ship]['clear_row'] = true; 
  80.  
  81.  
  82. $ship++; 
  83. endforeach; 
  84.  
  85.  
  86. if ( empty($options3['billing_buttons']) ) { 
  87. $billing = array( 'country' => 'Country', 'first_name' => 'First Name', 'last_name' => 'Last Name', 'company' => 'Company Name', 'address_1' => 'Address', 'address_2' => '', 'city' => 'Town/ City', 'state' => 'State', 'postcode' => 'Zip', 'email' => 'Email Address', 'phone' => 'Phone' ); 
  88.  
  89. $bill = 0; 
  90. foreach( $billing as $name => $value ) : 
  91.  
  92. $options3['billing_buttons'][$bill]['label'] = __(''.$value.'', 'woocommerce'); 
  93. $options3['billing_buttons'][$bill]['cow'] = $name; 
  94. $options3['billing_buttons'][$bill]['checkbox'] = 'true'; 
  95. $options3['billing_buttons'][$bill]['order'] = $bill + 1; 
  96. $options3['billing_buttons'][$bill]['type'] = 'wooccmtext'; 
  97.  
  98. if ( $name == 'country') { 
  99. $options3['billing_buttons'][$bill]['position'] = 'form-row-wide'; 
  100. }  
  101.  
  102. if ( $name == 'first_name') { 
  103. $options3['billing_buttons'][$bill]['position'] = 'form-row-first'; 
  104. }  
  105.  
  106. if ( $name == 'last_name') { 
  107. $options3['billing_buttons'][$bill]['position'] = 'form-row-last'; 
  108. $options3['billing_buttons'][$bill]['clear_row'] = true; 
  109. }  
  110.  
  111. if ( $name == 'company') { 
  112. $options3['billing_buttons'][$bill]['position'] = 'form-row-wide'; 
  113. }  
  114.  
  115. if ( $name == 'address_1') { 
  116. $options3['billing_buttons'][$bill]['position'] = 'form-row-wide'; 
  117. $options3['billing_buttons'][$bill]['placeholder'] = __('Street address', 'woocommerce'); 
  118. }  
  119.  
  120. if ( $name == 'address_2') { 
  121. $options3['billing_buttons'][$bill]['position'] = 'form-row-wide'; 
  122. $options3['billing_buttons'][$bill]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce'); 
  123. }  
  124.  
  125. if ( $name == 'city') { 
  126. $options3['billing_buttons'][$bill]['position'] = 'form-row-wide'; 
  127. $options3['billing_buttons'][$bill]['placeholder'] = __('Town / City', 'woocommerce'); 
  128. }  
  129.  
  130. if ( $name == 'state') { 
  131. $options3['billing_buttons'][$bill]['position'] = 'form-row-first'; 
  132. }  
  133.  
  134. if ( $name == 'postcode') { 
  135. $options3['billing_buttons'][$bill]['position'] = 'form-row-last'; 
  136. $options3['billing_buttons'][$bill]['placeholder'] = __('Postcode / Zip', 'woocommerce'); 
  137. $options3['billing_buttons'][$bill]['clear_row'] = true; 
  138. }  
  139.  
  140. if ( $name == 'email') { 
  141. $options3['billing_buttons'][$bill]['position'] = 'form-row-first'; 
  142. }  
  143.  
  144. if ( $name == 'phone') { 
  145. $options3['billing_buttons'][$bill]['position'] = 'form-row-last'; 
  146. $options3['billing_buttons'][$bill]['clear_row'] = true; 
  147.  
  148.  
  149. $bill++; 
  150. endforeach; 
  151.  
  152.  
  153. if ( !empty($options['buttons']) ) { 
  154. foreach( $options['buttons'] as $i => $btn ) : 
  155.  
  156. if( !empty($btn['check_1']) || !empty($btn['check_2']) ) { 
  157. $options['buttons'][$i]['option_array'] = implode( '||', array(''.wpml_string_wccm_pro(''.$btn['check_1'].'').'', ''.wpml_string_wccm_pro(''.$btn['check_2'].'').'') ); 
  158. $options['buttons'][$i]['check_1'] = ''; 
  159. $options['buttons'][$i]['check_2'] = ''; 
  160. }  
  161.  
  162. $options['buttons'][$i]['type'] = ( $btn['type'] == 'checkbox' ) ? 'checkbox_wccm' : $btn['type']; 
  163. $options['buttons'][$i]['type'] = ( $btn['type'] == 'text' ) ? 'wooccmtext' : $btn['type']; 
  164. $options['buttons'][$i]['type'] = ( $btn['type'] == 'select' ) ? 'wooccmselect' : $btn['type']; 
  165. $options['buttons'][$i]['type'] = ( $btn['type'] == 'date' ) ? 'datepicker' : $btn['type']; 
  166.  
  167. if (empty($btn['option_array'])) { 
  168. $btn['option_array'] = ''; 
  169.  
  170. $mysecureop = explode( '||', $btn['option_array']); 
  171.  
  172. if ( !empty($btn['option_a']) ) { 
  173. array_push($mysecureop, $btn['option_a'] ); 
  174.  
  175. if ( !empty($btn['option_b']) ) { 
  176. array_push($mysecureop, $btn['option_b'] ); 
  177.  
  178. $uniqueThevalues = array_unique($mysecureop); 
  179.  
  180. $options['buttons'][$i]['option_array'] = implode( '||', $uniqueThevalues); 
  181.  
  182. endforeach; 
  183.  
  184. foreach( $options3['billing_buttons'] as $i => $btn ) : 
  185.  
  186. if( !empty($btn['check_1']) || !empty($btn['check_2']) ) { 
  187. $options3['billing_buttons'][$i]['option_array'] = implode( '||', array(''.wpml_string_wccm_pro(''.$btn['check_1'].'').'', ''.wpml_string_wccm_pro(''.$btn['check_2'].'').'') ); 
  188. $options3['billing_buttons'][$i]['check_1'] = ''; 
  189. $options3['billing_buttons'][$i]['check_2'] = ''; 
  190. }  
  191.  
  192. $options3['billing_buttons'][$i]['type'] = ( $btn['type'] == 'checkbox' ) ? 'checkbox_wccm' : $btn['type']; 
  193. $options3['billing_buttons'][$i]['type'] = ( $btn['type'] == 'text' ) ? 'wooccmtext' : $btn['type']; 
  194. $options3['billing_buttons'][$i]['type'] = ( $btn['type'] == 'select' ) ? 'wooccmselect' : $btn['type']; 
  195. $options3['billing_buttons'][$i]['type'] = ( $btn['type'] == 'date' ) ? 'datepicker' : $btn['type']; 
  196.  
  197. endforeach; 
  198.  
  199. foreach( $options2['shipping_buttons'] as $i => $btn ) : 
  200.  
  201. if( !empty($btn['check_1']) || !empty($btn['check_2']) ) { 
  202. $options2['shipping_buttons'][$i]['option_array'] = implode( '||', array(''.wpml_string_wccm_pro(''.$btn['check_1'].'').'', ''.wpml_string_wccm_pro(''.$btn['check_2'].'').'') ); 
  203. $options2['shipping_buttons'][$i]['check_1'] = ''; 
  204. $options2['shipping_buttons'][$i]['check_2'] = ''; 
  205.  
  206. $options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'checkbox' ) ? 'checkbox_wccm' : $btn['type']; 
  207. $options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'text' ) ? 'wooccmtext' : $btn['type']; 
  208. $options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'select' ) ? 'wooccmselect' : $btn['type']; 
  209. $options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'date' ) ? 'datepicker' : $btn['type']; 
  210.  
  211. endforeach; 
  212.  
  213. update_option( 'wccs_settings', $options ); 
  214. update_option( 'wccs_settings2', $options2 ); 
  215. update_option( 'wccs_settings3', $options3 );