function woof_draw_select_childs_h(&$collector, $selected_chain, $parent_data, $show_chain_always) { extract($parent_data); global $WOOF; $request = $WOOF->get_request_data(); //*** if (empty($parent_data['childs']) and $show_chain_always) { ?> <select class="woof_select woof_select_<?php echo $tax_slug; ?> woof_select_<?php echo $tax_slug; ?> _<?php echo $level; ?> " name="<?php echo $tax_slug; ?> " disabled=""> <option value="0"><?php echo WOOF_HELPER::wpml_translate($taxonomy_info, '', $level); ?> </option> </select> <?php if ($level < $deep - 1) { $parent_data['level'] += 1; woof_draw_select_childs_h($collector, $selected_chain, $parent_data, $show_chain_always); } } else { $woof_hide_dynamic_empty_pos = 0; //*** $current_request = array(); if ($WOOF->is_isset_in_request_data($tax_slug)) { $current_request = $request[$tax_slug]; $current_request = explode(',', urldecode($current_request)); } //excluding hidden terms $hidden_terms = array(); if (isset($WOOF->settings['excluded_terms'][$tax_slug])) { $hidden_terms = explode(',', $WOOF->settings['excluded_terms'][$tax_slug]); } $childs = apply_filters('woof_sort_terms_before_out', $childs, 'select'); $parent_data = array(); ?> <?php if (!empty($childs)) { ?> <select class="woof_select woof_select_<?php echo $tax_slug; ?> woof_select_<?php echo $tax_slug; ?> _<?php echo $level; ?> " name="<?php echo $tax_slug; ?> "> <option value="0"><?php echo WOOF_HELPER::wpml_translate($taxonomy_info, '', $level); ?> </option> <?php foreach ($childs as $term) { ?> <?php $count_string = ""; $count = 0; if (!in_array($term['slug'], $current_request)) { if ($show_count) { if ($show_count_dynamic) { $count = $WOOF->dynamic_count($term, 1, $_REQUEST['additional_taxes']); } else { $count = $term['count']; } $count_string = '(' . $count . ')'; } //+++ if ($hide_dynamic_empty_pos and $count == 0) { continue; } } if ($_REQUEST['hide_terms_count_txt']) { $count_string = ""; } //excluding hidden terms if (in_array($term['term_id'], $hidden_terms)) { continue; } ?> <option <?php if ($show_count and $count == 0 and !in_array($term['slug'], $current_request)) { ?> disabled=""<?php } ?> value="<?php echo $term['slug']; ?> " <?php echo selected(isset($selected_chain['chain'][$level]) and $selected_chain['chain'][$level] == $term['term_id']); ?> ><?php if (has_filter('woof_before_term_name')) { echo apply_filters('woof_before_term_name', $term, $taxonomy_info); } else { echo $term['name']; } ?> <?php echo $count_string; ?> </option> <?php if (!isset($collector[$tax_slug])) { $collector[$tax_slug] = array(); } $collector[$tax_slug][] = array('name' => $term['name'], 'slug' => $term['slug']); if (isset($selected_chain['chain'][$level]) and $selected_chain['chain'][$level] == $term['term_id']) { $parent_data['taxonomy_info'] = $taxonomy_info; $parent_data['tax_slug'] = $tax_slug; $parent_data['childs'] = $term['childs']; $parent_data['level'] = $level + 1; //this IS the index for $selected_chain on child drop-down $parent_data['deep'] = $deep; $parent_data['show_count'] = $show_count; $parent_data['show_count_dynamic'] = $show_count_dynamic; $parent_data['hide_dynamic_empty_pos'] = $hide_dynamic_empty_pos; } //+++ ?> <?php } ?> </select> <?php } ?> <?php if (!empty($parent_data)) { if (!empty($parent_data['childs'])) { woof_draw_select_childs_h($collector, $selected_chain, $parent_data, $show_chain_always); } } else { if (empty($parent_data) and $show_chain_always) { $parent_data['taxonomy_info'] = $taxonomy_info; $parent_data['tax_slug'] = $tax_slug; $parent_data['childs'] = array(); $parent_data['level'] = $level + 1; //this IS the index for $selected_chain on child drop-down $parent_data['deep'] = $deep; $parent_data['show_count'] = $show_count; $parent_data['show_count_dynamic'] = $show_count_dynamic; $parent_data['hide_dynamic_empty_pos'] = $hide_dynamic_empty_pos; //*** if ($level < $deep - 1) { woof_draw_select_childs_h($collector, $selected_chain, $parent_data, $show_chain_always); } } } } }
<?php } ?> <?php } } ?> <select class="woof_select woof_select_<?php echo $tax_slug; ?> " name="<?php echo $tax_slug; ?> "> <option value="0"><?php echo WOOF_HELPER::wpml_translate($taxonomy_info); ?> </option> <?php $woof_tax_values = array(); $current_request = array(); $request = $this->get_request_data(); if ($this->is_isset_in_request_data($tax_slug)) { $current_request = $request[$tax_slug]; $current_request = explode(',', urldecode($current_request)); } //excluding hidden terms $hidden_terms = array(); if (isset($this->settings['excluded_terms'][$tax_slug])) { $hidden_terms = explode(',', $this->settings['excluded_terms'][$tax_slug]); }
function woof_print_item_by_key($key, $woof_settings, $additional_taxes) { if (!woof_only($key, 'item')) { return; } //*** global $WOOF; switch ($key) { case 'by_price': if (isset($WOOF->settings['by_price']['show'])) { //just for compatibility from 2.1.2 to 2.1.3 $price_filter = (int) $WOOF->settings['by_price']['show']; } else { $price_filter = (int) get_option('woof_show_price_search', 0); } ?> <?php if ($price_filter == 1) { ?> <div data-css-class="woof_price_search_container" class="woof_price_search_container woof_container"> <div class="woof_container_overlay_item"></div> <div class="woof_container_inner"> <div class="woocommerce widget_price_filter"> <?php //the_widget('WC_Widget_Price_Filter', array('title' => '')); ?> <?php if (isset($WOOF->settings['by_price']['title_text']) and !empty($WOOF->settings['by_price']['title_text'])) { ?> <h4><?php echo $WOOF->settings['by_price']['title_text']; ?> </h4> <?php } ?> <?php WOOF_HELPER::price_filter(); ?> </div> </div> </div> <div style="clear:both;"></div> <?php } ?> <?php if ($price_filter == 2) { ?> <div data-css-class="woof_price2_search_container" class="woof_price2_search_container woof_container"> <div class="woof_container_overlay_item"></div> <div class="woof_container_inner"> <?php if (isset($WOOF->settings['by_price']['title_text']) and !empty($WOOF->settings['by_price']['title_text'])) { ?> <h4><?php echo $WOOF->settings['by_price']['title_text']; ?> </h4> <?php } ?> <?php echo do_shortcode('[woof_price_filter type="select" additional_taxes="' . $additional_taxes . '"]'); ?> </div> </div> <?php } ?> <?php if ($price_filter == 3) { ?> <div data-css-class="woof_price3_search_container" class="woof_price3_search_container woof_container"> <div class="woof_container_overlay_item"></div> <div class="woof_container_inner"> <?php if (isset($WOOF->settings['by_price']['title_text']) and !empty($WOOF->settings['by_price']['title_text'])) { ?> <h4><?php echo $WOOF->settings['by_price']['title_text']; ?> </h4> <?php } ?> <?php echo do_shortcode('[woof_price_filter type="slider" additional_taxes="' . $additional_taxes . '"]'); ?> </div> </div> <?php } ?> <?php break; default: do_action('woof_print_html_type_' . $key); break; } }
public function woof_shortcode($atts) { $args = array(); //this for synhronizating shortcode woof_products if its has attribute taxonomies if (isset($atts['taxonomies'])) { //$args['additional_taxes'] = $this->get_tax_query($atts['taxonomies']); $args['additional_taxes'] = $atts['taxonomies']; } else { $args['additional_taxes'] = ''; } //+++ $taxonomies = $this->get_taxonomies(); $allow_taxonomies = (array) $this->settings['tax']; $args['taxonomies'] = array(); if (!empty($taxonomies)) { foreach ($taxonomies as $tax_key => $tax) { if (!in_array($tax_key, array_keys($allow_taxonomies))) { continue; } //+++ $args['woof_settings'] = get_option('woof_settings', array()); $args['taxonomies_info'][$tax_key] = $tax; $hide_empty = false; $args['taxonomies'][$tax_key] = WOOF_HELPER::get_terms($tax_key, $hide_empty); } } //*** if (isset($atts['skin'])) { wp_enqueue_style('woof_skin_' . $atts['skin'], WOOF_LINK . 'css/shortcode_skins/' . $atts['skin'] . '.css'); } //*** if (isset($atts['sid'])) { $args['sid'] = $atts['sid']; wp_enqueue_script('woof_sid', WOOF_LINK . 'js/woof_sid.js'); } if (isset($atts['autohide'])) { $args['autohide'] = $atts['autohide']; } else { $args['autohide'] = 0; } $args['price_filter'] = get_option('woof_show_price_search', 0); //*** $args['show_woof_edit_view'] = 0; if (current_user_can('create_users')) { $args['show_woof_edit_view'] = 1; //wp_enqueue_script('jquery'); //wp_enqueue_script('jquery-ui-core', array('jquery')); //wp_enqueue_script('jquery-ui-dialog', array('jquery', 'jquery-ui-core')); //wp_enqueue_style('jquery-ui-dialog',includes_url('css/jquery-ui-dialog.min.css')); //wp_enqueue_style('jquery-ui-dialog', 'http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css'); } return $this->render_html(WOOF_PATH . 'views/woof.php', $args); }
<h4><?php echo WOOF_HELPER::wpml_translate($taxonomies_info[$tax_slug]); ?> </h4> <?php } echo $this->render_html(WOOF_PATH . 'views/html_types/mselect.php', $args); break; case 'color': //premium only break; default: if ($this->settings['show_title_label'][$tax_slug]) { ?> <h4><?php echo WOOF_HELPER::wpml_translate($taxonomies_info[$tax_slug]); ?> </h4> <?php } ?> <div <?php if (!empty($woof_container_styles)) { ?> style="<?php echo $woof_container_styles; ?> "<?php } ?> >
public function woof_shortcode($atts) { $args = array(); //this for synhronizating shortcode woof_products if its has attribute taxonomies if (isset($atts['taxonomies'])) { //$args['additional_taxes'] = $this->get_tax_query($atts['taxonomies']); $args['additional_taxes'] = $atts['taxonomies']; } else { $args['additional_taxes'] = ''; } //+++ $taxonomies = $this->get_taxonomies(); $allow_taxonomies = (array) (isset($this->settings['tax']) ? $this->settings['tax'] : array()); $args['taxonomies'] = array(); $hide_empty = false; if (!empty($taxonomies)) { foreach ($taxonomies as $tax_key => $tax) { if (!in_array($tax_key, array_keys($allow_taxonomies))) { continue; } //+++ $args['woof_settings'] = get_option('woof_settings', array()); $args['taxonomies_info'][$tax_key] = $tax; $args['taxonomies'][$tax_key] = WOOF_HELPER::get_terms($tax_key, $hide_empty); //show only subcategories if is_really_current_term_exists if ($this->is_really_current_term_exists()) { $t = $this->get_really_current_term(); if ($tax_key == $t->taxonomy) { if (isset($args['taxonomies'][$tax_key][$t->term_id])) { $args['taxonomies'][$tax_key] = $args['taxonomies'][$tax_key][$t->term_id]['childs']; } else { $parent = get_term($t->parent, $tax_key); $parents_ids = array(); $parents_ids[] = $parent->term_id; while ($parent->parent != 0) { $parent = get_term_by('id', $parent->parent, $tax_key); $parents_ids[] = $parent->term_id; } $parents_ids = array_reverse($parents_ids); //*** $tmp = $args['taxonomies'][$tax_key]; foreach ($parents_ids as $id) { $tmp = $tmp[$id]['childs']; } $args['taxonomies'][$tax_key] = $tmp[$t->term_id]['childs']; } } } } } //*** if (isset($atts['skin'])) { wp_enqueue_style('woof_skin_' . $atts['skin'], WOOF_LINK . 'css/shortcode_skins/' . $atts['skin'] . '.css'); } //*** if (isset($atts['sid'])) { $args['sid'] = $atts['sid']; wp_enqueue_script('woof_sid', WOOF_LINK . 'js/woof_sid.js'); } if (isset($atts['autohide'])) { $args['autohide'] = $atts['autohide']; } else { $args['autohide'] = 0; } if (isset($atts['redirect'])) { $args['redirect'] = $atts['redirect']; } else { $args['redirect'] = ''; } if (isset($atts['tax_only'])) { $args['tax_only'] = explode(',', $atts['tax_only']); } else { $args['tax_only'] = array(); } if (isset($atts['by_only'])) { $args['by_only'] = explode(',', $atts['by_only']); } else { $args['by_only'] = array(); } if (isset($atts['autosubmit'])) { $args['autosubmit'] = $atts['autosubmit']; } else { $args['autosubmit'] = get_option('woof_autosubmit', 0); } if (isset($atts['ajax_redraw'])) { $args['ajax_redraw'] = $atts['ajax_redraw']; } else { $args['ajax_redraw'] = 0; } if (isset($this->settings['by_price']['show'])) { //just for compatibility from 2.1.2 to 2.1.3 $args['price_filter'] = (int) $this->settings['by_price']['show']; } else { $args['price_filter'] = (int) get_option('woof_show_price_search', 0); } //*** $args['show_woof_edit_view'] = 1; if (current_user_can('create_users')) { $args['show_woof_edit_view'] = isset($this->settings['show_woof_edit_view']) ? (int) $this->settings['show_woof_edit_view'] : 1; } //lets assemble shortcode txt for ajax mode for data-shortcode in woof.php $_REQUEST['woof_shortcode_txt'] = 'woof '; if (!empty($atts)) { foreach ($atts as $key => $value) { if (($key == 'tax_only' or $key == 'by_only') and empty($value)) { continue; } $_REQUEST['woof_shortcode_txt'] .= $key . "='" . (is_array($value) ? explode(',', $value) : $value) . "' "; } } //$_REQUEST['woof_shortcode_txt'] = "woof tax_only='pa_color' by_only='none'"; return $this->render_html(WOOF_PATH . 'views/woof.php', $args); }
public function woof_shortcode($atts) { $args = array(); $args['taxonomies'] = array(); $taxonomies = $this->get_taxonomies(); $allow_taxonomies = isset($this->settings['tax']) ? (array) $this->settings['tax'] : array(); if (!empty($taxonomies)) { foreach ($taxonomies as $tax_key => $tax) { if (!in_array($tax_key, array_keys($allow_taxonomies))) { continue; } //+++ $args['woof_settings'] = get_option('woof_settings'); $args['taxonomies_info'][$tax_key] = $tax; $args['taxonomies'][$tax_key] = WOOF_HELPER::get_terms($tax_key); } } $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_register_script('wc-jquery-ui-touchpunch', WC()->plugin_url() . '/assets/js/frontend/jquery-ui-touch-punch' . $suffix . '.js', array('jquery-ui-slider'), WC_VERSION, true); wp_register_script('woof_front', WOOF_LINK . 'js/front.js', array('jquery-ui-slider', 'wc-jquery-ui-touchpunch')); wp_localize_script('woof_front', 'woocommerce_price_slider_params', array('currency_symbol' => get_woocommerce_currency_symbol(), 'currency_pos' => get_option('woocommerce_currency_pos'), 'min_price' => isset($_GET['min_price']) ? esc_attr($_GET['min_price']) : '', 'max_price' => isset($_GET['max_price']) ? esc_attr($_GET['max_price']) : '')); wp_enqueue_script('woof_front'); //*** return $this->render_html(WOOF_PATH . 'views/woof.php', $args); }
<?php if (!isset($woof_settings['price_filter2_ranges'])) { $woof_settings['price_filter2_ranges'] = ''; } ?> <h4 style="margin-bottom: 5px;"><?php _e('Drop-down price filter ranges', 'woocommerce-products-filter'); ?> </h4> <input style="width: 80%;" type="text" name="woof_settings[price_filter2_ranges]" value="<?php echo $woof_settings['price_filter2_ranges']; ?> " /><br /> <i><?php printf(__('Ranges for price filter when its activated as drop down. Example: 0-50,51-100,101-i. Where "i" is infinity. Max price is %s.', 'woocommerce-products-filter'), WOOF_HELPER::get_max_price()); ?> </i><br /> <br /> <?php if (!isset($woof_settings['price_filter2_1opt_txt'])) { $woof_settings['price_filter2_1opt_txt'] = ''; } ?> <h4 style="margin-bottom: 5px;"><?php _e('Drop-down price filter text', 'woocommerce-products-filter'); ?> </h4>
<input <?php echo @in_array($key, @array_keys($this->settings['tax'])) ? 'checked="checked"' : ''; ?> type="checkbox" name="woof_settings[tax][<?php echo $key; ?> ]" value="1" /> <?php echo $tax->labels->name; ?> <?php if ($woof_settings['tax_type'][$key] == 'color') { $terms = WOOF_HELPER::get_terms($key, 0, 0, 0, 0); if (!empty($terms)) { echo '<ul class="woof_color_list">'; foreach ($terms as $t) { $color = '#000000'; if (isset($woof_settings['color'][$key][$t['slug']])) { $color = $woof_settings['color'][$key][$t['slug']]; } ?> <li> <table> <tr> <td valign="top"> <input type="text" name="woof_settings[color][<?php echo $key; ?>
<div class="woof-name-description"> <h3><?php _e('Drop-down', 'woocommerce-products-filter'); ?> </h3> <strong><?php _e('Drop-down price filter ranges', 'woocommerce-products-filter'); ?> </strong> <span><?php _e('Ranges for price filter.', 'woocommerce-products-filter'); ?> </span> <span><?php printf(__('Example: 0-50,51-100,101-i. Where "i" is infinity. Max price is %s.', 'woocommerce-products-filter'), WOOF_HELPER::get_max_price()); ?> </span> </div> <div class="woof-form-element"> <input type="text" class="woof_popup_option" data-option="ranges" placeholder="" value="" /> </div> </div> <div class="woof-form-element-container"> <div class="woof-name-description"> <strong><?php _e('Drop-down price filter text', 'woocommerce-products-filter');
<?php if (!defined('ABSPATH')) { die('No direct access allowed'); } if (!isset($additional_taxes)) { $additional_taxes = ''; } $price2_filter_data = WOOF_HELPER::get_price2_filter_data($additional_taxes); $price_filter2_1opt_txt = __('filter by price', 'woocommerce-products-filter'); if (isset($this->settings['by_price']['first_option_text'])) { if (!empty($this->settings['by_price']['first_option_text'])) { $price_filter2_1opt_txt = $this->settings['by_price']['first_option_text']; } } if (isset($placeholder)) { $price_filter2_1opt_txt = $placeholder; } $show_count = get_option('woof_show_count', 0); $show_count_dynamic = get_option('woof_show_count_dynamic', 0); $hide_dynamic_empty_pos = 0; ?> <div class="woof_price_filter_dropdown_container"> <select class="woof_price_filter_dropdown"> <option value="-1"><?php echo $price_filter2_1opt_txt; ?> </option> <?php
} ?> <?php wp_enqueue_script('ion.range-slider', WOOF_LINK . 'js/ion.range-slider/js/ion-rangeSlider/ion.rangeSlider.min.js', array('jquery')); wp_enqueue_style('ion.range-slider', WOOF_LINK . 'js/ion.range-slider/css/ion.rangeSlider.css'); $ion_slider_skin = 'skinNice'; if (isset($this->settings['by_price']['ion_slider_skin'])) { $ion_slider_skin = $this->settings['by_price']['ion_slider_skin']; } wp_enqueue_style('ion.range-slider-skin', WOOF_LINK . 'js/ion.range-slider/css/ion.rangeSlider.' . $ion_slider_skin . '.css'); //*** $request = $this->get_request_data(); $uniqid = uniqid(); $preset_min = WOOF_HELPER::get_min_price(); $preset_max = WOOF_HELPER::get_max_price(); $min_price = $this->is_isset_in_request_data('min_price') ? esc_attr($request['min_price']) : $preset_min; $max_price = $this->is_isset_in_request_data('max_price') ? esc_attr($request['max_price']) : $preset_max; //*** if (class_exists('WOOCS')) { $preset_min = apply_filters('woocs_exchange_value', $preset_min); $preset_max = apply_filters('woocs_exchange_value', $preset_max); $min_price = apply_filters('woocs_exchange_value', $min_price); $max_price = apply_filters('woocs_exchange_value', $max_price); } //*** $slider_step = 1; if (isset($this->settings['by_price']['ion_slider_step'])) { $slider_step = $this->settings['by_price']['ion_slider_step']; if (!$slider_step) { $slider_step = 1;
<div class="woof_container_inner"> <?php global $WOOF; $woof_text = ''; $request = $WOOF->get_request_data(); if (isset($request['woof_text'])) { $woof_text = $request['woof_text']; } //+++ if (!isset($placeholder)) { $p = __('enter a product title here ...', 'woocommerce-products-filter'); } if (isset($WOOF->settings['by_text']['placeholder']) and !isset($placeholder)) { if (!empty($WOOF->settings['by_text']['placeholder'])) { $p = $WOOF->settings['by_text']['placeholder']; $p = WOOF_HELPER::wpml_translate(null, $p); $p = __($p, 'woocommerce-products-filter'); } if ($WOOF->settings['by_text']['placeholder'] == 'none') { $p = ''; } } //*** $unique_id = uniqid('woof_text_search_'); ?> <table class="woof_text_table"> <tr> <td style="width: 100%;"> <input type="search" class="woof_show_text_search <?php echo $unique_id;