public static function mdtf_catalog_ordering($atts = array()) { if (self::is_page_mdf_data()) { $page_meta_data_filter = self::get_page_mdf_data(); list($meta_query_array, $filter_post_blocks_data, $widget_options) = MetaDataFilterHtml::get_meta_query_array($page_meta_data_filter); if (isset($widget_options['woo_search_panel_id']) and intval($widget_options['woo_search_panel_id']) > 0) { remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30); remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); $post_id = intval($widget_options['woo_search_panel_id']); $data = array(); $data['settings'] = self::get_woo_search_values($post_id); if (!empty($data['settings']) and is_array($data['settings'])) { $data['order_by'] = isset($_REQUEST['order_by']) ? $_REQUEST['order_by'] : self::$default_order_by; $data['order'] = isset($_REQUEST['order']) ? $_REQUEST['order'] : self::$default_order; $panel_type = get_post_meta($post_id, 'panel_type', TRUE); if (!$panel_type) { $panel_type = 'select'; } //*** if ($panel_type == 'select') { echo self::render_html(self::get_application_path() . 'views/sort_panel/select_filter_panel.php', $data); } else { echo self::render_html(self::get_application_path() . 'views/sort_panel/button_filter_panel.php', $data); } //+++ $show_results_tax_navigation = get_post_meta($post_id, 'show_results_tax_navigation', true); if ($show_results_tax_navigation) { echo do_shortcode('[mdf_results_tax_navigation]'); } } } } else { $post_id = 0; if (isset($atts['panel_id'])) { $post_id = $atts['panel_id']; } else { $post_id = (int) self::get_setting('default_sort_panel'); } if (isset($_REQUEST['mdf_panel_id']) and $_REQUEST['mdf_panel_id'] > 0) { $post_id = $_REQUEST['mdf_panel_id']; } //+++ $data = array(); $data['settings'] = self::get_woo_search_values($post_id); if (!empty($data['settings']) and is_array($data['settings'])) { $data['order_by'] = isset($_REQUEST['order_by']) ? $_REQUEST['order_by'] : self::$default_order_by; $data['order'] = isset($_REQUEST['order']) ? $_REQUEST['order'] : self::$default_order; $panel_type = get_post_meta($post_id, 'panel_type', TRUE); if (!$panel_type) { $panel_type = 'select'; } //*** if ($panel_type == 'select') { echo self::render_html(self::get_application_path() . 'views/sort_panel/select_filter_panel.php', $data); } else { echo self::render_html(self::get_application_path() . 'views/sort_panel/button_filter_panel.php', $data); } //+++ $show_results_tax_navigation = get_post_meta($post_id, 'show_results_tax_navigation', true); if ($show_results_tax_navigation) { echo do_shortcode('[mdf_results_tax_navigation]'); } } } }
wp_reset_postdata(); //+++ $meta_query_array = array(); $filter_post_blocks_data = array(); //+++ if (self::is_page_mdf_data()) { $page_meta_data_filter = self::get_page_mdf_data(); //+++ if (!empty($page_meta_data_filter)) { $taxonomies = array(); if (isset($page_meta_data_filter['taxonomy'])) { $taxonomies = $page_meta_data_filter['taxonomy']; unset($page_meta_data_filter['taxonomy']); } //+++ list($meta_query_array, $filter_post_blocks_data, $widget_options) = MetaDataFilterHtml::get_meta_query_array($page_meta_data_filter); $meta_data_filter_bool = isset($_GET['meta_data_filter_bool']) ? $_GET['meta_data_filter_bool'] : 'AND'; } } else { return; } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //Taxonomies in process ... $tax_query_array = MetaDataFilterHtml::get_tax_query_array($taxonomies); $mdf_tax_bool = 'AND'; if (!empty($tax_query_array)) { $mdf_tax_bool = isset($_GET['mdf_tax_bool']) ? $_GET['mdf_tax_bool'] : 'AND'; } //*** additional taxonomies for Pre-sale question: //I have woocommerce with brands plugin installed, each brand page shows the products of this brand, //can this plugin filter those products based on category?