public function initialize()
 {
     $options = get_option('codenegar_product_filter');
     $defaults = $this->helper->default_options();
     $merged = codenegar_parse_args($options, $defaults);
     $this->options = $this->helper->array_to_object($merged);
     $this->helper->register_sidebars();
     $this->helper->register_shortcode();
     add_filter('widget_text', 'do_shortcode');
     // Enables using shortcode in text widget
 }
 public function initialize()
 {
     $options = get_option('codenegar_product_filter');
     $defaults = $this->helper->default_options();
     $merged = codenegar_parse_args($options, $defaults);
     $this->options = $this->helper->array_to_object($merged);
     // clear old wcpf caches hook
     if ($this->options->cache_count == 'yes') {
         add_action('codenegar_clear_old_wcpf_caches', 'codenegar_clear_old_wcpf_caches');
     }
     $this->helper->register_sidebars();
     $this->helper->register_shortcode();
     $this->helper->enable_custom_order();
     add_filter('widget_text', 'do_shortcode');
     // Enables using shortcode in text widget
 }
Example #3
0
    public function custom_taxonomy_dropdown($args)
    {
        $css_id = 'wcpf_custom_taxonomy_dropdown_' . $args['custom_taxonomy'];
        ?>
		<div id="<?php 
        echo $css_id;
        ?>
" class="codenegar_product_filter_wrap wcpf_updating_widget attr_dropdown <?php 
        echo 'wcpf_custom_taxonomy_dropdown_' . $args['custom_taxonomy'];
        ?>
  <?php 
        echo $args['custom_class'];
        ?>
">
			<span class="codenegar_product_filter_title"><?php 
        echo $args['sub_title'];
        ?>
</span>
			<?php 
        global $codenegar_wcpf;
        $options = array('user_val' => '');
        $options = codenegar_parse_args($options, $args);
        $this->dropdown_ctax_front($options);
        ?>

		</div>

		<?php 
    }
    public function widget($args, $instance)
    {
        // Frontend widget form
        global $codenegar_wcpf;
        if (!$codenegar_wcpf->helper->is_wcpf_area()) {
            // Not on product page - return
            return;
        }
        $defaults = $this->defaults();
        if (count($instance) > 0) {
            // not first time
            $instance = codenegar_parse_args($instance, array('print_before_widget' => 'false', 'print_after_widget' => 'false', 'hide_empty' => 'false'));
            // if it has been saved and checkboxes have no value means there were unchecked
        }
        $instance = codenegar_parse_args($instance, $defaults);
        extract($instance);
        extract($args);
        // $before_widget, $print_before_widget,... are defined by extracting arrays
        $before_widget = $codenegar_wcpf->helper->add_master_wrap_class($before_widget);
        if ($print_before_widget == 'true') {
            if ($type == 'list' || $type == 'dropdown') {
                $before_widget = $codenegar_wcpf->helper->add_layered_class($before_widget);
            }
            echo $before_widget;
        }
        echo $before_title;
        echo $title;
        echo $after_title;
        ?>

			<?php 
        if ($instance['hide_empty'] == 'true') {
            $instance['hide_empty'] = 1;
        } else {
            $instance['hide_empty'] = 0;
        }
        codenegar_wcpf_generate_widget($instance);
        ?>

		<?php 
        if ($print_after_widget == 'true') {
            echo $after_widget;
        }
    }
Example #5
0
    public function widget($args, $instance)
    {
        // Frontend widget form
        global $codenegar_wcpf;
        if (!is_tax('product_cat') && !is_post_type_archive('product') && !is_tax('product_tag') && !$codenegar_wcpf->helper->is_product_archive()) {
            return;
        }
        // Not on product page - return
        $defaults = $this->defaults();
        if (count($instance) > 0) {
            // not first time
            $instance = codenegar_parse_args($instance, array('print_before_widget' => 'false', 'print_after_widget' => 'false', 'use_theme_toggle_effect' => 'false'));
            // if it has been saved and checkboxes have no value means there were unchecked
        }
        $instance = codenegar_parse_args($instance, $defaults);
        extract($instance);
        extract($args);
        $before_widget = $codenegar_wcpf->helper->add_master_wrap_class($before_widget);
        if ($print_before_widget == 'true') {
            if (($type == 'list' || $type == 'dropdown') && $use_theme_toggle_effect == 'true') {
                $before_widget = $codenegar_wcpf->helper->add_layered_class($before_widget);
            }
            echo $before_widget;
        }
        echo $before_title;
        echo $title;
        echo $after_title;
        ?>
			
			<?php 
        codenegar_wcpf_generate_widget($instance);
        ?>
			
		<?php 
        if ($print_after_widget == 'true') {
            echo $after_widget;
        }
    }
Example #6
0
    ?>
</p></div>
	<?php 
}
if (!$is_wc) {
    ?>
	<div class="error"><p><?php 
    _e('WooCommerce not found. Get a version at <a href="https://wordpress.org/plugins/woocommerce/">WordPress.rg</a>. ', $codenegar_wcpf->text_domain);
    ?>
</p></div>
	<?php 
    die;
}
$codenegar_product_filter_options = get_option('codenegar_product_filter');
$defaults = $codenegar_wcpf->helper->default_options();
$codenegar_product_filter_options = codenegar_parse_args($codenegar_product_filter_options, $defaults);
?>
<script>
var sidebars = [ <?php 
echo $codenegar_wcpf->helper->get_sidebars_object($codenegar_product_filter_options['sidebars']);
?>
];
(function($) {
$(document).ready(function() {
		$(function() {
			$(".chzn-select").chosen({width: "162px"});
		});
	});
})(jQuery);
</script>
<div class="wrap">
Example #7
0
    public function widget($args, $instance)
    {
        // Fronend widget form
        global $codenegar_wcpf;
        if (!is_tax('product_cat') && !is_post_type_archive('product') && !is_tax('product_tag') && !$codenegar_wcpf->helper->is_product_archive()) {
            return;
        }
        // Not on product page - return
        if (count($instance) > 0) {
            // not first time
            $instance = codenegar_parse_args($instance, array('print_before_widget' => 'false', 'print_after_widget' => 'false', 'hide_empty' => 'false', 'hide_on_cats' => 'false'));
            // if it has been saved and checkboxes have no value means there were unchecked
        }
        if ($instance['hide_on_cats'] == 'true' && is_tax('product_cat')) {
            return;
        }
        // this is a category archive and user selected to hide on cats so hide it
        $defaults = $this->defaults();
        $instance = codenegar_parse_args($instance, $defaults);
        extract($instance);
        extract($args);
        $before_widget = $codenegar_wcpf->helper->add_master_wrap_class($before_widget);
        if ($print_before_widget == 'true') {
            if ($type == 'list' || $type == 'dropdown') {
                $before_widget = $codenegar_wcpf->helper->add_layered_class($before_widget);
            }
            echo $before_widget;
        }
        echo $before_title;
        echo $title;
        echo $after_title;
        ?>
			
			<?php 
        if ($instance['hide_empty'] == 'true') {
            $instance['hide_empty'] = 1;
        } else {
            $instance['hide_empty'] = 0;
        }
        codenegar_wcpf_generate_widget($instance);
        ?>
			
		<?php 
        if ($print_after_widget == 'true') {
            echo $after_widget;
        }
    }
Example #8
0
    public function widget($args, $instance)
    {
        // Fronend widget form
        if (!is_tax('product_cat') && !is_post_type_archive('product') && !is_tax('product_tag')) {
            return;
        }
        // Not on product page - return
        global $codenegar_wcpf;
        $defaults = $this->defaults();
        if (count($instance) > 0) {
            // not first time
            $instance = codenegar_parse_args($instance, array('print_before_widget' => 'false', 'print_after_widget' => 'false'));
            // if it has been saved and checkboxes have no value means there were unchecked
        }
        $instance = codenegar_parse_args($instance, $defaults);
        extract($instance);
        extract($args);
        $before_widget = $codenegar_wcpf->helper->add_master_wrap_class($before_widget);
        if ($print_before_widget == 'true') {
            echo $before_widget;
        }
        echo $before_title;
        echo $title;
        echo $after_title;
        $url = get_pagenum_link();
        $url = $codenegar_wcpf->helper->remove_filter_parameters($url);
        ?>

			<div class="codenegar_product_filter_wrap reset_button <?php 
        echo $custom_class;
        ?>
">
			<a href="#" rel="nofollow" data-url="<?php 
        echo $url;
        ?>
" class="codenegar_product_filter_reset_button button"><?php 
        echo $sub_title;
        ?>
</a>
			</div>
		<?php 
        // removed "product_type_simple" css class from above line
        if ($print_after_widget == 'true') {
            echo $after_widget;
        }
    }
Example #9
0
 public function dropdown_cat($options = array())
 {
     global $codenegar_wcpf;
     $defaults = array('type' => 'post', 'taxonomy' => 'product_cat', 'orderby' => 'id', 'order' => 'ASC', 'include_last_update_time' => false, 'hierarchical' => true, 'pad_counts' => false, 'selected' => 0, 'name' => 'cat', 'id' => '', 'class' => 'postform', 'echo' => true, 'child_of' => 0, 'depth' => 0, 'show_option_all' => __('Any category', $codenegar_wcpf->text_domain), 'echo' => 1);
     $merged = codenegar_parse_args($options, $defaults);
     return wp_dropdown_categories($merged);
 }