YITH WooCommerce Ajax Product Filter - Version 3.0.2

Version Description

  • Released: Jul 4, 2016 =

  • Fixed: Filters disappears in sort count select on Avada theme

  • Fixed: Filter by attributes doesn't works with WooCommerce 2.5

  • Fixed: rtrim waring in untrailingslashit

  • Fixed: Wrong filter on category page with WooCommerce 2.6.2

Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Ajax Product Filter
Version 3.0.2
Comparing to
See all releases

Code changes from version 3.0.1 to 3.0.2

README.txt CHANGED
@@ -159,6 +159,13 @@ If you want to see a demonstration version of the premium plugin, you can see it
159
 
160
  == Changelog ==
161
 
 
 
 
 
 
 
 
162
  = 3.0.1 - Released: Jun 14, 2016 =
163
 
164
  * Fixed: print empty li tag after update to version 3.0.0
159
 
160
  == Changelog ==
161
 
162
+ = 3.0.2 - Released: Jul 4, 2016 =
163
+
164
+ * Fixed: Filters disappears in sort count select on Avada theme
165
+ * Fixed: Filter by attributes doesn't works with WooCommerce 2.5
166
+ * Fixed: rtrim waring in untrailingslashit
167
+ * Fixed: Wrong filter on category page with WooCommerce 2.6.2
168
+
169
  = 3.0.1 - Released: Jun 14, 2016 =
170
 
171
  * Fixed: print empty li tag after update to version 3.0.0
assets/js/yith-wcan-frontend.js CHANGED
@@ -229,6 +229,18 @@ jQuery(function ($) {
229
  widget_reload(t)
230
  });
231
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  //update browser history (IE doesn't support it)
233
  if (yith_wcan.change_browser_url == 1 && !navigator.userAgent.match(/msie/i)) {
234
  window.history.pushState({"pageTitle": response.pageTitle}, "", href);
229
  widget_reload(t)
230
  });
231
 
232
+ /* === Avada Theme Support === */
233
+ if( yith_wcan.avada.is_enabled == 1 ) {
234
+ var avada_sort_count = $(yith_wcan.avada.sort_count);
235
+ avada_sort_count.html($(response).find(yith_wcan.avada.sort_count).html());
236
+
237
+ if (t.text() == '') {
238
+ avada_sort_count.hide();
239
+ } else {
240
+ avada_sort_count.show();
241
+ }
242
+ }
243
+
244
  //update browser history (IE doesn't support it)
245
  if (yith_wcan.change_browser_url == 1 && !navigator.userAgent.match(/msie/i)) {
246
  window.history.pushState({"pageTitle": response.pageTitle}, "", href);
assets/js/yith-wcan-frontend.min.js CHANGED
@@ -1,15 +1,15 @@
1
- jQuery(function(a){function u(a,p){return a.replace(new RegExp("[?&]"+p+"=[^&#]*(#.*)?$"),"$1").replace(new RegExp("([?&])"+p+"=[^&]*&"),"$1")}var y=/(?!(\[))(\.)[^.#[]*/g,z=/(#)[^.#[]*/,A=/^[\w]+/,B=/^[\w]+$/,v=function(g,p){var b=[];if(B.test(g))b=[{tag:g}];else{for(var b=g,d={sel:[],val:[]},f=[],k=!1,h="",l=[],c=0,m=b.length;c<m;c++){var e=b.charAt(c);if(k)if("\\"===e&&c+1<b.length)l.push(b.charAt(++c));else if(h===e)h="",l.push(e);else if(("'"===e||'"'===e)&&""===h)h=e,l.push(e);else if("]"===
2
- e&&""===h)d.val.push(l.join("")),l=[],k=!1;else{if("]"!==e||""!==h)""===h&&","===e?(d.val.push(l.join("")),l=[]):l.push(e)}else"\\"===e&&c+1<b.length?k&&l.push(b.charAt(++c)):"["===e&&""===h?k=!0:" "===e||"+"===e?(d.sel=d.sel.join(""),f.push(d),"+"===e&&f.push({sel:"+",val:""}),d={sel:[],val:[]}):" "!==e&&"]"!==e&&d.sel.push(e)}if(0!=d.sel.length||0!=d.val.length)d.sel=d.sel.join(""),f.push(d);for(c=0;c<f.length;c++){d=f[c].sel;if("+"===d)n.tag=d;else{var n=[];n.tag=A.exec(d);n.id=z.exec(d);n.id&&
3
- a.isArray(n.id)&&(n.id=n.id[0].substr(1));n.tag||(n.tag="div");n.vars=[];for(b=0;b<f[c].val.length;b++)h=f[c].val[b].indexOf("="),k=f[c].val[b].substr(0,h),h=f[c].val[b].substr(h+1),h=h.replace(/^[\s]*[\"\']*|[\"\']*[\s]*$/g,""),"text"===k?n.text=h:n.vars.push([k,h]);d=d.match(y);k=[];if(d){for(b=0;b<d.length;b++)k.push(d[b].substr(1));n.className=k.join(" ")}}f[c]=n}b=f}n=[];"undefined"===typeof p&&(p=1);d=[];f=[];k=[];h=document.createElement("div");for(c=l=0;c<b.length;c++){if("+"==b[c].tag)f=
4
- k.slice(),--l;else{for(m=0;m<p;m++)if("input"==b[c].tag){e=[];e.push("<"+b[c].tag);b[c].id&&e.push("id='"+b[c].id+"'");b[c].className&&(e.push("class='"+b[c].className),c+1===b.length&&e.push(lastClass),e.push("'"));if(b[c].vars)for(var q=0;q<b[c].vars.length;q++)e.push(b[c].vars[q][0]+"='"+b[c].vars[q][1]+"'");b[c].text&&e.push("value='"+b[c].text+"'");e.push("/>");k[m]=f[m];f[m]?(f[m].innerHTML+=e.join(" "),f[m]=f[m].lastChild):(h.innerHTML=e.join(" "),f[m]=h.removeChild(h.firstChild))}else{e=document.createElement(b[c].tag);
5
- if(b[c].vars)for(q=0;q<b[c].vars.length;q++)console.log(b[c].tag,b[c].vars[q]),e.setAttribute(b[c].vars[q][0],b[c].vars[q][1]);b[c].id&&(e.id=b[c].id);b[c].className&&(e.className=b[c].className);b[c].text&&e.appendChild(document.createTextNode(b[c].text));k[m]=f[m];f[m]=f[m]?f[m].appendChild(e):e}l++||Array.prototype.push.apply(d,f)}n=a.merge(n,f)}return a(d)},w=function(g,p,b){for(var d=g.match(/%[^%]*%/g)||[],f=[],k=0;k<p.length;k++){for(var h=g,l=0;l<d.length;l++)var c=d[l].substr(1,d[l].length-
6
- 2),h=h.replace(d[l],p[k][c]);f=a.merge(f,v(h,b))}return a(f)};a.jseldom=function(g){if(2==arguments.length&&a.isPlainObject(arguments[1]))return w.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!a.isArray(arguments[1]))return v.apply(this,arguments);if(2==arguments.length)return w.apply(this,arguments)};var r=!1,x=function(){var g=a("#yith-wcan-reset-all-categories").find("a.yith-wcan-reset-categories-link"),p=a("#yith-wcan-reset-all-tags").find("a.yith-wcan-reset-tags-link");
7
- g.add(p).on("click",function(b){a(this).yith_wcan_ajax_filters(b,this)})};a.fn.yith_wcan_ajax_filters=function(g,p){g.preventDefault();var b=p.href,d=a(p),f=d.hasClass("yith-wcan-reset-navigation");if("undefined"==typeof b&&d.parents().hasClass("price_slider_wrapper")){d.parents("form");var k=window.location,h=k.origin+k.pathname,l=h!=k.href,c=a(".price_slider_amount #min_price").val(),m=a(".price_slider_amount #max_price").val(),b=k.href;1==l&&(b=u(b,"min_price"),b=u(b,"max_price"));b=b+(h==b?"?":
8
- "&")+a.param({min_price:c,max_price:m})}"select"==d.data("type")&&(d.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),d.parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300));a(yith_wcan.container).not(".ywcps-products").html("").addClass("yith-wcan-loading");a(document).trigger("yith-wcan-ajax-loading");"undefined"!=typeof yith_wcan_frontend&&a(yith_wcan.container).not(".ywcps-products").css("backgroundImage",
9
  "url("+yith_wcan_frontend.loader_url+")");1==yith_wcan.is_mobile&&a(window).scrollTop(a(yith_wcan.scroll_top).offset().top);a(yith_wcan.pagination).hide();a(yith_wcan.result_count).hide();0!=r&&(r.abort(),r=!1);r=a.ajax({url:b,success:function(c){r=!1;a(yith_wcan.container).not(".ywcps-products").removeClass("yith-wcan-loading");0<a(c).find(yith_wcan.container).not(".ywcps-products").length?a(".yit-wcan-container").html(a(c).find(yith_wcan.container).not(".ywcps-products")):a(".yit-wcan-container").html(a(c).find(".woocommerce-info"));
10
  0<a(c).find(yith_wcan.pagination).length?(0==a(yith_wcan.pagination).length&&a.jseldom(yith_wcan.pagination).insertAfter(a(yith_wcan.container).not(".ywcps-products")),a(yith_wcan.pagination).html(a(c).find(yith_wcan.pagination).html()).show()):a(yith_wcan.pagination).empty();a("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />');0<a(c).find(yith_wcan.result_count).length&&
11
- a(yith_wcan.result_count).html(a(c).find(yith_wcan.result_count).html()).show();a(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var b=a(this),d=b.attr("id");b.html(a(c).find("#"+d).html());""==b.text()?b.hide():b.show()});1!=yith_wcan.change_browser_url||navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",b);a(document).trigger("ready");a(document).trigger("yith-wcan-ajax-filtered");
12
- a(window).trigger("scroll");if(f){if("undefined"!=typeof a.fn.slider){var d=parseInt(a(yith_wcan.wc_price_slider.min_price).data("min")),g=parseInt(a(yith_wcan.wc_price_slider.max_price).data("max"));a(yith_wcan.wc_price_slider.wrapper).slider("values",[d,g]);a(document.body).trigger("price_slider_slide",[d,g])}a(document).trigger("yith-wcan-ajax-reset-filtered")}x()}})};a(yith_wcan.container).not(".ywcps-products").wrap('<div class="yit-wcan-container"></div>');a(document).on("yith-wcan-wrapped",
13
- function(){x()});a(document).trigger("yith-wcan-wrapped");a(document).on("click",".yith-wcan a",function(g){a(this).yith_wcan_ajax_filters(g,this)});var t=function(){a("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},0);a("a.yit-wcan-select-open").removeClass("active")};a(document).on("click","a.yit-wcan-select-open.active",function(g){g.preventDefault();a(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",
14
- opacity:0},300);a(this).parent().find("a.yit-wcan-select-open").removeClass("active")});a(document).on("click","a.yit-wcan-select-open:not(.active)",function(g){g.preventDefault();a(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","1").animate({visibility:"visible",opacity:1},300);a(this).parent().find("a.yit-wcan-select-open").addClass("active")});a(document).on("ready yith-wcan-ajax-filtered",function(){a("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");t();a("div.yith-wcan-select-wrapper").each(function(){var g=
15
- "";a(this).find("ul.yith-wcan-select li.chosen").each(function(){g+=a(this).text()+", "});g=g.substring(0,g.length-2);""!=g&&a(this).parent().find("a.yit-wcan-select-open").text(g)})});a(document).on("ready",t);a("body").on("click",function(g){a(g.target).hasClass("yit-wcan-select-open")||t()})});
1
+ jQuery(function(a){function u(a,p){return a.replace(new RegExp("[?&]"+p+"=[^&#]*(#.*)?$"),"$1").replace(new RegExp("([?&])"+p+"=[^&]*&"),"$1")}var y=/(?!(\[))(\.)[^.#[]*/g,z=/(#)[^.#[]*/,A=/^[\w]+/,B=/^[\w]+$/,v=function(k,p){var b;if(B.test(k))b=[{tag:k}];else{b=k;for(var e={sel:[],val:[]},n=[],f=!1,h="",m=[],l=0,g=b.length;l<g;l++){var c=b.charAt(l);if(f)if("\\"===c&&l+1<b.length)m.push(b.charAt(++l));else if(h===c)h="",m.push(c);else if(("'"===c||'"'===c)&&""===h)h=c,m.push(c);else if("]"===c&&
2
+ ""===h)e.val.push(m.join("")),m=[],f=!1;else{if("]"!==c||""!==h)""===h&&","===c?(e.val.push(m.join("")),m=[]):m.push(c)}else"\\"===c&&l+1<b.length?f&&m.push(b.charAt(++l)):"["===c&&""===h?f=!0:" "===c||"+"===c?(e.sel=e.sel.join(""),n.push(e),"+"===c&&n.push({sel:"+",val:""}),e={sel:[],val:[]}):" "!==c&&"]"!==c&&e.sel.push(c)}if(0!=e.sel.length||0!=e.val.length)e.sel=e.sel.join(""),n.push(e);for(l=0;l<n.length;l++){e=n[l].sel;if("+"===e)d.tag=e;else{var d=[];d.tag=A.exec(e);d.id=z.exec(e);d.id&&a.isArray(d.id)&&
3
+ (d.id=d.id[0].substr(1));d.tag||(d.tag="div");d.vars=[];for(b=0;b<n[l].val.length;b++)h=n[l].val[b].indexOf("="),f=n[l].val[b].substr(0,h),h=n[l].val[b].substr(h+1),h=h.replace(/^[\s]*[\"\']*|[\"\']*[\s]*$/g,""),"text"===f?d.text=h:d.vars.push([f,h]);e=e.match(y);f=[];if(e){for(b=0;b<e.length;b++)f.push(e[b].substr(1));d.className=f.join(" ")}}n[l]=d}b=n}e=[];"undefined"===typeof p&&(p=1);n=[];f=[];h=[];m=document.createElement("div");for(g=l=0;g<b.length;g++){if("+"==b[g].tag)f=h.slice(),--l;else{for(c=
4
+ 0;c<p;c++)if("input"==b[g].tag){d=[];d.push("<"+b[g].tag);b[g].id&&d.push("id='"+b[g].id+"'");b[g].className&&(d.push("class='"+b[g].className),g+1===b.length&&d.push(lastClass),d.push("'"));if(b[g].vars)for(var q=0;q<b[g].vars.length;q++)d.push(b[g].vars[q][0]+"='"+b[g].vars[q][1]+"'");b[g].text&&d.push("value='"+b[g].text+"'");d.push("/>");h[c]=f[c];f[c]?(f[c].innerHTML+=d.join(" "),f[c]=f[c].lastChild):(m.innerHTML=d.join(" "),f[c]=m.removeChild(m.firstChild))}else{d=document.createElement(b[g].tag);
5
+ if(b[g].vars)for(q=0;q<b[g].vars.length;q++)console.log(b[g].tag,b[g].vars[q]),d.setAttribute(b[g].vars[q][0],b[g].vars[q][1]);b[g].id&&(d.id=b[g].id);b[g].className&&(d.className=b[g].className);b[g].text&&d.appendChild(document.createTextNode(b[g].text));h[c]=f[c];f[c]=f[c]?f[c].appendChild(d):d}l++||Array.prototype.push.apply(n,f)}e=a.merge(e,f)}return a(n)},w=function(k,p,b){for(var e=k.match(/%[^%]*%/g)||[],n=[],f=0;f<p.length;f++){for(var h=k,m=0;m<e.length;m++)var l=e[m].substr(1,e[m].length-
6
+ 2),h=h.replace(e[m],p[f][l]);n=a.merge(n,v(h,b))}return a(n)};a.jseldom=function(k){if(2==arguments.length&&a.isPlainObject(arguments[1]))return w.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!a.isArray(arguments[1]))return v.apply(this,arguments);if(2==arguments.length)return w.apply(this,arguments)};var r=!1,x=function(){var k=a("#yith-wcan-reset-all-categories").find("a.yith-wcan-reset-categories-link"),p=a("#yith-wcan-reset-all-tags").find("a.yith-wcan-reset-tags-link");
7
+ k.add(p).on("click",function(b){a(this).yith_wcan_ajax_filters(b,this)})};a.fn.yith_wcan_ajax_filters=function(k,p){k.preventDefault();var b=p.href,e=a(p),n=e.hasClass("yith-wcan-reset-navigation");if("undefined"==typeof b&&e.parents().hasClass("price_slider_wrapper")){e.parents("form");var f=window.location,h=f.origin+f.pathname,m=h!=f.href,l=a(".price_slider_amount #min_price").val(),g=a(".price_slider_amount #max_price").val(),b=f.href;1==m&&(b=u(b,"min_price"),b=u(b,"max_price"));b=b+(h==b?"?":
8
+ "&")+a.param({min_price:l,max_price:g})}"select"==e.data("type")&&(e.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),e.parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300));a(yith_wcan.container).not(".ywcps-products").html("").addClass("yith-wcan-loading");a(document).trigger("yith-wcan-ajax-loading");"undefined"!=typeof yith_wcan_frontend&&a(yith_wcan.container).not(".ywcps-products").css("backgroundImage",
9
  "url("+yith_wcan_frontend.loader_url+")");1==yith_wcan.is_mobile&&a(window).scrollTop(a(yith_wcan.scroll_top).offset().top);a(yith_wcan.pagination).hide();a(yith_wcan.result_count).hide();0!=r&&(r.abort(),r=!1);r=a.ajax({url:b,success:function(c){r=!1;a(yith_wcan.container).not(".ywcps-products").removeClass("yith-wcan-loading");0<a(c).find(yith_wcan.container).not(".ywcps-products").length?a(".yit-wcan-container").html(a(c).find(yith_wcan.container).not(".ywcps-products")):a(".yit-wcan-container").html(a(c).find(".woocommerce-info"));
10
  0<a(c).find(yith_wcan.pagination).length?(0==a(yith_wcan.pagination).length&&a.jseldom(yith_wcan.pagination).insertAfter(a(yith_wcan.container).not(".ywcps-products")),a(yith_wcan.pagination).html(a(c).find(yith_wcan.pagination).html()).show()):a(yith_wcan.pagination).empty();a("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />');0<a(c).find(yith_wcan.result_count).length&&
11
+ a(yith_wcan.result_count).html(a(c).find(yith_wcan.result_count).html()).show();a(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var b=a(this),d=b.attr("id");b.html(a(c).find("#"+d).html());""==b.text()?b.hide():b.show()});if(1==yith_wcan.avada.is_enabled){var d=a(yith_wcan.avada.sort_count);d.html(a(c).find(yith_wcan.avada.sort_count).html());""==e.text()?d.hide():d.show()}1!=yith_wcan.change_browser_url||
12
+ navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",b);a(document).trigger("ready");a(document).trigger("yith-wcan-ajax-filtered");a(window).trigger("scroll");if(n){if("undefined"!=typeof a.fn.slider){var d=parseInt(a(yith_wcan.wc_price_slider.min_price).data("min")),f=parseInt(a(yith_wcan.wc_price_slider.max_price).data("max"));a(yith_wcan.wc_price_slider.wrapper).slider("values",[d,f]);a(document.body).trigger("price_slider_slide",[d,f])}a(document).trigger("yith-wcan-ajax-reset-filtered")}x()}})};
13
+ a(yith_wcan.container).not(".ywcps-products").wrap('<div class="yit-wcan-container"></div>');a(document).on("yith-wcan-wrapped",function(){x()});a(document).trigger("yith-wcan-wrapped");a(document).on("click",".yith-wcan a",function(k){a(this).yith_wcan_ajax_filters(k,this)});var t=function(){a("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},0);a("a.yit-wcan-select-open").removeClass("active")};a(document).on("click","a.yit-wcan-select-open.active",function(k){k.preventDefault();
14
+ a(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300);a(this).parent().find("a.yit-wcan-select-open").removeClass("active")});a(document).on("click","a.yit-wcan-select-open:not(.active)",function(k){k.preventDefault();a(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","1").animate({visibility:"visible",opacity:1},300);a(this).parent().find("a.yit-wcan-select-open").addClass("active")});a(document).on("ready yith-wcan-ajax-filtered",
15
+ function(){a("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");t();a("div.yith-wcan-select-wrapper").each(function(){var k="";a(this).find("ul.yith-wcan-select li.chosen").each(function(){k+=a(this).text()+", "});k=k.substring(0,k.length-2);""!=k&&a(this).parent().find("a.yit-wcan-select-open").text(k)})});a(document).on("ready",t);a("body").on("click",function(k){a(k.target).hasClass("yit-wcan-select-open")||t()})});
includes/class.yith-wcan-frontend.php CHANGED
@@ -45,9 +45,15 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
45
  */
46
  public function __construct( $version ) {
47
  $this->version = $version;
48
-
 
49
  //Actions
50
- add_action( 'init', array( $this, 'woocommerce_layered_nav_init' ), 99 );
 
 
 
 
 
51
 
52
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
53
 
@@ -173,7 +179,12 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
173
  ),
174
  'is_mobile' => wp_is_mobile(),
175
  'scroll_top' => yith_wcan_get_option('yith_wcan_ajax_scroll_top_class', '.yit-wcan-container'),
176
- 'change_browser_url' => 'yes' == yith_wcan_get_option( 'yith_wcan_change_browser_url', 'yes' ) ? true : false
 
 
 
 
 
177
  )
178
  );
179
 
@@ -190,8 +201,11 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
190
  * @return void
191
  */
192
  public function woocommerce_layered_nav_init() {
 
 
 
193
 
194
- if ( is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) && ! is_admin() ) {
195
 
196
  $_chosen_attributes = YITH_WCAN()->get_layered_nav_chosen_attributes();
197
 
@@ -228,11 +242,13 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
228
  }
229
 
230
  if ( YITH_WCAN()->is_wc_older_2_1 ) {
231
- add_filter( 'loop_shop_post_in', 'woocommerce_layered_nav_query' );
 
232
  }
233
 
234
  elseif ( YITH_WCAN()->is_wc_older_2_6 ) {
235
- add_filter( 'loop_shop_post_in', array( WC()->query, 'layered_nav_query' ) );
 
236
  }
237
  //Nothing to do for WooCommerce 2.6
238
  }
@@ -257,6 +273,15 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
257
  'or' => false
258
  );
259
 
 
 
 
 
 
 
 
 
 
260
  foreach ( $_chosen_attributes as $attribute => $data ) {
261
  $matched_products_from_attribute = array();
262
  $filtered = false;
@@ -278,6 +303,11 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
278
  )
279
  )
280
  );
 
 
 
 
 
281
 
282
  //TODO: Increase performance for get_posts()
283
  $post_ids = apply_filters( 'woocommerce_layered_nav_query_post_ids', get_posts( $args ), $args, $attribute, $value );
45
  */
46
  public function __construct( $version ) {
47
  $this->version = $version;
48
+ $is_ajax_navigation_active = is_active_widget( false, false, 'yith-woo-ajax-navigation', true );
49
+
50
  //Actions
51
+ //TODO: Remove woocommerce_layered_nav_init method
52
+ //add_action( 'init', array( $this, 'woocommerce_layered_nav_init' ), 90 );
53
+
54
+ if( $is_ajax_navigation_active ) {
55
+ add_filter( 'woocommerce_is_layered_nav_active', '__return_true' );
56
+ }
57
 
58
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
59
 
179
  ),
180
  'is_mobile' => wp_is_mobile(),
181
  'scroll_top' => yith_wcan_get_option('yith_wcan_ajax_scroll_top_class', '.yit-wcan-container'),
182
+ 'change_browser_url' => 'yes' == yith_wcan_get_option( 'yith_wcan_change_browser_url', 'yes' ) ? true : false,
183
+ /* === Avada Theme Support === */
184
+ 'avada' => array(
185
+ 'is_enabled' => class_exists( 'Avada' ),
186
+ 'sort_count' => 'ul.sort-count.order-dropdown'
187
+ ),
188
  )
189
  );
190
 
201
  * @return void
202
  */
203
  public function woocommerce_layered_nav_init() {
204
+ $is_ajax_navigation_active = is_active_widget( false, false, 'yith-woo-ajax-navigation', true );
205
+
206
+ var_dump( current_action() );
207
 
208
+ if ( ! YITH_WCAN()->is_wc_older_2_6 && $is_ajax_navigation_active && ! is_admin() ) {
209
 
210
  $_chosen_attributes = YITH_WCAN()->get_layered_nav_chosen_attributes();
211
 
242
  }
243
 
244
  if ( YITH_WCAN()->is_wc_older_2_1 ) {
245
+ add_filter( 'woocommerce_is_layered_nav_active', '__return_true' );
246
+ //add_filter( 'loop_shop_post_in', 'woocommerce_layered_nav_query' );
247
  }
248
 
249
  elseif ( YITH_WCAN()->is_wc_older_2_6 ) {
250
+ add_filter( 'woocommerce_is_layered_nav_active', '__return_true' );
251
+ //add_filter( 'loop_shop_post_in', array( WC()->query, 'layered_nav_query' ) );
252
  }
253
  //Nothing to do for WooCommerce 2.6
254
  }
273
  'or' => false
274
  );
275
 
276
+ $is_product_taxonomy = false;
277
+ if( is_product_taxonomy() ){
278
+ $is_product_taxonomy = array(
279
+ 'taxonomy' => get_queried_object()->taxonomy,
280
+ 'terms' => get_queried_object()->slug,
281
+ 'field' => YITH_WCAN()->filter_term_field
282
+ );
283
+ }
284
+
285
  foreach ( $_chosen_attributes as $attribute => $data ) {
286
  $matched_products_from_attribute = array();
287
  $filtered = false;
303
  )
304
  )
305
  );
306
+
307
+
308
+ if( $is_product_taxonomy ){
309
+ $args['tax_query'][] = $is_product_taxonomy;
310
+ }
311
 
312
  //TODO: Increase performance for get_posts()
313
  $post_ids = apply_filters( 'woocommerce_layered_nav_query_post_ids', get_posts( $args ), $args, $attribute, $value );
includes/functions.yith-wcan.php CHANGED
@@ -479,12 +479,12 @@ if ( ! function_exists( 'yit_get_woocommerce_layered_nav_link' ) ) {
479
  if( ! empty( $brands_taxonomy ) && $brands_taxonomy == $taxonomy ){
480
  $return = add_query_arg( array( $taxonomy => get_query_var( 'term' ) ), $return );
481
  }
482
- return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
483
  }
484
 
485
  elseif ( is_product_category() ) {
486
  $return = get_term_link( get_queried_object()->slug, 'product_cat' );
487
- return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
488
  }
489
 
490
  else {
@@ -499,7 +499,7 @@ if ( ! function_exists( 'yit_get_woocommerce_layered_nav_link' ) ) {
499
  $return = get_term_link( get_query_var( 'term' ), $taxonomy );
500
  }
501
 
502
- return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
503
  }
504
 
505
  return $return;
479
  if( ! empty( $brands_taxonomy ) && $brands_taxonomy == $taxonomy ){
480
  $return = add_query_arg( array( $taxonomy => get_query_var( 'term' ) ), $return );
481
  }
482
+ return apply_filters( 'yith_wcan_untrailingslashit', true ) && is_string( $return ) ? untrailingslashit( $return ) : $return;
483
  }
484
 
485
  elseif ( is_product_category() ) {
486
  $return = get_term_link( get_queried_object()->slug, 'product_cat' );
487
+ return apply_filters( 'yith_wcan_untrailingslashit', true ) && is_string( $return ) ? untrailingslashit( $return ) : $return;
488
  }
489
 
490
  else {
499
  $return = get_term_link( get_query_var( 'term' ), $taxonomy );
500
  }
501
 
502
+ return apply_filters( 'yith_wcan_untrailingslashit', true ) && is_string( $return ) ? untrailingslashit( $return ) : $return;
503
  }
504
 
505
  return $return;
init.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: http://yithemes.com/
5
  * Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
6
- * Version: 3.0.1
7
  * Author: YITHEMES
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
@@ -64,7 +64,7 @@ load_plugin_textdomain( 'yith-woocommerce-ajax-navigation', false, dirname( plug
64
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
65
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
66
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
67
- ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.0.0' );
68
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
70
 
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: http://yithemes.com/
5
  * Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
6
+ * Version: 3.0.2
7
  * Author: YITHEMES
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
64
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
65
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
66
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
67
+ ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.0.2' );
68
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
70
 
plugin-fw/init.php CHANGED
@@ -55,20 +55,3 @@ if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
55
  }
56
  }
57
  }
58
-
59
- if( is_admin() && function_exists( 'WC' ) && version_compare( WC()->version, '2.6', '<' ) ){
60
- add_action( 'admin_notices', 'yit_before_woocommerce_2_6_update' );
61
- }
62
-
63
- if( ! function_exists( 'yit_before_woocommerce_2_6_update' ) ){
64
- function yit_before_woocommerce_2_6_update(){ ?>
65
- <div id="message" class="error notice is-dismissible">
66
- <p>
67
- <strong>Attention!</strong> The new WooCommerce version 2.6 will be released in the following days. <strong>Please, ensure you have updated all YITH plugins before downloading WooCommerce 2.6 </strong> in order to prevent any possible unexpected errors from occuring.
68
- </p>
69
- <button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>
70
- </div>
71
- <?php
72
- }
73
- }
74
-
55
  }
56
  }
57
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin-fw/lib/yit-metabox.php CHANGED
@@ -158,7 +158,7 @@ if (!class_exists('YIT_Metabox')) {
158
  wp_enqueue_script('jquery-ui-datepicker');
159
  wp_enqueue_script('yit-spinner', YIT_CORE_PLUGIN_URL . '/assets/js/panel.spinner.js', array('jquery'), '0.0.1', true);
160
  wp_enqueue_script('jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array('jquery'), '1.1.0', true);
161
- wp_enqueue_script('ajax-chosen', yit_load_js_file(YIT_CORE_PLUGIN_URL . '/assets/js/chosen/ajax-chosen.jquery.js'), array('jquery'), '1.1.0', true);
162
  wp_enqueue_script('yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox.js', array('jquery', 'wp-color-picker'), '1.0.0', true);
163
  wp_enqueue_style('jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-custom/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all');
164
  }
158
  wp_enqueue_script('jquery-ui-datepicker');
159
  wp_enqueue_script('yit-spinner', YIT_CORE_PLUGIN_URL . '/assets/js/panel.spinner.js', array('jquery'), '0.0.1', true);
160
  wp_enqueue_script('jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array('jquery'), '1.1.0', true);
161
+ wp_enqueue_script('ajax-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/'.yit_load_js_file('ajax-chosen.jquery.js'), array('jquery'), '1.1.0', true);
162
  wp_enqueue_script('yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox.js', array('jquery', 'wp-color-picker'), '1.0.0', true);
163
  wp_enqueue_style('jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-custom/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all');
164
  }
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -113,7 +113,8 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
113
 
114
  if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ){
115
  $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
116
- add_menu_page( 'yit_plugin_panel', __( 'YITH Plugins', 'yith-plugin-fw' ), 'manage_options', 'yit_plugin_panel', NULL, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
 
117
  }
118
  }
119
 
113
 
114
  if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ){
115
  $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
116
+ // YITH Plugins text must not be translated
117
+ add_menu_page( 'yit_plugin_panel', 'YITH Plugins', 'manage_options', 'yit_plugin_panel', NULL, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
118
  }
119
  }
120
 
plugin-fw/licence/templates/panel/activation/activation-panel.php CHANGED
@@ -143,7 +143,7 @@ $num_members_products_activate = $this->get_number_of_membership_products();
143
  </a>
144
 
145
  <?php if( ! $info['licence']['is_membership'] && $this->show_renew_button ) : ?>
146
- <a class="button-licence licence-renew" href="<?php echo $this->get_renewing_uri( $info['licence']['licence_key'] ) ?>" target="_blank">
147
  <?php _e( 'Renew', 'yith-plugin-fw' ) ?>
148
  </a>
149
  <?php endif; ?>
143
  </a>
144
 
145
  <?php if( ! $info['licence']['is_membership'] && $this->show_renew_button ) : ?>
146
+ <a class="button-licence licence-renew" href="<?php echo esc_url( $this->get_renewing_uri( $info['licence']['licence_key'] ) ) ?>" target="_blank">
147
  <?php _e( 'Renew', 'yith-plugin-fw' ) ?>
148
  </a>
149
  <?php endif; ?>
widgets/class.yith-wcan-navigation-widget.php CHANGED
@@ -102,7 +102,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
102
  }
103
 
104
  // Force found when option is selected - do not force found on taxonomy attributes
105
- if ( ! $_attributes_array || ! is_tax( $_attributes_array ) ) {
106
  if ( is_array( $_chosen_attributes ) && array_key_exists( $taxonomy, $_chosen_attributes ) ) {
107
  $this->found = true;
108
  }
@@ -675,7 +675,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
675
  // End display type conditional
676
 
677
  echo $after_widget;
678
-
679
  if ( ! $this->found ) {
680
  ob_end_clean();
681
  echo substr( $before_widget, 0, strlen( $before_widget ) - 1 ) . ' style="display:none">' . $after_widget;
@@ -899,23 +899,18 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
899
 
900
  $term_param = apply_filters('yith_wcan_term_param_uri', $term->$filter_term_field, $display_type, $term);
901
 
 
 
902
  // If this is an AND query, only show options with count > 0
903
  if ($query_type == 'and') {
904
-
905
- $count = sizeof(array_intersect($_products_in_term, YITH_WCAN()->frontend->filtered_product_ids ) );
906
-
907
- if ($count > 0 && $current_term !== $term_param) {
908
- $this->found = true;
909
- }
910
-
911
-
912
  } else {
913
  // If this is an OR query, show all options so search can be expanded
914
  $count = sizeof(array_intersect($_products_in_term, YITH_WCAN()->frontend->unfiltered_product_ids));
 
915
 
916
- if ($count > 0) {
917
- $this->found = true;
918
- }
919
  }
920
 
921
  $arg = apply_filters('yith_wcan_list_type_query_arg', 'filter_' . sanitize_title($instance['attribute']), $display_type, $term);
@@ -1065,7 +1060,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
1065
  }
1066
 
1067
  if ( $count != 0 && apply_filters( "{$args['widget_id']}-show_product_count", true, $instance ) ) {
1068
- echo '<small class="count">' . $count . '</small><div class="clear"></div>';
1069
  }
1070
 
1071
  if( $li_printed ){
102
  }
103
 
104
  // Force found when option is selected - do not force found on taxonomy attributes
105
+ if ( ! $_attributes_array || ! is_tax( $_attributes_array ) ) {
106
  if ( is_array( $_chosen_attributes ) && array_key_exists( $taxonomy, $_chosen_attributes ) ) {
107
  $this->found = true;
108
  }
675
  // End display type conditional
676
 
677
  echo $after_widget;
678
+ $this->found = true;
679
  if ( ! $this->found ) {
680
  ob_end_clean();
681
  echo substr( $before_widget, 0, strlen( $before_widget ) - 1 ) . ' style="display:none">' . $after_widget;
899
 
900
  $term_param = apply_filters('yith_wcan_term_param_uri', $term->$filter_term_field, $display_type, $term);
901
 
902
+ $count = 0;
903
+
904
  // If this is an AND query, only show options with count > 0
905
  if ($query_type == 'and') {
906
+ $count = sizeof(array_intersect($_products_in_term, YITH_WCAN()->frontend->layered_nav_product_ids ) );
 
 
 
 
 
 
 
907
  } else {
908
  // If this is an OR query, show all options so search can be expanded
909
  $count = sizeof(array_intersect($_products_in_term, YITH_WCAN()->frontend->unfiltered_product_ids));
910
+ }
911
 
912
+ if ($count > 0 ) {
913
+ $this->found = true;
 
914
  }
915
 
916
  $arg = apply_filters('yith_wcan_list_type_query_arg', 'filter_' . sanitize_title($instance['attribute']), $display_type, $term);
1060
  }
1061
 
1062
  if ( $count != 0 && apply_filters( "{$args['widget_id']}-show_product_count", true, $instance ) ) {
1063
+ echo ' <small class="count">' . $count . '</small><div class="clear"></div>';
1064
  }
1065
 
1066
  if( $li_printed ){