Perfect Brands for WooCommerce - Version 1.7.6

Version Description

  • Tested up to, bump
  • Dev: New filter hook "woocommerce_product_brand_heading" for editing the "Brand" tab heading
  • Fix: Some problems with the "Brand" product tab
  • Fix: Avoid a possible JS conflict caused by "wp_localize_script"
Download this release

Release Info

Developer titodevera
Plugin Icon 128x128 Perfect Brands for WooCommerce
Version 1.7.6
Comparing to
See all releases

Code changes from version 1.7.5 to 1.7.6

assets/js/functions-admin.js CHANGED
@@ -95,7 +95,7 @@ jQuery( function ( $ ) {
95
  $currentStar.addClass('dashicons-star-filled');
96
  }
97
  var data = { 'action': 'pwb_admin_set_featured_brand', 'brand': $currentStar.data('brand-id') };
98
- $.post(ajax_object.ajax_url, data, function( response ) {
99
  $currentStar.removeClass('pwb-blocked');
100
  if( response.success ){
101
  var $featuredCount = $('.taxonomy-pwb-brand .pwb-featured-count > span');
@@ -112,9 +112,9 @@ jQuery( function ( $ ) {
112
 
113
  $('.taxonomy-pwb-brand #pwb-first-featured-brands').on('change', function(e){
114
  e.preventDefault();
115
- $('#screen-options-apply').replaceWith('<img src="'+ajax_object.site_url+'/wp-admin/images/loading.gif">');
116
  var data = { 'action': 'pwb_admin_save_screen_settings', 'new_val': $(this).is(':checked') };
117
- $.post(ajax_object.ajax_url, data, function(response) { location.reload(); });
118
  });
119
 
120
  $('.pwb-edit-brands-bottom > span').on('click', function(e){
@@ -135,19 +135,19 @@ jQuery( function ( $ ) {
135
 
136
  if( $(this).val() != '-' ){
137
 
138
- if( confirm(ajax_object.translations.migrate_notice) ){
139
 
140
  $('html').append('<div class="pwb-modal"><div class="pwb-modal-inner"></div></div>');
141
- $('.pwb-modal-inner').html('<p>'+ajax_object.translations.migrating+'</p>');
142
 
143
  var data = {
144
  'action': 'pwb_admin_migrate_brands',
145
  'from': $(this).val()
146
  };
147
- $.post(ajax_object.ajax_url, data, function(response) {
148
 
149
  setTimeout( function(){
150
- location.href = ajax_object.brands_url;
151
  }, 1000 );
152
 
153
  });
@@ -167,19 +167,19 @@ jQuery( function ( $ ) {
167
 
168
  if( $(this).val() != '-' ){
169
 
170
- if( confirm(ajax_object.translations.dummy_data_notice) ){
171
 
172
  $('html').append('<div class="pwb-modal"><div class="pwb-modal-inner"></div></div>');
173
- $('.pwb-modal-inner').html('<p>'+ajax_object.translations.dummy_data+'</p>');
174
 
175
  var data = {
176
  'action': 'pwb_admin_dummy_data',
177
  'from': $(this).val()
178
  };
179
- $.post(ajax_object.ajax_url, data, function(response) {
180
 
181
  setTimeout( function(){
182
- location.href = ajax_object.brands_url;
183
  }, 1000 );
184
 
185
  });
@@ -220,7 +220,7 @@ jQuery( function ( $ ) {
220
  }
221
  } );
222
  }
223
- $('#wc_pwb_admin_status_result').html('<img src="'+ajax_object.site_url+'/wp-admin/images/spinner.gif'+'" alt="Loading" height="20" width="20">');
224
  $('#wc_pwb_admin_status_result').show();
225
  var data = {
226
  'action': 'pwb_system_status'
@@ -286,7 +286,7 @@ jQuery( function ( $ ) {
286
  $clickedBtn.prop("disabled",true);
287
 
288
  var data = { 'action': 'pwb_brands_export' };
289
- $.post(ajax_object.ajax_url, data, function(response) {
290
 
291
  if( response.success ){
292
  $clickedBtn.removeClass('pwb-loading-overlay');
@@ -324,7 +324,7 @@ jQuery( function ( $ ) {
324
  reqData.append('file', file);
325
 
326
  $.ajax({
327
- url: ajax_object.ajax_url,
328
  type: 'post',
329
  cache: false,
330
  dataType: 'json',
95
  $currentStar.addClass('dashicons-star-filled');
96
  }
97
  var data = { 'action': 'pwb_admin_set_featured_brand', 'brand': $currentStar.data('brand-id') };
98
+ $.post(pwb_ajax_object_admin.ajax_url, data, function( response ) {
99
  $currentStar.removeClass('pwb-blocked');
100
  if( response.success ){
101
  var $featuredCount = $('.taxonomy-pwb-brand .pwb-featured-count > span');
112
 
113
  $('.taxonomy-pwb-brand #pwb-first-featured-brands').on('change', function(e){
114
  e.preventDefault();
115
+ $('#screen-options-apply').replaceWith('<img src="'+pwb_ajax_object_admin.site_url+'/wp-admin/images/loading.gif">');
116
  var data = { 'action': 'pwb_admin_save_screen_settings', 'new_val': $(this).is(':checked') };
117
+ $.post(pwb_ajax_object_admin.ajax_url, data, function(response) { location.reload(); });
118
  });
119
 
120
  $('.pwb-edit-brands-bottom > span').on('click', function(e){
135
 
136
  if( $(this).val() != '-' ){
137
 
138
+ if( confirm(pwb_ajax_object_admin.translations.migrate_notice) ){
139
 
140
  $('html').append('<div class="pwb-modal"><div class="pwb-modal-inner"></div></div>');
141
+ $('.pwb-modal-inner').html('<p>'+pwb_ajax_object_admin.translations.migrating+'</p>');
142
 
143
  var data = {
144
  'action': 'pwb_admin_migrate_brands',
145
  'from': $(this).val()
146
  };
147
+ $.post(pwb_ajax_object_admin.ajax_url, data, function(response) {
148
 
149
  setTimeout( function(){
150
+ location.href = pwb_ajax_object_admin.brands_url;
151
  }, 1000 );
152
 
153
  });
167
 
168
  if( $(this).val() != '-' ){
169
 
170
+ if( confirm(pwb_ajax_object_admin.translations.dummy_data_notice) ){
171
 
172
  $('html').append('<div class="pwb-modal"><div class="pwb-modal-inner"></div></div>');
173
+ $('.pwb-modal-inner').html('<p>'+pwb_ajax_object_admin.translations.dummy_data+'</p>');
174
 
175
  var data = {
176
  'action': 'pwb_admin_dummy_data',
177
  'from': $(this).val()
178
  };
179
+ $.post(pwb_ajax_object_admin.ajax_url, data, function(response) {
180
 
181
  setTimeout( function(){
182
+ location.href = pwb_ajax_object_admin.brands_url;
183
  }, 1000 );
184
 
185
  });
220
  }
221
  } );
222
  }
223
+ $('#wc_pwb_admin_status_result').html('<img src="'+pwb_ajax_object_admin.site_url+'/wp-admin/images/spinner.gif'+'" alt="Loading" height="20" width="20">');
224
  $('#wc_pwb_admin_status_result').show();
225
  var data = {
226
  'action': 'pwb_system_status'
286
  $clickedBtn.prop("disabled",true);
287
 
288
  var data = { 'action': 'pwb_brands_export' };
289
+ $.post(pwb_ajax_object_admin.ajax_url, data, function(response) {
290
 
291
  if( response.success ){
292
  $clickedBtn.removeClass('pwb-loading-overlay');
324
  reqData.append('file', file);
325
 
326
  $.ajax({
327
+ url: pwb_ajax_object_admin.ajax_url,
328
  type: 'post',
329
  cache: false,
330
  dataType: 'json',
assets/js/functions-admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(d){var b=null;function a(h,g){var i=g.parent();b=wp.media({frame:"post",state:"insert",multiple:false});b.on("insert",function(){var l=b.state().get("selection").first().toJSON();var m=l.id;var n=l.url;var k='<img src="'+n+'" width="90" height="90">';var j="";switch(h.target.id){case"pwb_brand_image_select":j=".taxonomy-pwb-brand #pwb_brand_image";break;case"pwb_brand_banner_select":j=".taxonomy-pwb-brand #pwb_brand_banner";break}d(j).val(m);d(j+"_result").remove();if(d(".pwb_brand_image_selected",i).length){d(".pwb_brand_image_selected span",i).html(k)}else{i.append('<div class="pwb_brand_image_selected"><span>'+k+"</span></div>")}c(i)});b.open()}d(".taxonomy-pwb-brand #pwb_brand_image_select, .taxonomy-pwb-brand #pwb_brand_banner_select").on("click",function(g){a(g,d(this))});d(".taxonomy-pwb-brand #pwb_brand_image_select, .taxonomy-pwb-brand #pwb_brand_banner_select").each(function(){c(d(this).parent())});if(d("body").hasClass("edit-tags-php")&&d("body").hasClass("taxonomy-pwb-brand")){jQuery(document).ajaxSuccess(function(h,i,g){if(typeof g!="undefined"&&g.data&&~g.data.indexOf("action=add-tag")&&~g.data.indexOf("taxonomy=pwb-brand")){d("#pwb_brand_image").val("");d("#pwb_brand_banner").val("");d(".pwb_brand_image_selected").remove()}})}function c(g){d(".pwb_brand_image_selected span",g).append('<a href="#" class="pwb_brand_image_selected_remove">X</a>');d(".pwb_brand_image_selected_remove",g).on("click",function(h){h.preventDefault();d(this).closest(".pwb_brand_image_selected").remove();d("#pwb_brand_image",g).val("");d("#pwb_brand_banner",g).val("")})}d(".taxonomy-pwb-brand table .column-featured > span").not("pwb-blocked").on("click",function(h){h.preventDefault();var i=d(this);i.addClass("pwb-blocked");if(i.hasClass("dashicons-star-filled")){i.removeClass("dashicons-star-filled");i.addClass("dashicons-star-empty")}else{i.removeClass("dashicons-star-empty");i.addClass("dashicons-star-filled")}var g={action:"pwb_admin_set_featured_brand",brand:i.data("brand-id")};d.post(ajax_object.ajax_url,g,function(j){i.removeClass("pwb-blocked");if(j.success){var k=d(".taxonomy-pwb-brand .pwb-featured-count > span");if(j.data.direction=="up"){k.html(parseInt(k.text())+1)}else{k.html(parseInt(k.text())-1)}}else{alert(j.data.error_msg)}})});d(".taxonomy-pwb-brand #pwb-first-featured-brands").on("change",function(h){h.preventDefault();d("#screen-options-apply").replaceWith('<img src="'+ajax_object.site_url+'/wp-admin/images/loading.gif">');var g={action:"pwb_admin_save_screen_settings",new_val:d(this).is(":checked")};d.post(ajax_object.ajax_url,g,function(i){location.reload()})});d(".pwb-edit-brands-bottom > span").on("click",function(g){g.preventDefault();d(".taxonomy-pwb-brand #col-left").toggleClass("pwb-force-full-width");d(".taxonomy-pwb-brand #col-right").toggleClass("pwb-force-full-width")});if(d(".pwb-admin-selectwoo").length){d(".pwb-admin-selectwoo").selectWoo()}d("#wc_pwb_admin_tab_tools_migrate").on("change",function(){if(d(this).val()!="-"){if(confirm(ajax_object.translations.migrate_notice)){d("html").append('<div class="pwb-modal"><div class="pwb-modal-inner"></div></div>');d(".pwb-modal-inner").html("<p>"+ajax_object.translations.migrating+"</p>");var g={action:"pwb_admin_migrate_brands",from:d(this).val()};d.post(ajax_object.ajax_url,g,function(h){setTimeout(function(){location.href=ajax_object.brands_url},1000)})}else{}}d(this).val("-")});d("#wc_pwb_admin_tab_tools_dummy_data").on("change",function(){if(d(this).val()!="-"){if(confirm(ajax_object.translations.dummy_data_notice)){d("html").append('<div class="pwb-modal"><div class="pwb-modal-inner"></div></div>');d(".pwb-modal-inner").html("<p>"+ajax_object.translations.dummy_data+"</p>");var g={action:"pwb_admin_dummy_data",from:d(this).val()};d.post(ajax_object.ajax_url,g,function(h){setTimeout(function(){location.href=ajax_object.brands_url},1000)})}else{}}d(this).val("-")});var f=d("#wc_pwb_admin_tab_tools_system_status").siblings("p");f.addClass("button wc_pwb_admin_tab_status_btn");d(".wc_pwb_admin_tab_status_btn").on("click",function(h){h.preventDefault();if(!d("#wc_pwb_admin_status_result").length){$systemStatusTextarea=d("#wc_pwb_admin_tab_tools_system_status");d('<pre id="wc_pwb_admin_status_result"></pre>').insertAfter($systemStatusTextarea);jQuery("#wc_pwb_admin_status_result").click(function(l){l.preventDefault();var j=d(this)[0];if(d.browser.msie){var i=document.body.createTextRange();i.moveToElementText(j);i.select()}else{if(d.browser.mozilla||d.browser.opera){var k=window.getSelection();var i=document.createRange();i.selectNodeContents(j);k.removeAllRanges();k.addRange(i)}else{if(d.browser.safari){var k=window.getSelection();k.setBaseAndExtent(j,0,j,1)}}}})}d("#wc_pwb_admin_status_result").html('<img src="'+ajax_object.site_url+'/wp-admin/images/spinner.gif" alt="Loading" height="20" width="20">');d("#wc_pwb_admin_status_result").show();var g={action:"pwb_system_status"};jQuery.post(ajaxurl,g,function(i){d("#wc_pwb_admin_status_result").html(i);d("#wc_pwb_admin_status_result").trigger("click")})});d(document).on("click",".pwb-notice-dismissible .notice-dismiss",function(i){i.preventDefault();var g=d(this).closest(".pwb-notice-dismissible").data("notice");var h={action:"dismiss_pwb_notice",notice_name:g};jQuery.post(ajaxurl,h,function(j){})});e();jQuery(document).bind("widget-added",function(h,g){e(g)});jQuery(document).on("widget-updated",function(h,g){e(g)});function e(g){$currentWidget=d(".pwb-select-display-as");if(g!=undefined){$currentWidget=d(".pwb-select-display-as",g)}$currentWidget.on("change",function(){if(d(this).val()=="brand_logo"){d(this).parent().siblings(".pwb-display-as-logo").addClass("show")}else{d(this).parent().siblings(".pwb-display-as-logo").removeClass("show")}})}d("button.pwb-brands-export").on("click",function(i){i.preventDefault();var h=d(this);h.addClass("pwb-loading-overlay");h.prop("disabled",true);var g={action:"pwb_brands_export"};d.post(ajax_object.ajax_url,g,function(j){if(j.success){h.removeClass("pwb-loading-overlay");h.prop("disabled",false);d("#pwb-download-export-file").remove();var k=document.createElement("a");k.download="brands.json";k.id="pwb-download-export-file";k.href=j.data.export_file_url;d("body").append(k);k.click()}})});d("button.pwb-brands-import").on("click",function(g){g.preventDefault();d("input.pwb-brands-import-file").trigger("click")});d("input.pwb-brands-import-file").on("change",function(j){j.preventDefault();var i=d("button.pwb-brands-import");i.addClass("pwb-loading-overlay");i.prop("disabled",true);var h=d(this)[0].files[0];var g=new FormData();g.append("action","pwb_brands_import");g.append("file",h);d.ajax({url:ajax_object.ajax_url,type:"post",cache:false,dataType:"json",contentType:false,processData:false,data:g,success:function(k){if(k.success){i.removeClass("pwb-loading-overlay");location.reload()}else{alert("Importer error")}}})})});
1
+ jQuery(function(d){var b=null;function a(h,g){var i=g.parent();b=wp.media({frame:"post",state:"insert",multiple:false});b.on("insert",function(){var l=b.state().get("selection").first().toJSON();var m=l.id;var n=l.url;var k='<img src="'+n+'" width="90" height="90">';var j="";switch(h.target.id){case"pwb_brand_image_select":j=".taxonomy-pwb-brand #pwb_brand_image";break;case"pwb_brand_banner_select":j=".taxonomy-pwb-brand #pwb_brand_banner";break}d(j).val(m);d(j+"_result").remove();if(d(".pwb_brand_image_selected",i).length){d(".pwb_brand_image_selected span",i).html(k)}else{i.append('<div class="pwb_brand_image_selected"><span>'+k+"</span></div>")}c(i)});b.open()}d(".taxonomy-pwb-brand #pwb_brand_image_select, .taxonomy-pwb-brand #pwb_brand_banner_select").on("click",function(g){a(g,d(this))});d(".taxonomy-pwb-brand #pwb_brand_image_select, .taxonomy-pwb-brand #pwb_brand_banner_select").each(function(){c(d(this).parent())});if(d("body").hasClass("edit-tags-php")&&d("body").hasClass("taxonomy-pwb-brand")){jQuery(document).ajaxSuccess(function(h,i,g){if(typeof g!="undefined"&&g.data&&~g.data.indexOf("action=add-tag")&&~g.data.indexOf("taxonomy=pwb-brand")){d("#pwb_brand_image").val("");d("#pwb_brand_banner").val("");d(".pwb_brand_image_selected").remove()}})}function c(g){d(".pwb_brand_image_selected span",g).append('<a href="#" class="pwb_brand_image_selected_remove">X</a>');d(".pwb_brand_image_selected_remove",g).on("click",function(h){h.preventDefault();d(this).closest(".pwb_brand_image_selected").remove();d("#pwb_brand_image",g).val("");d("#pwb_brand_banner",g).val("")})}d(".taxonomy-pwb-brand table .column-featured > span").not("pwb-blocked").on("click",function(h){h.preventDefault();var i=d(this);i.addClass("pwb-blocked");if(i.hasClass("dashicons-star-filled")){i.removeClass("dashicons-star-filled");i.addClass("dashicons-star-empty")}else{i.removeClass("dashicons-star-empty");i.addClass("dashicons-star-filled")}var g={action:"pwb_admin_set_featured_brand",brand:i.data("brand-id")};d.post(pwb_ajax_object_admin.ajax_url,g,function(j){i.removeClass("pwb-blocked");if(j.success){var k=d(".taxonomy-pwb-brand .pwb-featured-count > span");if(j.data.direction=="up"){k.html(parseInt(k.text())+1)}else{k.html(parseInt(k.text())-1)}}else{alert(j.data.error_msg)}})});d(".taxonomy-pwb-brand #pwb-first-featured-brands").on("change",function(h){h.preventDefault();d("#screen-options-apply").replaceWith('<img src="'+pwb_ajax_object_admin.site_url+'/wp-admin/images/loading.gif">');var g={action:"pwb_admin_save_screen_settings",new_val:d(this).is(":checked")};d.post(pwb_ajax_object_admin.ajax_url,g,function(i){location.reload()})});d(".pwb-edit-brands-bottom > span").on("click",function(g){g.preventDefault();d(".taxonomy-pwb-brand #col-left").toggleClass("pwb-force-full-width");d(".taxonomy-pwb-brand #col-right").toggleClass("pwb-force-full-width")});if(d(".pwb-admin-selectwoo").length){d(".pwb-admin-selectwoo").selectWoo()}d("#wc_pwb_admin_tab_tools_migrate").on("change",function(){if(d(this).val()!="-"){if(confirm(pwb_ajax_object_admin.translations.migrate_notice)){d("html").append('<div class="pwb-modal"><div class="pwb-modal-inner"></div></div>');d(".pwb-modal-inner").html("<p>"+pwb_ajax_object_admin.translations.migrating+"</p>");var g={action:"pwb_admin_migrate_brands",from:d(this).val()};d.post(pwb_ajax_object_admin.ajax_url,g,function(h){setTimeout(function(){location.href=pwb_ajax_object_admin.brands_url},1000)})}else{}}d(this).val("-")});d("#wc_pwb_admin_tab_tools_dummy_data").on("change",function(){if(d(this).val()!="-"){if(confirm(pwb_ajax_object_admin.translations.dummy_data_notice)){d("html").append('<div class="pwb-modal"><div class="pwb-modal-inner"></div></div>');d(".pwb-modal-inner").html("<p>"+pwb_ajax_object_admin.translations.dummy_data+"</p>");var g={action:"pwb_admin_dummy_data",from:d(this).val()};d.post(pwb_ajax_object_admin.ajax_url,g,function(h){setTimeout(function(){location.href=pwb_ajax_object_admin.brands_url},1000)})}else{}}d(this).val("-")});var f=d("#wc_pwb_admin_tab_tools_system_status").siblings("p");f.addClass("button wc_pwb_admin_tab_status_btn");d(".wc_pwb_admin_tab_status_btn").on("click",function(h){h.preventDefault();if(!d("#wc_pwb_admin_status_result").length){$systemStatusTextarea=d("#wc_pwb_admin_tab_tools_system_status");d('<pre id="wc_pwb_admin_status_result"></pre>').insertAfter($systemStatusTextarea);jQuery("#wc_pwb_admin_status_result").click(function(l){l.preventDefault();var j=d(this)[0];if(d.browser.msie){var i=document.body.createTextRange();i.moveToElementText(j);i.select()}else{if(d.browser.mozilla||d.browser.opera){var k=window.getSelection();var i=document.createRange();i.selectNodeContents(j);k.removeAllRanges();k.addRange(i)}else{if(d.browser.safari){var k=window.getSelection();k.setBaseAndExtent(j,0,j,1)}}}})}d("#wc_pwb_admin_status_result").html('<img src="'+pwb_ajax_object_admin.site_url+'/wp-admin/images/spinner.gif" alt="Loading" height="20" width="20">');d("#wc_pwb_admin_status_result").show();var g={action:"pwb_system_status"};jQuery.post(ajaxurl,g,function(i){d("#wc_pwb_admin_status_result").html(i);d("#wc_pwb_admin_status_result").trigger("click")})});d(document).on("click",".pwb-notice-dismissible .notice-dismiss",function(i){i.preventDefault();var g=d(this).closest(".pwb-notice-dismissible").data("notice");var h={action:"dismiss_pwb_notice",notice_name:g};jQuery.post(ajaxurl,h,function(j){})});e();jQuery(document).bind("widget-added",function(h,g){e(g)});jQuery(document).on("widget-updated",function(h,g){e(g)});function e(g){$currentWidget=d(".pwb-select-display-as");if(g!=undefined){$currentWidget=d(".pwb-select-display-as",g)}$currentWidget.on("change",function(){if(d(this).val()=="brand_logo"){d(this).parent().siblings(".pwb-display-as-logo").addClass("show")}else{d(this).parent().siblings(".pwb-display-as-logo").removeClass("show")}})}d("button.pwb-brands-export").on("click",function(i){i.preventDefault();var h=d(this);h.addClass("pwb-loading-overlay");h.prop("disabled",true);var g={action:"pwb_brands_export"};d.post(pwb_ajax_object_admin.ajax_url,g,function(j){if(j.success){h.removeClass("pwb-loading-overlay");h.prop("disabled",false);d("#pwb-download-export-file").remove();var k=document.createElement("a");k.download="brands.json";k.id="pwb-download-export-file";k.href=j.data.export_file_url;d("body").append(k);k.click()}})});d("button.pwb-brands-import").on("click",function(g){g.preventDefault();d("input.pwb-brands-import-file").trigger("click")});d("input.pwb-brands-import-file").on("change",function(j){j.preventDefault();var i=d("button.pwb-brands-import");i.addClass("pwb-loading-overlay");i.prop("disabled",true);var h=d(this)[0].files[0];var g=new FormData();g.append("action","pwb_brands_import");g.append("file",h);d.ajax({url:pwb_ajax_object_admin.ajax_url,type:"post",cache:false,dataType:"json",contentType:false,processData:false,data:g,success:function(k){if(k.success){i.removeClass("pwb-loading-overlay");location.reload()}else{alert("Importer error")}}})})});
assets/js/functions-frontend.js CHANGED
@@ -11,8 +11,8 @@ jQuery( function ( $ ) {
11
  slide: '.pwb-slick-slide',
12
  infinite: true,
13
  draggable: false,
14
- prevArrow: '<div class="slick-prev"><span>'+ajax_object.carousel_prev+'</span></div>',
15
- nextArrow: '<div class="slick-next"><span>'+ajax_object.carousel_next+'</span></div>',
16
  speed: 300,
17
  lazyLoad: 'progressive',
18
  responsive: [
@@ -47,8 +47,8 @@ jQuery( function ( $ ) {
47
  slide: '.pwb-slick-slide',
48
  infinite: true,
49
  draggable: false,
50
- prevArrow: '<div class="slick-prev"><span>'+ajax_object.carousel_prev+'</span></div>',
51
- nextArrow: '<div class="slick-next"><span>'+ajax_object.carousel_next+'</span></div>',
52
  speed: 300,
53
  lazyLoad: 'progressive',
54
  responsive: [
11
  slide: '.pwb-slick-slide',
12
  infinite: true,
13
  draggable: false,
14
+ prevArrow: '<div class="slick-prev"><span>'+pwb_ajax_object.carousel_prev+'</span></div>',
15
+ nextArrow: '<div class="slick-next"><span>'+pwb_ajax_object.carousel_next+'</span></div>',
16
  speed: 300,
17
  lazyLoad: 'progressive',
18
  responsive: [
47
  slide: '.pwb-slick-slide',
48
  infinite: true,
49
  draggable: false,
50
+ prevArrow: '<div class="slick-prev"><span>'+pwb_ajax_object.carousel_prev+'</span></div>',
51
+ nextArrow: '<div class="slick-next"><span>'+pwb_ajax_object.carousel_next+'</span></div>',
52
  speed: 300,
53
  lazyLoad: 'progressive',
54
  responsive: [
assets/js/functions-frontend.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(e){e(".pwb-dropdown-widget").on("change",function(){var g=e(this).find(":selected").val();location.href=g});if(typeof e.fn.slick==="function"){e(".pwb-carousel").slick({slide:".pwb-slick-slide",infinite:true,draggable:false,prevArrow:'<div class="slick-prev"><span>'+ajax_object.carousel_prev+"</span></div>",nextArrow:'<div class="slick-next"><span>'+ajax_object.carousel_next+"</span></div>",speed:300,lazyLoad:"progressive",responsive:[{breakpoint:1024,settings:{slidesToShow:4,draggable:true,arrows:false}},{breakpoint:600,settings:{slidesToShow:3,draggable:true,arrows:false}},{breakpoint:480,settings:{slidesToShow:2,draggable:true,arrows:false}}]});e(".pwb-product-carousel").slick({slide:".pwb-slick-slide",infinite:true,draggable:false,prevArrow:'<div class="slick-prev"><span>'+ajax_object.carousel_prev+"</span></div>",nextArrow:'<div class="slick-next"><span>'+ajax_object.carousel_next+"</span></div>",speed:300,lazyLoad:"progressive",responsive:[{breakpoint:1024,settings:{slidesToShow:3,draggable:true,arrows:false}},{breakpoint:600,settings:{slidesToShow:2,draggable:true,arrows:false}},{breakpoint:480,settings:{slidesToShow:1,draggable:true,arrows:false}}]})}var f=function(){var h=[location.protocol,"//",location.host,location.pathname].join("");var i=window.location.href;var g=[];e('.pwb-filter-products input[type="checkbox"]').each(function(j){if(e(this).prop("checked")){g.push(e(this).val())}});g=g.join();if(g){i=i.replace(/&?pwb-brand-filter=([^&]$|[^&]*)/i,"");i=i.replace(/\/page\/\d*\//i,"");if(i.indexOf("?")===-1){i=i+"?pwb-brand-filter="+g}else{i=i+"&pwb-brand-filter="+g}}else{i=h}location.href=i};e(".pwb-filter-products button").on("click",function(){f()});e(".pwb-filter-products.pwb-hide-submit-btn input").on("change",function(){f()});var d=PWBgetUrlParameter("pwb-brand-filter");if(d!=null){var b=d.split(",");e('.pwb-filter-products input[type="checkbox"]').prop("checked",false);for(var c=0,a=b.length;c<a;c++){e('.pwb-filter-products input[type="checkbox"]').each(function(g){if(e(this).val()){if(b[c]==e(this).val()){e(this).prop("checked",true)}}})}}else{e('.pwb-filter-products input[type="checkbox"]').prop("checked",false)}});var PWBgetUrlParameter=function PWBgetUrlParameter(a){var d=decodeURIComponent(window.location.search.substring(1)),c=d.split("&"),e,b;for(b=0;b<c.length;b++){e=c[b].split("=");if(e[0]===a){return e[1]===undefined?true:e[1]}}};
1
+ jQuery(function(e){e(".pwb-dropdown-widget").on("change",function(){var g=e(this).find(":selected").val();location.href=g});if(typeof e.fn.slick==="function"){e(".pwb-carousel").slick({slide:".pwb-slick-slide",infinite:true,draggable:false,prevArrow:'<div class="slick-prev"><span>'+pwb_ajax_object.carousel_prev+"</span></div>",nextArrow:'<div class="slick-next"><span>'+pwb_ajax_object.carousel_next+"</span></div>",speed:300,lazyLoad:"progressive",responsive:[{breakpoint:1024,settings:{slidesToShow:4,draggable:true,arrows:false}},{breakpoint:600,settings:{slidesToShow:3,draggable:true,arrows:false}},{breakpoint:480,settings:{slidesToShow:2,draggable:true,arrows:false}}]});e(".pwb-product-carousel").slick({slide:".pwb-slick-slide",infinite:true,draggable:false,prevArrow:'<div class="slick-prev"><span>'+pwb_ajax_object.carousel_prev+"</span></div>",nextArrow:'<div class="slick-next"><span>'+pwb_ajax_object.carousel_next+"</span></div>",speed:300,lazyLoad:"progressive",responsive:[{breakpoint:1024,settings:{slidesToShow:3,draggable:true,arrows:false}},{breakpoint:600,settings:{slidesToShow:2,draggable:true,arrows:false}},{breakpoint:480,settings:{slidesToShow:1,draggable:true,arrows:false}}]})}var f=function(){var h=[location.protocol,"//",location.host,location.pathname].join("");var i=window.location.href;var g=[];e('.pwb-filter-products input[type="checkbox"]').each(function(j){if(e(this).prop("checked")){g.push(e(this).val())}});g=g.join();if(g){i=i.replace(/&?pwb-brand-filter=([^&]$|[^&]*)/i,"");i=i.replace(/\/page\/\d*\//i,"");if(i.indexOf("?")===-1){i=i+"?pwb-brand-filter="+g}else{i=i+"&pwb-brand-filter="+g}}else{i=h}location.href=i};e(".pwb-filter-products button").on("click",function(){f()});e(".pwb-filter-products.pwb-hide-submit-btn input").on("change",function(){f()});var d=PWBgetUrlParameter("pwb-brand-filter");if(d!=null){var b=d.split(",");e('.pwb-filter-products input[type="checkbox"]').prop("checked",false);for(var c=0,a=b.length;c<a;c++){e('.pwb-filter-products input[type="checkbox"]').each(function(g){if(e(this).val()){if(b[c]==e(this).val()){e(this).prop("checked",true)}}})}}else{e('.pwb-filter-products input[type="checkbox"]').prop("checked",false)}});var PWBgetUrlParameter=function PWBgetUrlParameter(a){var d=decodeURIComponent(window.location.search.substring(1)),c=d.split("&"),e,b;for(b=0;b<c.length;b++){e=c[b].split("=");if(e[0]===a){return e[1]===undefined?true:e[1]}}};
classes/class-perfect-woocommerce-brands.php CHANGED
@@ -680,7 +680,7 @@ class Perfect_Woocommerce_Brands{
680
  true
681
  );
682
 
683
- wp_localize_script( 'pwb-functions-frontend', 'ajax_object', array(
684
  'carousel_prev' => apply_filters('pwb_carousel_prev','&lt;'),
685
  'carousel_next' => apply_filters('pwb_carousel_next','&gt;')
686
  ) );
@@ -698,7 +698,7 @@ class Perfect_Woocommerce_Brands{
698
  wp_enqueue_style('pwb-styles-admin', PWB_PLUGIN . '/assets/css/styles-admin.min.css', array(), PWB_PLUGIN_VERSION);
699
 
700
  wp_register_script('pwb-functions-admin', PWB_PLUGIN . '/assets/js/functions-admin.min.js', array('jquery'), PWB_PLUGIN_VERSION, true);
701
- wp_localize_script( 'pwb-functions-admin', 'ajax_object', array(
702
  'ajax_url' => admin_url( 'admin-ajax.php' ),
703
  'site_url' => site_url(),
704
  'brands_url' => admin_url( 'edit-tags.php?taxonomy=pwb-brand&post_type=product' ),
680
  true
681
  );
682
 
683
+ wp_localize_script( 'pwb-functions-frontend', 'pwb_ajax_object', array(
684
  'carousel_prev' => apply_filters('pwb_carousel_prev','&lt;'),
685
  'carousel_next' => apply_filters('pwb_carousel_next','&gt;')
686
  ) );
698
  wp_enqueue_style('pwb-styles-admin', PWB_PLUGIN . '/assets/css/styles-admin.min.css', array(), PWB_PLUGIN_VERSION);
699
 
700
  wp_register_script('pwb-functions-admin', PWB_PLUGIN . '/assets/js/functions-admin.min.js', array('jquery'), PWB_PLUGIN_VERSION, true);
701
+ wp_localize_script( 'pwb-functions-admin', 'pwb_ajax_object_admin', array(
702
  'ajax_url' => admin_url( 'admin-ajax.php' ),
703
  'site_url' => site_url(),
704
  'brands_url' => admin_url( 'edit-tags.php?taxonomy=pwb-brand&post_type=product' ),
classes/class-pwb-product-tab.php CHANGED
@@ -13,16 +13,19 @@ class PWB_Product_Tab{
13
  public function product_tab( $tabs ){
14
 
15
  global $product;
16
- $brands = wp_get_object_terms( $product->get_id(), 'pwb-brand' );
17
 
18
- if( !empty( $brands ) ){
19
- $show_brand_tab = get_option( 'wc_pwb_admin_tab_brand_single_product_tab' );
20
- if( $show_brand_tab == 'yes' || !$show_brand_tab ){
21
- $tabs['pwb_tab'] = array(
22
- 'title' => __( 'Brand', 'perfect-woocommerce-brands' ),
23
- 'priority' => 20,
24
- 'callback' => array( $this, 'product_tab_content' )
25
- );
 
 
 
 
26
  }
27
  }
28
 
@@ -38,7 +41,7 @@ class PWB_Product_Tab{
38
  ob_start();
39
  ?>
40
 
41
- <h2><?php echo __('Brand', 'perfect-woocommerce-brands'); ?></h2>
42
  <?php foreach( $brands as $brand ): ?>
43
 
44
  <?php
13
  public function product_tab( $tabs ){
14
 
15
  global $product;
 
16
 
17
+ if( isset( $product ) ){
18
+ $brands = wp_get_object_terms( $product->get_id(), 'pwb-brand' );
19
+
20
+ if( !empty( $brands ) ){
21
+ $show_brand_tab = get_option( 'wc_pwb_admin_tab_brand_single_product_tab' );
22
+ if( $show_brand_tab == 'yes' || !$show_brand_tab ){
23
+ $tabs['pwb_tab'] = array(
24
+ 'title' => __( 'Brand', 'perfect-woocommerce-brands' ),
25
+ 'priority' => 20,
26
+ 'callback' => array( $this, 'product_tab_content' )
27
+ );
28
+ }
29
  }
30
  }
31
 
41
  ob_start();
42
  ?>
43
 
44
+ <h2><?php echo apply_filters( 'woocommerce_product_brand_heading', __('Brand', 'perfect-woocommerce-brands') ); ?></h2>
45
  <?php foreach( $brands as $brand ): ?>
46
 
47
  <?php
main.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: Perfect WooCommerce Brands
4
  * Plugin URI: https://wordpress.org/plugins/perfect-woocommerce-brands/
5
  * Description: Perfect WooCommerce Brands allows you to show product brands in your WooCommerce based store.
6
- * Version: 1.7.5
7
  * Author: Alberto de Vera Sevilla
8
  * Author URI: https://profiles.wordpress.org/titodevera/
9
  * Text Domain: perfect-woocommerce-brands
10
  * Domain Path: /lang
11
  * License: GPL3
12
- * Perfect WooCommerce Brands version 1.7.5, Copyright (C) 2019 Alberto de Vera Sevilla
13
  * Perfect WooCommerce Brands is free software: you can redistribute it and/or modify
14
  * it under the terms of the GNU General Public License as published by
15
  * the Free Software Foundation, either version 3 of the License, or
@@ -34,7 +34,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
34
  define( 'PWB_PLUGIN', plugins_url( '', __FILE__ ) );
35
  define( 'PWB_PLUGIN_PATH', plugin_basename( dirname( __FILE__ ) ) );
36
  define( 'PWB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
37
- define( 'PWB_PLUGIN_VERSION', '1.7.5' );
38
  define( 'PWB_WP_VERSION', get_bloginfo( 'version' ) );
39
  define( 'PWB_WC_VERSION', get_option( 'woocommerce_version' ) );
40
 
3
  * Plugin Name: Perfect WooCommerce Brands
4
  * Plugin URI: https://wordpress.org/plugins/perfect-woocommerce-brands/
5
  * Description: Perfect WooCommerce Brands allows you to show product brands in your WooCommerce based store.
6
+ * Version: 1.7.6
7
  * Author: Alberto de Vera Sevilla
8
  * Author URI: https://profiles.wordpress.org/titodevera/
9
  * Text Domain: perfect-woocommerce-brands
10
  * Domain Path: /lang
11
  * License: GPL3
12
+ * Perfect WooCommerce Brands version 1.7.6, Copyright (C) 2019 Alberto de Vera Sevilla
13
  * Perfect WooCommerce Brands is free software: you can redistribute it and/or modify
14
  * it under the terms of the GNU General Public License as published by
15
  * the Free Software Foundation, either version 3 of the License, or
34
  define( 'PWB_PLUGIN', plugins_url( '', __FILE__ ) );
35
  define( 'PWB_PLUGIN_PATH', plugin_basename( dirname( __FILE__ ) ) );
36
  define( 'PWB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
37
+ define( 'PWB_PLUGIN_VERSION', '1.7.6' );
38
  define( 'PWB_WP_VERSION', get_bloginfo( 'version' ) );
39
  define( 'PWB_WC_VERSION', get_option( 'woocommerce_version' ) );
40
 
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: titodevera
3
  Donate link: mailto:hola@albertodevera.es
4
  Tags: woocommerce, brands, brand taxonomy, product brands, woocommerce manufacturer, woocommerce supplier, e-commerce
5
  Requires at least: 4.7
6
- Tested up to: 5.1
7
  Requires PHP: 5.6
8
- Stable tag: 1.7.5
9
  License: GPL3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.en.html
11
 
@@ -81,6 +81,11 @@ You can also contribute [translating the plugin](https://translate.wordpress.org
81
 
82
 
83
  == Changelog ==
 
 
 
 
 
84
  = 1.7.5 =
85
  * Fix: Stupid JS error introduced in the previous version
86
  = 1.7.4 =
3
  Donate link: mailto:hola@albertodevera.es
4
  Tags: woocommerce, brands, brand taxonomy, product brands, woocommerce manufacturer, woocommerce supplier, e-commerce
5
  Requires at least: 4.7
6
+ Tested up to: 5.2
7
  Requires PHP: 5.6
8
+ Stable tag: 1.7.6
9
  License: GPL3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.en.html
11
 
81
 
82
 
83
  == Changelog ==
84
+ = 1.7.6 =
85
+ * Tested up to, bump
86
+ * Dev: New filter hook "woocommerce_product_brand_heading" for editing the "Brand" tab heading
87
+ * Fix: Some problems with the "Brand" product tab
88
+ * Fix: Avoid a possible JS conflict caused by "wp_localize_script"
89
  = 1.7.5 =
90
  * Fix: Stupid JS error introduced in the previous version
91
  = 1.7.4 =