public static function standard_fields($with_attr = true)
 {
     $fields = array('image' => __('Image', 'yith-woocommerce-compare'), 'title' => __('Title', 'yith-woocommerce-compare'), 'price' => __('Price', 'yith-woocommerce-compare'), 'add-to-cart' => __('Add to cart', 'yith-woocommerce-compare'), 'description' => __('Description', 'yith-woocommerce-compare'), 'stock' => __('Availability', 'yith-woocommerce-compare'));
     if ($with_attr) {
         $fields = array_merge($fields, YITH_Woocompare_Helper::attribute_taxonomies());
     }
     return $fields;
 }
        /**
         * Create new Woocommerce admin field: checkboxes
         *
         * @access public
         * @param array $value
         * @return void
         * @since 1.0.0
         */
        public function admin_fields_attributes($value)
        {
            $fields = YITH_Woocompare_Helper::standard_fields();
            $all = array();
            $checked = get_option(str_replace('_attrs', '', $value['id']), $value['default'] == 'all' ? $all : array());
            foreach (array_keys($fields) as $field) {
                $all[$field] = true;
            }
            // then add fields that are not still saved
            foreach ($checked as $k => $v) {
                unset($all[$k]);
            }
            $checkboxes = array_merge($checked, $all);
            ?>
			<tr valign="top">
				<th scope="row" class="titledesc">
					<label for="<?php 
            echo esc_attr($value['id']);
            ?>
"><?php 
            echo $value['name'];
            ?>
</label>
				</th>

				<td class="forminp attributes">
					<p class="description"><?php 
            echo $value['desc'];
            ?>
</p>
					<ul class="fields">
						<?php 
            foreach ($checkboxes as $slug => $checked) {
                if (!isset($fields[$slug])) {
                    continue;
                }
                ?>
							<li>
								<label>
									<input type="checkbox" name="<?php 
                echo $value['id'];
                ?>
[]" id="<?php 
                echo $value['id'];
                ?>
_<?php 
                echo $slug;
                ?>
" value="<?php 
                echo $slug;
                ?>
"<?php 
                checked($checked);
                ?>
 /> <?php 
                echo $fields[$slug];
                ?>
								</label>
							</li>
						<?php 
            }
            ?>
					</ul>
					<input type="hidden" name="<?php 
            echo $value['id'];
            ?>
_positions" value="<?php 
            echo implode(',', array_keys($checkboxes));
            ?>
" />
				</td>
			</tr>
		<?php 
        }
 /**
  * Constructor
  *
  * @return YITH_Woocompare_Frontend
  * @since 1.0.0
  */
 public function __construct()
 {
     // set coookiename
     if (is_multisite()) {
         $this->cookie_name .= '_' . get_current_blog_id();
     }
     // populate the list of products
     $this->products_list = isset($_COOKIE[$this->cookie_name]) ? unserialize($_COOKIE[$this->cookie_name]) : array();
     // populate default fields for the comparison table
     $this->default_fields = YITH_Woocompare_Helper::standard_fields();
     // add image size
     YITH_Woocompare_Helper::set_image_size();
     // Add link or button in the products list or
     if (get_option('yith_woocompare_compare_button_in_product_page') == 'yes') {
         add_action('woocommerce_single_product_summary', array($this, 'add_compare_link'), 35);
     }
     if (get_option('yith_woocompare_compare_button_in_products_list') == 'yes') {
         add_action('woocommerce_after_shop_loop_item', array($this, 'add_compare_link'), 20);
     }
     add_action('init', array($this, 'add_product_to_compare_action'));
     add_action('init', array($this, 'remove_product_from_compare_action'));
     add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
     add_action('template_redirect', array($this, 'compare_table_html'));
     // add the shortcode
     add_shortcode('yith_compare_button', array($this, 'compare_button_sc'));
     // AJAX
     add_action('wp_ajax_' . $this->action_add, array($this, 'add_product_to_compare_ajax'));
     add_action('wp_ajax_nopriv_' . $this->action_add, array($this, 'add_product_to_compare_ajax'));
     add_action('wp_ajax_' . $this->action_remove, array($this, 'remove_product_from_compare_ajax'));
     add_action('wp_ajax_nopriv_' . $this->action_remove, array($this, 'remove_product_from_compare_ajax'));
     add_action('wp_ajax_' . $this->action_view, array($this, 'refresh_widget_list_ajax'));
     add_action('wp_ajax_nopriv_' . $this->action_view, array($this, 'refresh_widget_list_ajax'));
     return $this;
 }
        /**
         * Create new Woocommerce admin field: checkboxes
         *
         * @access public
         * @param array $value
         * @return void
         * @since 1.0.0
         */
        public function admin_fields_attributes($value)
        {
            $fields = array_merge($this->default_fields, YITH_Woocompare_Helper::attribute_taxonomies());
            $all = array();
            foreach (array_keys($fields) as $field) {
                $all[$field] = true;
            }
            $checkboxes = get_option($value['id'], $value['default'] == 'all' ? $all : array());
            // add fields that are not still saved
            $checkboxes = wp_parse_args($checkboxes, $all);
            //$checkboxes = array_merge( $checkboxes, array_diff_assoc( $checkboxes, $all ) );
            ?>
        <tr valign="top">
            <th scope="row" class="titledesc">
                <label for="<?php 
            echo esc_attr($value['id']);
            ?>
"><?php 
            echo $value['name'];
            ?>
</label>
            </th>

            <td class="forminp attributes">
                <p class="description"><?php 
            echo $value['desc'];
            ?>
</p>
                <ul class="fields">
                    <?php 
            foreach ($checkboxes as $slug => $checked) {
                ?>
                    <li><label><input type="checkbox" name="<?php 
                echo $value['id'];
                ?>
[]" id="<?php 
                echo $value['id'];
                ?>
_<?php 
                echo $slug;
                ?>
" value="<?php 
                echo $slug;
                ?>
"<?php 
                checked($checked);
                ?>
 /> <?php 
                echo $fields[$slug];
                ?>
</label></li><?php 
            }
            ?>
                </ul>
                <input type="hidden" name="<?php 
            echo $value['id'];
            ?>
_positions" value="<?php 
            echo implode(',', array_keys($checkboxes));
            ?>
" />
            </td>
        </tr>
    <?php 
        }