WCML_Ajax_Layered_Nav_Widget

Class for WooCommerce Advanced Ajax Layered Navigation.

Defined (1)

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

/compatibility/class-wcml-ajax-layered-nav-widget.php  
  1. class WCML_Ajax_Layered_Nav_Widget { 
  2. function __construct() { 
  3. add_filter('wc_ajax_layered_nav_sizeselector_term_id', array($this, 'wc_ajax_layered_nav_sizeselector_term_id')); 
  4. add_filter('wc_ajax_layered_nav_query_editor', array($this, 'wc_ajax_layered_nav_query_editor'), 10, 3); 
  5.  
  6. function wc_ajax_layered_nav_sizeselector_term_id($term_id) { 
  7. $ulanguage_code = apply_filters( 'wpml_default_language', null ); 
  8. $term_id = apply_filters( 'wpml_object_id', $term_id, 'category', true, $ulanguage_code ); 
  9. return $term_id; 
  10.  
  11. function wc_ajax_layered_nav_query_editor($posts, $attribute, $value) { 
  12. $posts = get_posts( 
  13. array( 
  14. 'post_type' => 'product',  
  15. 'numberposts' => -1,  
  16. 'post_status' => 'publish',  
  17. 'fields' => 'ids',  
  18. 'no_found_rows' => true,  
  19. 'tax_query' => array( 
  20. array( 
  21. 'taxonomy' => $attribute,  
  22. 'terms' => $value,  
  23. 'field' => 'term_id' 
  24. ); 
  25. return $posts;