WC_Compare_Product_Page_Compare_Tab_Settings

The WooCommerce Compare Products LITE WC Compare Product Page Tab Settings class.

Defined (1)

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

/admin/settings/product-page/compare-tab-settings.php  
  1. class WC_Compare_Product_Page_Compare_Tab_Settings 
  2.  
  3. /** 
  4. * @var string 
  5. * You must change to correct form key that you are working 
  6. */ 
  7. public $form_key = 'woo_compare_product_page_tab'; 
  8.  
  9. /** 
  10. * @var array 
  11. */ 
  12. public $form_fields = array(); 
  13.  
  14. /**-----------------------------------------------------------------------------------*/ 
  15. /** __construct() */ 
  16. /** Settings Constructor */ 
  17. /**-----------------------------------------------------------------------------------*/ 
  18. public function __construct() { 
  19. $this->init_form_fields(); 
  20.  
  21. /**-----------------------------------------------------------------------------------*/ 
  22. /** init_form_fields() */ 
  23. /** Init all fields of this form */ 
  24. /**-----------------------------------------------------------------------------------*/ 
  25. public function init_form_fields() { 
  26.  
  27. // Define settings 
  28. $this->form_fields = apply_filters( $this->form_key . '_settings_fields', array( 
  29. array( 
  30. 'name' => __( "Product Page Compare Tab", 'woocommerce-compare-products' ),  
  31. 'type' => 'heading',  
  32. 'id' => 'product_page_compare_tab_box',  
  33. 'is_box' => true,  
  34. ),  
  35. array(  
  36. 'name' => __( "Compare Features Tab", 'woocommerce-compare-products' ),  
  37. 'class' => 'disable_compare_featured_tab',  
  38. 'id' => 'disable_compare_featured_tab',  
  39. 'type' => 'onoff_checkbox',  
  40. 'default' => 0,  
  41. 'checked_value' => 0,  
  42. 'unchecked_value' => 1,  
  43. 'checked_label' => __( 'ON', 'woocommerce-compare-products' ),  
  44. 'unchecked_label' => __( 'OFF', 'woocommerce-compare-products' ),  
  45. ),  
  46.  
  47. array( 
  48. 'name' => __( "Compare Tab Position", 'woocommerce-compare-products' ),  
  49. 'class' => 'produc_page_compare_tab_activate_container',  
  50. 'type' => 'heading',  
  51. 'id' => 'product_page_compare_tab_position_box',  
  52. ),  
  53. array(  
  54. 'name' => __( 'Compare Features Tab', 'woocommerce-compare-products' ),  
  55. 'desc_tip' => __( 'Select the position of the Compare Features tab on the default WooCommerce product page Nav bar. Products Compare feature list shows under the tab.', 'woocommerce-compare-products' ),  
  56. 'id' => 'auto_compare_featured_tab',  
  57. 'type' => 'onoff_radio',  
  58. 'default' => 29,  
  59. 'onoff_options' => array( 
  60. array( 
  61. 'val' => 9,  
  62. 'text' => __( 'Before Description tab', 'woocommerce-compare-products' ),  
  63. 'checked_label' => __( 'ON', 'woocommerce-compare-products' ) ,  
  64. 'unchecked_label' => __( 'OFF', 'woocommerce-compare-products' ) ,  
  65. ),  
  66. array( 
  67. 'val' => 19,  
  68. 'text' => __( 'Between Description and Additional tabs', 'woocommerce-compare-products' ),  
  69. 'checked_label' => __( 'ON', 'woocommerce-compare-products' ) ,  
  70. 'unchecked_label' => __( 'OFF', 'woocommerce-compare-products' ) ,  
  71. ),  
  72. array( 
  73. 'val' => 29,  
  74. 'text' => __( 'Between Additional and Reviews tabs', 'woocommerce-compare-products' ),  
  75. 'checked_label' => __( 'ON', 'woocommerce-compare-products' ) ,  
  76. 'unchecked_label' => __( 'OFF', 'woocommerce-compare-products' ) ,  
  77. ),  
  78. array( 
  79. 'val' => 31,  
  80. 'text' => __( 'After Reviews tab', 'woocommerce-compare-products' ),  
  81. 'checked_label' => __( 'ON', 'woocommerce-compare-products' ) ,  
  82. 'unchecked_label' => __( 'OFF', 'woocommerce-compare-products' ) ,  
  83. ),  
  84. ),  
  85. ),  
  86. array(  
  87. 'name' => __( 'Compare Tab Name', 'woocommerce-compare-products' ),  
  88. 'id' => 'compare_featured_tab',  
  89. 'type' => 'text',  
  90. 'default' => __('Technical Details', 'woocommerce-compare-products' ) 
  91. ),  
  92.  
  93. )); 
  94.  
  95. public function include_script() { 
  96. ?> 
  97. <script> 
  98. (function($) { 
  99.  
  100. $(document).ready(function() { 
  101.  
  102. if ( $("input.disable_compare_featured_tab:checked").val() != '0') { 
  103. $(".produc_page_compare_tab_activate_container").css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden', 'margin-bottom' : '0px'} ); 
  104.  
  105. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.disable_compare_featured_tab', function( event, value, status ) { 
  106. $(".produc_page_compare_tab_activate_container").attr('style', 'display:none;'); 
  107. if ( status == 'true' ) { 
  108. $(".produc_page_compare_tab_activate_container").slideDown(); 
  109. }); 
  110.  
  111. }); 
  112.  
  113. })(jQuery); 
  114. </script> 
  115. <?php  
  116.