YITH WooCommerce Ajax Product Filter - Version 2.7.1

Version Description

  • Fixed: The plugin shows empty filters in product category page
  • Fixed: Reset filter doesn't works in product category page
  • Fixed: WooCommerce price slider doesn't set to default value after filter reset
Download this release

Release Info

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

Code changes from version 2.7.0 to 2.7.1

README.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
4
Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
5
Requires at least: 4.0
6
Tested up to: 4.4
7
- Stable tag: 2.7.0
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -159,6 +159,12 @@ If you want to see a demonstration version of the premium plugin, you can see it
159
160
== Changelog ==
161
162
= 2.7.0 =
163
164
* Fixed: Click on row to filter in dropdown style
4
Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
5
Requires at least: 4.0
6
Tested up to: 4.4
7
+ Stable tag: 2.7.1
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
159
160
== Changelog ==
161
162
+ = 2.7.1 =
163
+
164
+ * Fixed: The plugin shows empty filters in product category page
165
+ * Fixed: Reset filter doesn't works in product category page
166
+ * Fixed: WooCommerce price slider doesn't set to default value after filter reset
167
+
168
= 2.7.0 =
169
170
* Fixed: Click on row to filter in dropdown style
assets/js/yith-wcan-admin.js CHANGED
@@ -108,11 +108,11 @@ jQuery(function ($) {
108
109
select_all.on('click', function(e){
110
e.preventDefault();
111
- $(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag').find('.yith_wcan_tag_list_checkbox').attr( 'checked', true );
112
});
113
114
unselect_all.on('click', function(e){
115
e.preventDefault();
116
- $(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag').find('.yith_wcan_tag_list_checkbox').attr( 'checked', false );
117
});
118
});
108
109
select_all.on('click', function(e){
110
e.preventDefault();
111
+ $(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag_wrapper').find('.yith_wcan_tag_list_checkbox').attr( 'checked', true );
112
});
113
114
unselect_all.on('click', function(e){
115
e.preventDefault();
116
+ $(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag_wrapper').find('.yith_wcan_tag_list_checkbox').attr( 'checked', false );
117
});
118
});
assets/js/yith-wcan-frontend.js CHANGED
@@ -98,8 +98,9 @@ jQuery(function ($) {
98
99
$.fn.yith_wcan_ajax_filters = function (e, obj) {
100
e.preventDefault();
101
- var href = obj.href,
102
- t = $(obj);
103
104
if (typeof href == 'undefined' && t.parents().hasClass('price_slider_wrapper')) {
105
var form = t.parents('form'),
@@ -155,7 +156,6 @@ jQuery(function ($) {
155
if( ajax_call != false ){
156
ajax_call.abort();
157
ajax_call = false;
158
- console.log( 'here' );
159
}
160
161
ajax_call = $.ajax({
@@ -218,6 +218,13 @@ jQuery(function ($) {
218
//trigger ready event
219
$(document).trigger("ready");
220
$(document).trigger("yith-wcan-ajax-filtered");
221
}
222
});
223
};
98
99
$.fn.yith_wcan_ajax_filters = function (e, obj) {
100
e.preventDefault();
101
+ var href = obj.href,
102
+ t = $(obj),
103
+ is_reset = t.hasClass("yith-wcan-reset-navigation");
104
105
if (typeof href == 'undefined' && t.parents().hasClass('price_slider_wrapper')) {
106
var form = t.parents('form'),
156
if( ajax_call != false ){
157
ajax_call.abort();
158
ajax_call = false;
159
}
160
161
ajax_call = $.ajax({
218
//trigger ready event
219
$(document).trigger("ready");
220
$(document).trigger("yith-wcan-ajax-filtered");
221
+ if( is_reset ){
222
+ var min_price = parseInt( $( yith_wcan.wc_price_slider.min_price ).data( 'min' ) ),
223
+ max_price = parseInt( $( yith_wcan.wc_price_slider.max_price ).data( 'max' ) );
224
+ $( yith_wcan.wc_price_slider.wrapper ).slider( 'values', [ min_price, max_price ] );
225
+ $( document.body ).trigger( 'price_slider_slide', [ min_price, max_price ] );
226
+ $(document).trigger("yith-wcan-ajax-reset-filtered");
227
+ }
228
}
229
});
230
};
assets/js/yith-wcan-frontend.min.js CHANGED
@@ -1,13 +1,13 @@
1
- jQuery(function(b){function u(b,p){return b.replace(new RegExp("[?&]"+p+"=[^&#]*(#.*)?quot;),"$1").replace(new RegExp("([?&])"+p+"=[^&]*&"),"$1")}var x=/(?!(\[))(\.)[^.#[]*/g,y=/(#)[^.#[]*/,z=/^[\w]+/,A=/^[\w]+#x2F;,v=function(h,p){var a=[];if(A.test(h))a=[{tag:h}];else{for(var a=h,d={sel:[],val:[]},f=[],k=!1,g="",l=[],c=0,m=a.length;c<m;c++){var e=a.charAt(c);if(k)if("\\"===e&&c+1<a.length)l.push(a.charAt(++c));else if(g===e)g="",l.push(e);else if(("'"===e||'"'===e)&&""===g)g=e,l.push(e);else if("]"===
2
- e&&""===g)d.val.push(l.join("")),l=[],k=!1;else{if("]"!==e||""!==g)""===g&&","===e?(d.val.push(l.join("")),l=[]):l.push(e)}else"\\"===e&&c+1<a.length?k&&l.push(a.charAt(++c)):"["===e&&""===g?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=z.exec(d);n.id=y.exec(d);n.id&&
3
- b.isArray(n.id)&&(n.id=n.id[0].substr(1));n.tag||(n.tag="div");n.vars=[];for(a=0;a<f[c].val.length;a++)g=f[c].val[a].indexOf("="),k=f[c].val[a].substr(0,g),g=f[c].val[a].substr(g+1),g=g.replace(/^[\s]*[\"\']*|[\"\']*[\s]*#x2F;g,""),"text"===k?n.text=g:n.vars.push([k,g]);d=d.match(x);k=[];if(d){for(a=0;a<d.length;a++)k.push(d[a].substr(1));n.className=k.join(" ")}}f[c]=n}a=f}n=[];"undefined"===typeof p&&(p=1);d=[];f=[];k=[];g=document.createElement("div");for(c=l=0;c<a.length;c++){if("+"==a[c].tag)f=
4
- k.slice(),--l;else{for(m=0;m<p;m++)if("input"==a[c].tag){e=[];e.push("<"+a[c].tag);a[c].id&&e.push("id='"+a[c].id+"'");a[c].className&&(e.push("class='"+a[c].className),c+1===a.length&&e.push(lastClass),e.push("'"));if(a[c].vars)for(var q=0;q<a[c].vars.length;q++)e.push(a[c].vars[q][0]+"='"+a[c].vars[q][1]+"'");a[c].text&&e.push("value='"+a[c].text+"'");e.push("/>");k[m]=f[m];f[m]?(f[m].innerHTML+=e.join(" "),f[m]=f[m].lastChild):(g.innerHTML=e.join(" "),f[m]=g.removeChild(g.firstChild))}else{e=document.createElement(a[c].tag);
5
- if(a[c].vars)for(q=0;q<a[c].vars.length;q++)console.log(a[c].tag,a[c].vars[q]),e.setAttribute(a[c].vars[q][0],a[c].vars[q][1]);a[c].id&&(e.id=a[c].id);a[c].className&&(e.className=a[c].className);a[c].text&&e.appendChild(document.createTextNode(a[c].text));k[m]=f[m];f[m]=f[m]?f[m].appendChild(e):e}l++||Array.prototype.push.apply(d,f)}n=b.merge(n,f)}return b(d)},w=function(h,p,a){for(var d=h.match(/%[^%]*%/g)||[],f=[],k=0;k<p.length;k++){for(var g=h,l=0;l<d.length;l++)var c=d[l].substr(1,d[l].length-
6
- 2),g=g.replace(d[l],p[k][c]);f=b.merge(f,v(g,a))}return b(f)};b.jseldom=function(h){if(2==arguments.length&&b.isPlainObject(arguments[1]))return w.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!b.isArray(arguments[1]))return v.apply(this,arguments);if(2==arguments.length)return w.apply(this,arguments)};var r=!1;b.fn.yith_wcan_ajax_filters=function(h,p){h.preventDefault();var a=p.href,d=b(p);if("undefined"==typeof a&&d.parents().hasClass("price_slider_wrapper")){d.parents("form");
7
- var f=window.location,k=f.origin+f.pathname,g=k!=f.href,l=b(".price_slider_amount #min_price").val(),c=b(".price_slider_amount #max_price").val(),a=f.href;1==g&&(a=u(a,"min_price"),a=u(a,"max_price"));a=a+(k==a?"?":"&")+b.param({min_price:l,max_price:c})}"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").animate({visibility:"hidden",opacity:0},300));b(yith_wcan.container).html("").addClass("yith-wcan-loading");
8
- b(document).trigger("yith-wcan-ajax-loading");"undefined"!=typeof yith_wcan_frontend&&b(yith_wcan.container).css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");b(yith_wcan.pagination).hide();b(yith_wcan.result_count).hide();0!=r&&(r.abort(),r=!1,console.log("here"));r=b.ajax({url:a,success:function(c){r=!1;b(yith_wcan.container).removeClass("yith-wcan-loading");0<b(c).find(yith_wcan.container).length?b(".yit-wcan-container").html(b(c).find(yith_wcan.container)):b(".yit-wcan-container").html(b(c).find(".woocommerce-info"));
9
- 0<b(c).find(yith_wcan.pagination).length?(0==b(yith_wcan.pagination).length&&b.jseldom(yith_wcan.pagination).insertAfter(b(yith_wcan.container)),b(yith_wcan.pagination).html(b(c).find(yith_wcan.pagination).html()).show()):b(yith_wcan.pagination).empty();0<b(c).find(yith_wcan.result_count).length&&b(yith_wcan.result_count).html(b(c).find(yith_wcan.result_count).html()).show();b(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var a=
10
- b(this),d=a.attr("id");a.html(b(c).find("#"+d).html());""==a.text()?a.hide():a.show()});navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",a);b(document).trigger("ready");b(document).trigger("yith-wcan-ajax-filtered")}})};b(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');b(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');b(document).on("click",".yith-wcan a",function(h){b(this).yith_wcan_ajax_filters(h,this)});var t=function(){b("div.yith-wcan-select-wrapper").animate({visibility:"hidden",
11
- opacity:0},0);b("a.yit-wcan-select-open").removeClass("active")};b(document).on("click","a.yit-wcan-select-open.active",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300);b(this).parent().find("a.yit-wcan-select-open").removeClass("active")});b(document).on("click","a.yit-wcan-select-open:not(.active)",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index",
12
- "1").animate({visibility:"visible",opacity:1},300);b(this).parent().find("a.yit-wcan-select-open").addClass("active")});b(document).on("ready yith-wcan-ajax-filtered",function(){b("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");t();b("div.yith-wcan-select-wrapper").each(function(){var h="";b(this).find("ul.yith-wcan-select li.chosen").each(function(){h+=b(this).text()+", "});h=h.substring(0,h.length-2);""!=h&&b(this).parent().find("a.yit-wcan-select-open").text(h)})});b(document).on("ready",
13
- t);b("body").on("click",function(h){b(h.target).hasClass("yit-wcan-select-open")||t()})});
1
+ jQuery(function(a){function u(a,p){return a.replace(new RegExp("[?&]"+p+"=[^&#]*(#.*)?quot;),"$1").replace(new RegExp("([?&])"+p+"=[^&]*&"),"$1")}var x=/(?!(\[))(\.)[^.#[]*/g,y=/(#)[^.#[]*/,z=/^[\w]+/,A=/^[\w]+#x2F;,v=function(h,p){var b=[];if(A.test(h))b=[{tag:h}];else{for(var b=h,d={sel:[],val:[]},f=[],k=!1,g="",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(g===e)g="",l.push(e);else if(("'"===e||'"'===e)&&""===g)g=e,l.push(e);else if("]"===
2
+ e&&""===g)d.val.push(l.join("")),l=[],k=!1;else{if("]"!==e||""!==g)""===g&&","===e?(d.val.push(l.join("")),l=[]):l.push(e)}else"\\"===e&&c+1<b.length?k&&l.push(b.charAt(++c)):"["===e&&""===g?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=z.exec(d);n.id=y.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++)g=f[c].val[b].indexOf("="),k=f[c].val[b].substr(0,g),g=f[c].val[b].substr(g+1),g=g.replace(/^[\s]*[\"\']*|[\"\']*[\s]*#x2F;g,""),"text"===k?n.text=g:n.vars.push([k,g]);d=d.match(x);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=[];g=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):(g.innerHTML=e.join(" "),f[m]=g.removeChild(g.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(h,p,b){for(var d=h.match(/%[^%]*%/g)||[],f=[],k=0;k<p.length;k++){for(var g=h,l=0;l<d.length;l++)var c=d[l].substr(1,d[l].length-
6
+ 2),g=g.replace(d[l],p[k][c]);f=a.merge(f,v(g,b))}return a(f)};a.jseldom=function(h){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;a.fn.yith_wcan_ajax_filters=function(h,p){h.preventDefault();var b=p.href,d=a(p),f=d.hasClass("yith-wcan-reset-navigation");if("undefined"==typeof b&&
7
+ d.parents().hasClass("price_slider_wrapper")){d.parents("form");var k=window.location,g=k.origin+k.pathname,l=g!=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+(g==b?"?":"&")+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").animate({visibility:"hidden",
8
+ opacity:0},300));a(yith_wcan.container).html("").addClass("yith-wcan-loading");a(document).trigger("yith-wcan-ajax-loading");"undefined"!=typeof yith_wcan_frontend&&a(yith_wcan.container).css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");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).removeClass("yith-wcan-loading");0<a(c).find(yith_wcan.container).length?a(".yit-wcan-container").html(a(c).find(yith_wcan.container)):
9
+ a(".yit-wcan-container").html(a(c).find(".woocommerce-info"));0<a(c).find(yith_wcan.pagination).length?(0==a(yith_wcan.pagination).length&&a.jseldom(yith_wcan.pagination).insertAfter(a(yith_wcan.container)),a(yith_wcan.pagination).html(a(c).find(yith_wcan.pagination).html()).show()):a(yith_wcan.pagination).empty();0<a(c).find(yith_wcan.result_count).length&&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=
10
+ a(this),d=b.attr("id");b.html(a(c).find("#"+d).html());""==b.text()?b.hide():b.show()});navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",b);a(document).trigger("ready");a(document).trigger("yith-wcan-ajax-filtered");if(f){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]);
11
+ a(document).trigger("yith-wcan-ajax-reset-filtered")}}})};a(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');a(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');a(document).on("click",".yith-wcan a",function(h){a(this).yith_wcan_ajax_filters(h,this)});var t=function(){a("div.yith-wcan-select-wrapper").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(h){h.preventDefault();
12
+ 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(h){h.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",
13
+ function(){a("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");t();a("div.yith-wcan-select-wrapper").each(function(){var h="";a(this).find("ul.yith-wcan-select li.chosen").each(function(){h+=a(this).text()+", "});h=h.substring(0,h.length-2);""!=h&&a(this).parent().find("a.yit-wcan-select-open").text(h)})});a(document).on("ready",t);a("body").on("click",function(h){a(h.target).hasClass("yit-wcan-select-open")||t()})});
includes/class.yith-wcan-frontend.php CHANGED
@@ -67,6 +67,11 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
67
'container' => yith_wcan_get_option( 'yith_wcan_ajax_shop_container', '.products' ),
68
'pagination' => yith_wcan_get_option( 'yith_wcan_ajax_shop_pagination', 'nav.woocommerce-pagination' ),
69
'result_count' => yith_wcan_get_option( 'yith_wcan_ajax_shop_result_container', '.woocommerce-result-count' ),
70
)
71
);
72
67
'container' => yith_wcan_get_option( 'yith_wcan_ajax_shop_container', '.products' ),
68
'pagination' => yith_wcan_get_option( 'yith_wcan_ajax_shop_pagination', 'nav.woocommerce-pagination' ),
69
'result_count' => yith_wcan_get_option( 'yith_wcan_ajax_shop_result_container', '.woocommerce-result-count' ),
70
+ 'wc_price_slider' => array(
71
+ 'wrapper' => '.price_slider',
72
+ 'min_price' => '.price_slider_amount #min_price',
73
+ 'max_price' => '.price_slider_amount #max_price',
74
+ )
75
)
76
);
77
includes/functions.yith-wcan.php CHANGED
@@ -441,7 +441,7 @@ if ( ! function_exists( 'yit_get_woocommerce_layered_nav_link' ) ) {
441
*/
442
function yit_get_woocommerce_layered_nav_link() {
443
444
- if ( defined( 'SHOP_IS_ON_FRONT' ) || ( is_shop() && ! is_product_category() ) || is_product_taxonomy() ) {
445
$return = get_post_type_archive_link( 'product' );
446
return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
447
}
441
*/
442
function yit_get_woocommerce_layered_nav_link() {
443
444
+ if ( defined( 'SHOP_IS_ON_FRONT' ) || ( is_shop() && ! is_product_category() && ! is_product_taxonomy() ) ) {
445
$return = get_post_type_archive_link( 'product' );
446
return apply_filters( 'yith_wcan_untrailingslashit', true ) ? untrailingslashit( $return ) : $return;
447
}
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: 2.7.0
7
* Author: yithemes
8
* Author URI: http://yithemes.com/
9
* Text Domain: yith_wc_ajxnav
@@ -65,7 +65,7 @@ if ( defined( 'YITH_WCAN_VERSION' ) ) {
65
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
66
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
67
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
68
- ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '2.7.0' );
69
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
70
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
71
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: 2.7.1
7
* Author: yithemes
8
* Author URI: http://yithemes.com/
9
* Text Domain: yith_wc_ajxnav
65
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
66
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
67
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
68
+ ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '2.7.1' );
69
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
70
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
71
plugin-fw/init.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/**
3
* Framework Name: YIT Plugin Framework
4
- * Version: 2.9.5
5
* Author: Yithemes
6
* Text Domain: yith-plugin-fw
7
* Domain Path: /languages/
1
<?php
2
/**
3
* Framework Name: YIT Plugin Framework
4
+ * Version: 2.9.6
5
* Author: Yithemes
6
* Text Domain: yith-plugin-fw
7
* Domain Path: /languages/
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -326,7 +326,12 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
326
wp_enqueue_media();
327
wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css', array(), $woocommerce->version );
328
wp_register_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $woocommerce->version );
329
- wp_enqueue_style ( 'wp-jquery-ui-dialog' );
330
331
wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
332
wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
326
wp_enqueue_media();
327
wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css', array(), $woocommerce->version );
328
wp_register_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $woocommerce->version );
329
+
330
+ if ( 'customize.php' != $pagenow ){
331
+
332
+ wp_enqueue_style ( 'wp-jquery-ui-dialog' );
333
+
334
+ }
335
336
wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
337
wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
widgets/class.yith-wcan-navigation-widget.php CHANGED
@@ -12,6 +12,7 @@ if ( ! defined( 'YITH_WCAN' ) ) {
12
} // Exit if accessed directly
13
14
if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
15
/**
16
* YITH WooCommerce Ajax Navigation Widget
17
*
@@ -19,8 +20,16 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
19
*/
20
class YITH_WCAN_Navigation_Widget extends WP_Widget {
21
22
public $brand_taxonomy = '';
23
24
function __construct() {
25
$widget_ops = array( 'classname' => 'yith-woo-ajax-navigation woocommerce widget_layered_nav', 'description' => __( 'Filter the product list without reloading the page', 'yith-woocommerce-ajax-navigation' ) );
26
$control_ops = array( 'width' => 400, 'height' => 350 );
@@ -79,7 +88,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
79
80
ob_start();
81
82
- $found = false;
83
84
echo $before_widget;
85
@@ -92,7 +101,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
92
// Force found when option is selected - do not force found on taxonomy attributes
93
if ( ! $_attributes_array || ! is_tax( $_attributes_array ) ) {
94
if ( is_array( $_chosen_attributes ) && array_key_exists( $taxonomy, $_chosen_attributes ) ) {
95
- $found = true;
96
}
97
}
98
@@ -127,7 +136,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
127
}
128
129
if ( $count > 0 && $current_term !== $term_param ) {
130
- $found = true;
131
}
132
133
if ( ( ( $terms_type_list == 'hierarchical' || ( $terms_type_list == 'tags' && $instance['display'] == 'hierarchical' ) ) || ! yit_term_has_child( $term, $taxonomy ) ) && $count == 0 && ! $option_is_set ) {
@@ -146,7 +155,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
146
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
147
148
if ( $count > 0 ) {
149
- $found = true;
150
}
151
152
}
@@ -206,12 +215,32 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
206
}
207
208
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
209
- $brands = get_term_by( 'name', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
210
if( $brands->term_id != $term->term_id ){
211
- $link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->name ), $link );
212
}
213
}
214
215
$check_for_current_widget = isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] );
216
217
// Current Filter = this widget
@@ -300,7 +329,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
300
}
301
302
if ( $count > 0 && $current_term !== $term->term_id ) {
303
- $found = true;
304
}
305
306
if ( ( $terms_type_list != 'hierarchical' || ! yit_term_has_child( $term, $taxonomy ) ) && $count == 0 && ! $option_is_set ) {
@@ -319,7 +348,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
319
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
320
321
if ( $count > 0 ) {
322
- $found = true;
323
}
324
325
}
@@ -381,10 +410,20 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
381
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
382
$brands = get_term_by( 'name', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
383
if( $brands->term_id != $term->term_id ){
384
- $link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->name ), $link );
385
}
386
}
387
388
// Current Filter = this widget
389
if ( isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) ) {
390
@@ -465,7 +504,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
465
}
466
467
if ( $count > 0 && $current_term !== $term->term_id ) {
468
- $found = true;
469
}
470
471
if ( $count == 0 && ! $option_is_set ) {
@@ -484,7 +523,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
484
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
485
486
if ( $count > 0 ) {
487
- $found = true;
488
}
489
490
}
@@ -546,10 +585,20 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
546
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
547
$brands = get_term_by( 'name', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
548
if( $brands->term_id != $term->term_id ){
549
- $link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->name ), $link );
550
}
551
}
552
553
// Current Filter = this widget
554
if ( isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) ) {
555
@@ -628,7 +677,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
628
}
629
630
if ( $count > 0 && $current_term !== $term->term_id ) {
631
- $found = true;
632
}
633
634
if ( $count == 0 && ! $option_is_set ) {
@@ -647,7 +696,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
647
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
648
649
if ( $count > 0 ) {
650
- $found = true;
651
}
652
653
}
@@ -709,10 +758,20 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
709
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
710
$brands = get_term_by( 'name', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
711
if( $brands->term_id != $term->term_id ){
712
- $link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->name ), $link );
713
}
714
}
715
716
// Current Filter = this widget
717
if ( isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) ) {
718
@@ -770,7 +829,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
770
771
echo $after_widget;
772
773
- if ( ! apply_filters( 'yith_wcan_found_taxonomy', $found ) ) {
774
ob_end_clean();
775
echo substr( $before_widget, 0, strlen( $before_widget ) - 1 ) . ' style="display:none">' . $after_widget;
776
}
12
} // Exit if accessed directly
13
14
if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
15
+
16
/**
17
* YITH WooCommerce Ajax Navigation Widget
18
*
20
*/
21
class YITH_WCAN_Navigation_Widget extends WP_Widget {
22
23
+ /**
24
+ * YITH Brands Taxonomy Name
25
+ */
26
public $brand_taxonomy = '';
27
28
+ /**
29
+ * Use to print or not widget
30
+ */
31
+ public $found = false;
32
+
33
function __construct() {
34
$widget_ops = array( 'classname' => 'yith-woo-ajax-navigation woocommerce widget_layered_nav', 'description' => __( 'Filter the product list without reloading the page', 'yith-woocommerce-ajax-navigation' ) );
35
$control_ops = array( 'width' => 400, 'height' => 350 );
88
89
ob_start();
90
91
+ $this->found = false;
92
93
echo $before_widget;
94
101
// Force found when option is selected - do not force found on taxonomy attributes
102
if ( ! $_attributes_array || ! is_tax( $_attributes_array ) ) {
103
if ( is_array( $_chosen_attributes ) && array_key_exists( $taxonomy, $_chosen_attributes ) ) {
104
+ $this->found = true;
105
}
106
}
107
136
}
137
138
if ( $count > 0 && $current_term !== $term_param ) {
139
+ $this->found = true;
140
}
141
142
if ( ( ( $terms_type_list == 'hierarchical' || ( $terms_type_list == 'tags' && $instance['display'] == 'hierarchical' ) ) || ! yit_term_has_child( $term, $taxonomy ) ) && $count == 0 && ! $option_is_set ) {
155
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
156
157
if ( $count > 0 ) {
158
+ $this->found = true;
159
}
160
161
}
215
}
216
217
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
218
+ $brands = get_term_by( 'slug', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
219
if( $brands->term_id != $term->term_id ){
220
+ $link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->slug ), $link );
221
}
222
}
223
224
+ if( isset( $_GET['product_cat'] ) ){
225
+ $categories_filter_operator = 'and' == $query_type ? '+' : ',';
226
+ $_chosen_categories = explode( $categories_filter_operator, urlencode( $_GET['product_cat'] ) );
227
+ $link = add_query_arg(
228
+ 'product_cat',
229
+ implode( apply_filters( 'yith_wcan_categories_filter_operator', $categories_filter_operator, $display_type ), $_chosen_categories ),
230
+ $link
231
+ );
232
+ }
233
+
234
+ if( isset( $_GET['product_cat'] ) ){
235
+ $categories_filter_operator = 'and' == $query_type ? '+' : ',';
236
+ $_chosen_categories = explode( $categories_filter_operator, urlencode( $_GET['product_cat'] ) );
237
+ $link = add_query_arg(
238
+ 'product_cat',
239
+ implode( apply_filters( 'yith_wcan_categories_filter_operator', $categories_filter_operator, $display_type ), $_chosen_categories ),
240
+ $link
241
+ );
242
+ }
243
+
244
$check_for_current_widget = isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] );
245
246
// Current Filter = this widget
329
}
330
331
if ( $count > 0 && $current_term !== $term->term_id ) {
332
+ $this->found = true;
333
}
334
335
if ( ( $terms_type_list != 'hierarchical' || ! yit_term_has_child( $term, $taxonomy ) ) && $count == 0 && ! $option_is_set ) {
348
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
349
350
if ( $count > 0 ) {
351
+ $this->found = true;
352
}
353
354
}
410
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
411
$brands = get_term_by( 'name', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
412
if( $brands->term_id != $term->term_id ){
413
+ $link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->slug ), $link );
414
}
415
}
416
417
+ if( isset( $_GET['product_cat'] ) ){
418
+ $categories_filter_operator = 'and' == $query_type ? '+' : ',';
419
+ $_chosen_categories = explode( $categories_filter_operator, urlencode( $_GET['product_cat'] ) );
420
+ $link = add_query_arg(
421
+ 'product_cat',
422
+ implode( apply_filters( 'yith_wcan_categories_filter_operator', $categories_filter_operator, $display_type ), $_chosen_categories ),
423
+ $link
424
+ );
425
+ }
426
+
427
// Current Filter = this widget
428
if ( isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) ) {
429
504
}
505
506
if ( $count > 0 && $current_term !== $term->term_id ) {
507
+ $this->found = true;
508
}
509
510
if ( $count == 0 && ! $option_is_set ) {
523
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
524
525
if ( $count > 0 ) {
526
+ $this->found = true;
527
}
528
529
}
585
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
586
$brands = get_term_by( 'name', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
587
if( $brands->term_id != $term->term_id ){
588
+ $link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->slug ), $link );
589
}
590
}
591
592
+ if( isset( $_GET['product_cat'] ) ){
593
+ $categories_filter_operator = 'and' == $query_type ? '+' : ',';
594
+ $_chosen_categories = explode( $categories_filter_operator, urlencode( $_GET['product_cat'] ) );
595
+ $link = add_query_arg(
596
+ 'product_cat',
597
+ implode( apply_filters( 'yith_wcan_categories_filter_operator', $categories_filter_operator, $display_type ), $_chosen_categories ),
598
+ $link
599
+ );
600
+ }
601
+
602
// Current Filter = this widget
603
if ( isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) ) {
604
677
}
678
679
if ( $count > 0 && $current_term !== $term->term_id ) {
680
+ $this->found = true;
681
}
682
683
if ( $count == 0 && ! $option_is_set ) {
696
$count = sizeof( array_intersect( $_products_in_term, $woocommerce->query->unfiltered_product_ids ) );
697
698
if ( $count > 0 ) {
699
+ $this->found = true;
700
}
701
702
}
758
if ( isset( $_GET[ $this->brand_taxonomy ] ) ) {
759
$brands = get_term_by( 'name', $_GET[ $this->brand_taxonomy ], $this->brand_taxonomy );
760
if( $brands->term_id != $term->term_id ){
761
+ $link = add_query_arg( $this->brand_taxonomy, urlencode( $brands->slug ), $link );
762
}
763
}
764
765
+ if( isset( $_GET['product_cat'] ) ){
766
+ $categories_filter_operator = 'and' == $query_type ? '+' : ',';
767
+ $_chosen_categories = explode( $categories_filter_operator, urlencode( $_GET['product_cat'] ) );
768
+ $link = add_query_arg(
769
+ 'product_cat',
770
+ implode( apply_filters( 'yith_wcan_categories_filter_operator', $categories_filter_operator, $display_type ), $_chosen_categories ),
771
+ $link
772
+ );
773
+ }
774
+
775
// Current Filter = this widget
776
if ( isset( $_chosen_attributes[$taxonomy] ) && is_array( $_chosen_attributes[$taxonomy]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[$taxonomy]['terms'] ) ) {
777
829
830
echo $after_widget;
831
832
+ if ( ! $this->found ) {
833
ob_end_clean();
834
echo substr( $before_widget, 0, strlen( $before_widget ) - 1 ) . ' style="display:none">' . $after_widget;
835
}