WC_Compare_Product_Page_View_Compare_Button_Settings

The WooCommerce Compare Products LITE WC Compare Product Page View Button Settings class.

Defined (1)

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

/admin/settings/product-page/view-compare-settings.php  
  1. class WC_Compare_Product_Page_View_Compare_Button_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_view_compare_style'; 
  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.  
  30. array( 
  31. 'name' => __( "View Comparison Table", 'woocommerce-compare-products' ),  
  32. 'type' => 'heading',  
  33. 'class' => 'produc_page_compare_button_activate_container',  
  34. 'id' => 'product_page_view_compare_box',  
  35. 'is_box' => true,  
  36. ),  
  37. array(  
  38. 'name' => __( "View Compare Link", 'woocommerce-compare-products' ),  
  39. 'class' => 'disable_product_view_compare',  
  40. 'id' => 'disable_product_view_compare',  
  41. 'type' => 'onoff_checkbox',  
  42. 'default' => 0,  
  43. 'checked_value' => 0,  
  44. 'unchecked_value' => 1,  
  45. 'checked_label' => __( 'ON', 'woocommerce-compare-products' ),  
  46. 'unchecked_label' => __( 'OFF', 'woocommerce-compare-products' ),  
  47. ),  
  48.  
  49. array( 
  50. 'name' => __( 'View Compare Button / Hyperlink Style', 'woocommerce-compare-products' ),  
  51. 'type' => 'heading',  
  52. 'class' => 'product_page_view_compare_container',  
  53. 'id' => 'product_page_view_compare_type_box',  
  54. 'is_box' => true,  
  55. ),  
  56. array(  
  57. 'name' => __( 'View Compare Type', 'woocommerce-compare-products' ),  
  58. 'id' => 'product_view_compare_button_type',  
  59. 'class' => 'product_view_compare_button_type',  
  60. 'type' => 'switcher_checkbox',  
  61. 'default' => 'link',  
  62. 'checked_value' => 'button',  
  63. 'unchecked_value' => 'link',  
  64. 'checked_label' => __( 'Button', 'woocommerce-compare-products' ),  
  65. 'unchecked_label' => __( 'Hyperlink', 'woocommerce-compare-products' ),  
  66. ),  
  67.  
  68. array( 
  69. 'name' => '',  
  70. 'type' => 'heading',  
  71. 'class' => 'product_page_view_compare_hyperlink_styling_container',  
  72. 'id' => 'product_page_view_compare_hyperlink_box',  
  73. ),  
  74. array(  
  75. 'name' => __( 'Hyperlink Text', 'woocommerce-compare-products' ),  
  76. 'id' => 'product_view_compare_link_text',  
  77. 'type' => 'text',  
  78. 'default' => __('View Compare →', 'woocommerce-compare-products' ) 
  79. ),  
  80. array(  
  81. 'name' => __( 'Hyperlink Font', 'woocommerce-compare-products' ),  
  82. 'id' => 'product_view_compare_link_font',  
  83. 'type' => 'typography',  
  84. 'default' => array( 'size' => '12px', 'line_height' => '1.4em', 'face' => 'Arial, sans-serif', 'style' => 'bold', 'color' => '#000000' ) 
  85. ),  
  86.  
  87. array(  
  88. 'name' => __( 'Hyperlink Hover Colour', 'woocommerce-compare-products' ),  
  89. 'id' => 'product_view_compare_link_font_hover_colour',  
  90. 'type' => 'color',  
  91. 'default' => '#999999' 
  92. ),  
  93.  
  94. array( 
  95. 'name' => '',  
  96. 'type' => 'heading',  
  97. 'class' => 'product_page_view_compare_button_styling_container',  
  98. 'id' => 'product_page_view_compare_button_box',  
  99. ),  
  100. array(  
  101. 'name' => __( 'Button Text', 'woocommerce-compare-products' ),  
  102. 'id' => 'product_view_compare_button_text',  
  103. 'type' => 'text',  
  104. 'default' => __('View Compare →', 'woocommerce-compare-products' ) 
  105. ),  
  106. array(  
  107. 'name' => __( 'Button Font', 'woocommerce-compare-products' ),  
  108. 'id' => 'product_view_button_font',  
  109. 'type' => 'typography',  
  110. 'default' => array( 'size' => '12px', 'line_height' => '1.4em', 'face' => 'Arial, sans-serif', 'style' => 'bold', 'color' => '#FFFFFF' ) 
  111. ),  
  112. array(  
  113. 'name' => __( 'Button Padding', 'woocommerce-compare-products' ),  
  114. 'desc' => __( 'Padding from Button text to Button border', 'woocommerce-compare-products' ),  
  115. 'id' => 'product_view_compare_button_padding',  
  116. 'type' => 'array_textfields',  
  117. 'ids' => array(  
  118. array( 'id' => 'product_view_compare_button_padding_tb',  
  119. 'name' => __( 'Top/Bottom', 'woocommerce-compare-products' ),  
  120. 'class' => '',  
  121. 'css' => 'width:40px;',  
  122. 'default' => '7' ),  
  123.  
  124. array( 'id' => 'product_view_compare_button_padding_lr',  
  125. 'name' => __( 'Left/Right', 'woocommerce-compare-products' ),  
  126. 'class' => '',  
  127. 'css' => 'width:40px;',  
  128. 'default' => '8' ),  
  129. ),  
  130. array(  
  131. 'name' => __( 'Background Colour', 'woocommerce-compare-products' ),  
  132. 'id' => 'product_view_button_bg_colour',  
  133. 'type' => 'color',  
  134. 'default' => '#476381' 
  135. ),  
  136. array(  
  137. 'name' => __( 'Colour Gradient From', 'woocommerce-compare-products' ),  
  138. 'id' => 'product_view_button_bg_colour_from',  
  139. 'type' => 'color',  
  140. 'default' => '#538bbc' 
  141. ),  
  142.  
  143. array(  
  144. 'name' => __( 'Colour Gradient To', 'woocommerce-compare-products' ),  
  145. 'id' => 'product_view_button_bg_colour_to',  
  146. 'type' => 'color',  
  147. 'default' => '#476381' 
  148. ),  
  149. array(  
  150. 'name' => __( 'Button Border', 'woocommerce-compare-products' ),  
  151. 'id' => 'product_view_button_border',  
  152. 'type' => 'border',  
  153. 'default' => array( 'width' => '1px', 'style' => 'solid', 'color' => '#476381', 'corner' => 'rounded' , 'top_left_corner' => 3 , 'top_right_corner' => 3 , 'bottom_left_corner' => 3 , 'bottom_right_corner' => 3 ),  
  154. ),  
  155. array(  
  156. 'name' => __( 'Button Shadow', 'woocommerce-compare-products' ),  
  157. 'id' => 'product_view_button_shadow',  
  158. 'type' => 'box_shadow',  
  159. 'default' => array( 'enable' => 0, 'h_shadow' => '5px' , 'v_shadow' => '5px', 'blur' => '2px' , 'spread' => '2px', 'color' => '#999999', 'inset' => '' ) 
  160. ),  
  161.  
  162. )); 
  163.  
  164. public function include_script() { 
  165. ?> 
  166. <script> 
  167. (function($) { 
  168. $(document).ready(function() { 
  169.  
  170. if ( $("input.disable_product_page_compare:checked").val() != '0') { 
  171. $(".product_page_view_compare_container").css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden', 'margin-bottom' : '0px'} ); 
  172. } else { 
  173. if ( $("input.disable_product_view_compare:checked").val() != '0') { 
  174. $(".product_page_view_compare_container").css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden', 'margin-bottom' : '0px'} ); 
  175.  
  176. if ( $("input.product_view_compare_button_type:checked").val() == 'button') { 
  177. $(".product_page_view_compare_hyperlink_styling_container").css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden', 'margin-bottom' : '0px'} ); 
  178. } else { 
  179. $(".product_page_view_compare_button_styling_container").css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden', 'margin-bottom' : '0px'} ); 
  180.  
  181. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.disable_product_page_compare', function( event, value, status ) { 
  182. $('.product_page_view_compare_container').attr('style', 'display:none;'); 
  183. if ( status == 'true' ) { 
  184. if ( $("input.disable_product_view_compare:checked").val() == '0') { 
  185. $(".product_page_view_compare_container").slideDown(); 
  186. }); 
  187.  
  188. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.disable_product_view_compare', function( event, value, status ) { 
  189. $(".product_page_view_compare_container").attr('style', 'display:none;'); 
  190. if ( status == 'true' ) { 
  191. $(".product_page_view_compare_container").slideDown(); 
  192. }); 
  193.  
  194. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.product_view_compare_button_type', function( event, value, status ) { 
  195. $('.product_page_view_compare_button_styling_container').attr('style', 'display:none;'); 
  196. $('.product_page_view_compare_hyperlink_styling_container').attr('style', 'display:none;'); 
  197. if ( status == 'true') { 
  198. $(".product_page_view_compare_button_styling_container").slideDown(); 
  199. } else { 
  200. $(".product_page_view_compare_hyperlink_styling_container").slideDown(); 
  201. }); 
  202. }); 
  203. })(jQuery); 
  204. </script> 
  205. <?php