Perfect Brands for WooCommerce - Version 1.6.1

Version Description

  • Feature: Favorite brands
  • Fix: Brand logo full size option for single product
  • Fix: Coupons brands restriction (thanks @josk79)
  • Fix: Import products fixes
  • Fix: PHP7 warning on 'class-perfect-woocommerce-brands.php'
  • Fix: Brand not added when Duplicating Product
  • Enhancement: Filter by brand widget enhancements
  • Enhancement: Carousels enhancements
  • Enhancement: JS and CSS minified
Download this release

Release Info

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

Code changes from version 1.6.0 to 1.6.1

assets/css/styles-admin.css CHANGED
@@ -1,3 +1,13 @@
 
 
 
 
 
 
 
 
 
 
1
  /* ----------------------- Taxonomy pwb-brand ----------------------- */
2
  .taxonomy-pwb-brand .pwb_brand_image_selected_remove{
3
  color: #FF3030;
@@ -34,14 +44,60 @@
34
  .taxonomy-pwb-brand .pwb_brand_cont div{
35
  margin-top: 10px;
36
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  @media screen and (max-width: 782px) {
38
  .taxonomy-pwb-brand .wp-list-table thead th.column-logo, .taxonomy-pwb-brand .wp-list-table tfoot th.column-logo {
39
  display: none;
40
  }
41
-
42
  .taxonomy-pwb-brand .wp-list-table td.column-logo:before {
43
  content: ""!important;
44
  }
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
  /* ----------------------- /Taxonomy pwb-brand ----------------------- */
47
 
1
+ /* ----------------------- Global ----------------------- */
2
+ .pwb-clearfix:after{
3
+ content: "";
4
+ display: table;
5
+ clear: both;
6
+ }
7
+ .pwb-blocked{
8
+ opacity: .6;
9
+ }
10
+ /* ----------------------- /Global ----------------------- */
11
  /* ----------------------- Taxonomy pwb-brand ----------------------- */
12
  .taxonomy-pwb-brand .pwb_brand_image_selected_remove{
13
  color: #FF3030;
44
  .taxonomy-pwb-brand .pwb_brand_cont div{
45
  margin-top: 10px;
46
  }
47
+ .taxonomy-pwb-brand #col-right.pwb-force-full-width .pwb-edit-brands-bottom > span{
48
+ -ms-transform: rotate(180deg);
49
+ -webkit-transform: rotate(180deg);
50
+ transform: rotate(180deg);
51
+ }
52
+ .taxonomy-pwb-brand table.wp-list-table .column-featured{
53
+ width: 48px;
54
+ text-align: center;
55
+ }
56
+ .taxonomy-pwb-brand .pwb-edit-brands-bottom{
57
+ margin-top: 20px;
58
+ margin-bottom: 20px;
59
+ background-color: #f6f6f6;
60
+ border-top: 1px solid #e4e4e4;
61
+ padding: 10px;
62
+ }
63
+ .taxonomy-pwb-brand .pwb-edit-brands-bottom > span:hover{
64
+ cursor: pointer;
65
+ }
66
+ .taxonomy-pwb-brand .pwb-edit-brands-bottom > span{
67
+ float: left;
68
+ }
69
+ .taxonomy-pwb-brand .pwb-featured-count{
70
+ font-style: italic;
71
+ float: right;
72
+ margin-left: 12px;
73
+ margin-top: 0;
74
+ margin-bottom: 0;
75
+ }
76
+ .taxonomy-pwb-brand table.wp-list-table .column-featured .dashicons-star-empty:hover:before{
77
+ content: "\f155";
78
+ }
79
+ .taxonomy-pwb-brand table .column-featured > span:hover{
80
+ cursor: pointer;
81
+ }
82
  @media screen and (max-width: 782px) {
83
  .taxonomy-pwb-brand .wp-list-table thead th.column-logo, .taxonomy-pwb-brand .wp-list-table tfoot th.column-logo {
84
  display: none;
85
  }
 
86
  .taxonomy-pwb-brand .wp-list-table td.column-logo:before {
87
  content: ""!important;
88
  }
89
+ .taxonomy-pwb-brand .pwb-edit-brands-bottom > span{
90
+ display: none;
91
+ }
92
+ }
93
+ @media screen and (min-width: 782px) {
94
+ .taxonomy-pwb-brand #col-right.pwb-force-full-width{
95
+ width: 100%!important;
96
+ }
97
+ .taxonomy-pwb-brand #col-left.pwb-force-full-width{
98
+ width: 0!important;
99
+ display: none!important;
100
+ }
101
  }
102
  /* ----------------------- /Taxonomy pwb-brand ----------------------- */
103
 
assets/css/styles-admin.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .pwb-clearfix:after{content:"";display:table;clear:both}.pwb-blocked{opacity:.6}.taxonomy-pwb-brand .pwb_brand_image_selected_remove{color:#ff3030;font-family:Arial,Helvetica,sans-serif;text-decoration:none;font-size:20px;font-weight:bold;position:absolute;top:0;right:0;bottom:0;left:0;background-color:rgba(0,0,0,0.5);opacity:0;-webkit-transition:opacity 200ms ease-in-out;-moz-transition:opacity 200ms ease-in-out;-ms-transition:opacity 200ms ease-in-out;-o-transition:opacity 200ms ease-in-out;transition:opacity 200ms ease-in-out}.taxonomy-pwb-brand .pwb_brand_image_selected span{display:inline-block;position:relative;text-align:center;line-height:90px;height:90px}.taxonomy-pwb-brand .pwb_brand_image_selected span:hover .pwb_brand_image_selected_remove{opacity:1}.taxonomy-pwb-brand .pwb_brand_cont #pwb_brand_image,.taxonomy-pwb-brand .pwb_brand_cont #pwb_brand_banner{display:none}.taxonomy-pwb-brand .pwb_brand_cont div{margin-top:10px}.taxonomy-pwb-brand #col-right.pwb-force-full-width .pwb-edit-brands-bottom>span{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.taxonomy-pwb-brand table.wp-list-table .column-featured{width:48px;text-align:center}.taxonomy-pwb-brand .pwb-edit-brands-bottom{margin-top:20px;margin-bottom:20px;background-color:#f6f6f6;border-top:1px solid #e4e4e4;padding:10px}.taxonomy-pwb-brand .pwb-edit-brands-bottom>span:hover{cursor:pointer}.taxonomy-pwb-brand .pwb-edit-brands-bottom>span{float:left}.taxonomy-pwb-brand .pwb-featured-count{font-style:italic;float:right;margin-left:12px;margin-top:0;margin-bottom:0}.taxonomy-pwb-brand table.wp-list-table .column-featured .dashicons-star-empty:hover:before{content:"\f155"}.taxonomy-pwb-brand table .column-featured>span:hover{cursor:pointer}@media screen and (max-width:782px){.taxonomy-pwb-brand .wp-list-table thead th.column-logo,.taxonomy-pwb-brand .wp-list-table tfoot th.column-logo{display:none}.taxonomy-pwb-brand .wp-list-table td.column-logo:before{content:""!important}.taxonomy-pwb-brand .pwb-edit-brands-bottom>span{display:none}}@media screen and (min-width:782px){.taxonomy-pwb-brand #col-right.pwb-force-full-width{width:100%!important}.taxonomy-pwb-brand #col-left.pwb-force-full-width{width:0!important;display:none!important}}.widgets-php .widget[id*="_pwb_"] .widget-title{border-left:2px solid #cda000}#wc_pwb_admin_status_result{display:none;background-color:#f6f6f6;padding:14px}#wc_pwb_admin_tab_tools_system_status{display:none!important}select.pwb-admin-tab-field,input[type="text"].pwb-admin-tab-field{min-width:350px;display:block;height:auto}.pwb-display-as-logo{display:none}.pwb-display-as-logo.show{display:block}.pwb-notice-dismissible p a{margin-right:12px}.pwb-notice-dismissible .dashicons-heart{color:#f188ff;margin-left:3px}.pwb-modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:99999999999;line-height:1;background:rgba(0,0,0,0.9);font-size:2em;padding-top:20px;text-align:center}.pwb-modal-inner{max-width:70%;margin:0 auto;animation:pwbblinkkf 3s linear infinite;color:#fff}.pwb-modal-inner p{font-size:2em}@keyframes pwbblinkkf{50%{opacity:0}}
assets/css/styles-frontend.css CHANGED
@@ -6,7 +6,7 @@
6
  }
7
  /* ----------------------- /Global ----------------------- */
8
 
9
- /* ----------------------- PWB Carousel ----------------------- */
10
  .pwb-carousel .slick-slide a{
11
  display: block;
12
  }
@@ -22,24 +22,18 @@
22
  .pwb-carousel .slick-prev, .pwb-carousel .slick-next,
23
  .pwb-product-carousel .slick-prev, .pwb-product-carousel .slick-next{
24
  font-size: 0;
25
-
26
  position: absolute;
27
  top: 0;
28
  bottom: 0;
29
-
30
  display: block;
31
-
32
  cursor: pointer;
33
-
34
  font-size: 22px;
35
  width: 30px;
36
  overflow: hidden;
37
  text-align: center;
38
-
39
  color: #aeaeae;
40
  border: none;
41
  outline: none;
42
-
43
  z-index: 999;
44
  background: #eee;
45
  opacity: 0;
@@ -47,7 +41,6 @@
47
  -webkit-transition: opacity 0.3s ease-in-out;
48
  -moz-transition: opacity 0.3s ease-in-out;
49
  -o-transition: opacity 0.3s ease-in-out;
50
-
51
  }
52
  .pwb-carousel .slick-prev > span, .pwb-carousel .slick-next > span,
53
  .pwb-product-carousel .slick-prev > span, .pwb-product-carousel .slick-next > span{
@@ -86,7 +79,96 @@
86
  width: 100%;
87
  margin-bottom: 12px;
88
  }
89
- /* ----------------------- /PWB Carousel ----------------------- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  /* ----------------------- PWB All Brands ----------------------- */
92
  .pwb-brands-cols-outer{
6
  }
7
  /* ----------------------- /Global ----------------------- */
8
 
9
+ /* ----------------------- Carousels ----------------------- */
10
  .pwb-carousel .slick-slide a{
11
  display: block;
12
  }
22
  .pwb-carousel .slick-prev, .pwb-carousel .slick-next,
23
  .pwb-product-carousel .slick-prev, .pwb-product-carousel .slick-next{
24
  font-size: 0;
 
25
  position: absolute;
26
  top: 0;
27
  bottom: 0;
 
28
  display: block;
 
29
  cursor: pointer;
 
30
  font-size: 22px;
31
  width: 30px;
32
  overflow: hidden;
33
  text-align: center;
 
34
  color: #aeaeae;
35
  border: none;
36
  outline: none;
 
37
  z-index: 999;
38
  background: #eee;
39
  opacity: 0;
41
  -webkit-transition: opacity 0.3s ease-in-out;
42
  -moz-transition: opacity 0.3s ease-in-out;
43
  -o-transition: opacity 0.3s ease-in-out;
 
44
  }
45
  .pwb-carousel .slick-prev > span, .pwb-carousel .slick-next > span,
46
  .pwb-product-carousel .slick-prev > span, .pwb-product-carousel .slick-next > span{
79
  width: 100%;
80
  margin-bottom: 12px;
81
  }
82
+ /* ------ Preloader ------ */
83
+ .pwb-carousel, .pwb-product-carousel{
84
+ min-height: 30px;
85
+ }
86
+ .pwb-carousel .slick-list,
87
+ .pwb-product-carousel .slick-list {
88
+ opacity: 0;
89
+ position: absolute;
90
+ }
91
+ .pwb-carousel.slick-initialized,
92
+ .pwb-product-carousel.slick-initialized {
93
+ min-height: none;
94
+ }
95
+ .pwb-carousel.slick-initialized .slick-list,
96
+ .pwb-product-carousel.slick-initialized .slick-list {
97
+ opacity: 1;
98
+ position: relative;
99
+ transition: opacity 0.2s ease-in;
100
+ }
101
+ .pwb-carousel.slick-initialized .pwb-carousel-loader,
102
+ .pwb-product-carousel.slick-initialized .pwb-carousel-loader {
103
+ display: none!important;
104
+ opacity: 0!important;
105
+ }
106
+ .pwb-carousel-loader{
107
+ font-size: 10px;
108
+ margin: 50px auto;
109
+ text-indent: -9999em;
110
+ width: 30px;
111
+ height: 30px;
112
+ border-radius: 50%;
113
+ background: #525252;
114
+ background: -moz-linear-gradient(left, #525252 10%, rgba(82,82,82, 0) 42%);
115
+ background: -webkit-linear-gradient(left, #525252 10%, rgba(82,82,82, 0) 42%);
116
+ background: -o-linear-gradient(left, #525252 10%, rgba(82,82,82, 0) 42%);
117
+ background: -ms-linear-gradient(left, #525252 10%, rgba(82,82,82, 0) 42%);
118
+ background: linear-gradient(to right, #525252 10%, rgba(82,82,82, 0) 42%);
119
+ position: relative;
120
+ -webkit-animation: PWBCarouselLoader 1.4s infinite linear;
121
+ animation: PWBCarouselLoader 1.4s infinite linear;
122
+ -webkit-transform: translateZ(0);
123
+ -ms-transform: translateZ(0);
124
+ transform: translateZ(0);
125
+ }
126
+ .pwb-carousel-loader:before {
127
+ width: 50%;
128
+ height: 50%;
129
+ background: #525252;
130
+ border-radius: 100% 0 0 0;
131
+ position: absolute;
132
+ top: 0;
133
+ left: 0;
134
+ content: '';
135
+ }
136
+ .pwb-carousel-loader:after {
137
+ background: #ffffff;
138
+ width: 75%;
139
+ height: 75%;
140
+ border-radius: 50%;
141
+ content: '';
142
+ margin: auto;
143
+ position: absolute;
144
+ top: 0;
145
+ left: 0;
146
+ bottom: 0;
147
+ right: 0;
148
+ }
149
+ @-webkit-keyframes PWBCarouselLoader {
150
+ 0% {
151
+ -webkit-transform: rotate(0deg);
152
+ transform: rotate(0deg);
153
+ }
154
+ 100% {
155
+ -webkit-transform: rotate(360deg);
156
+ transform: rotate(360deg);
157
+ }
158
+ }
159
+ @keyframes PWBCarouselLoader {
160
+ 0% {
161
+ -webkit-transform: rotate(0deg);
162
+ transform: rotate(0deg);
163
+ }
164
+ 100% {
165
+ -webkit-transform: rotate(360deg);
166
+ transform: rotate(360deg);
167
+ }
168
+ }
169
+ /* ------ /Preloader ------ */
170
+
171
+ /* ----------------------- /Carousels ----------------------- */
172
 
173
  /* ----------------------- PWB All Brands ----------------------- */
174
  .pwb-brands-cols-outer{
assets/css/styles-frontend.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .pwb-clearfix:after{content:"";display:table;clear:both}.pwb-carousel .slick-slide a{display:block}.pwb-carousel .slick-slide a>img{margin:0 auto}.pwb-carousel .slick-loading .slick-list,.pwb-product-carousel .slick-loading .slick-list{background:#fff url('./ajax-loader.gif') center center no-repeat}.pwb-carousel .slick-slide,.pwb-product-carousel .slick-slide{margin:0 10px}.pwb-carousel .slick-prev,.pwb-carousel .slick-next,.pwb-product-carousel .slick-prev,.pwb-product-carousel .slick-next{font-size:0;position:absolute;top:0;bottom:0;display:block;cursor:pointer;font-size:22px;width:30px;overflow:hidden;text-align:center;color:#aeaeae;border:0;outline:0;z-index:999;background:#eee;opacity:0;transition:opacity .3s ease-in-out;-webkit-transition:opacity .3s ease-in-out;-moz-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out}.pwb-carousel .slick-prev>span,.pwb-carousel .slick-next>span,.pwb-product-carousel .slick-prev>span,.pwb-product-carousel .slick-next>span{display:inline-block;height:20px;width:20px;padding:10px;position:absolute;top:50%;margin-top:-20px;left:0;right:0}.pwb-carousel .slick-prev:hover,.pwb-carousel .slick-prev:focus,.pwb-carousel .slick-next:hover,.pwb-carousel .slick-next:focus,.pwb-product-carousel .slick-prev:hover,.pwb-product-carousel .slick-prev:focus,.pwb-product-carousel .slick-next:hover,.pwb-product-carousel .slick-next:focus{outline:0}.pwb-carousel .slick-prev,.pwb-product-carousel .slick-prev{left:0}.pwb-carousel .slick-next,.pwb-product-carousel .slick-next{right:0}.pwb-carousel:hover .slick-next,.pwb-carousel:hover .slick-prev,.pwb-product-carousel:hover .slick-next,.pwb-product-carousel:hover .slick-prev{opacity:.8}.pwb-product-carousel .pwb-amount{display:block;width:100%;margin-bottom:12px}.pwb-carousel,.pwb-product-carousel{min-height:30px}.pwb-carousel .slick-list,.pwb-product-carousel .slick-list{opacity:0;position:absolute}.pwb-carousel.slick-initialized,.pwb-product-carousel.slick-initialized{min-height:none}.pwb-carousel.slick-initialized .slick-list,.pwb-product-carousel.slick-initialized .slick-list{opacity:1;position:relative;transition:opacity .2s ease-in}.pwb-carousel.slick-initialized .pwb-carousel-loader,.pwb-product-carousel.slick-initialized .pwb-carousel-loader{display:none!important;opacity:0!important}.pwb-carousel-loader{font-size:10px;margin:50px auto;text-indent:-9999em;width:30px;height:30px;border-radius:50%;background:#525252;background:-moz-linear-gradient(left,#525252 10%,rgba(82,82,82,0) 42%);background:-webkit-linear-gradient(left,#525252 10%,rgba(82,82,82,0) 42%);background:-o-linear-gradient(left,#525252 10%,rgba(82,82,82,0) 42%);background:-ms-linear-gradient(left,#525252 10%,rgba(82,82,82,0) 42%);background:linear-gradient(to right,#525252 10%,rgba(82,82,82,0) 42%);position:relative;-webkit-animation:PWBCarouselLoader 1.4s infinite linear;animation:PWBCarouselLoader 1.4s infinite linear;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0)}.pwb-carousel-loader:before{width:50%;height:50%;background:#525252;border-radius:100% 0 0 0;position:absolute;top:0;left:0;content:''}.pwb-carousel-loader:after{background:#fff;width:75%;height:75%;border-radius:50%;content:'';margin:auto;position:absolute;top:0;left:0;bottom:0;right:0}@-webkit-keyframes PWBCarouselLoader{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes PWBCarouselLoader{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.pwb-brands-cols-outer{margin-left:-15px;margin-right:-15px}.pwb-all-brands .pwb-pagination-wrapper{margin-top:20px;padding-top:10px;border-top:1px solid #ededed;text-align:right}.pwb-all-brands .pwb-pagination{display:inline-block;margin-right:10px;background-color:#ededed;color:#333;text-align:center;padding:10px}.pwb-all-brands .pwb-brands-cols-outer:after{content:"";display:table;clear:both}.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3{padding:0 15px;width:20%;float:left}.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3>p:first-child{height:25px;overflow:hidden;font-size:14px}.pwb-row:after{content:"";display:table;clear:both}.pwb-columns-2{width:50%}.pwb-columns-3{width:33.33333%}.pwb-columns-4{width:25%}.pwb-columns{display:inline-block;vertical-align:top}@media screen and (max-width:1000px){.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3{width:25%}}@media screen and (max-width:700px){.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3{width:50%}}@media screen and (max-width:480px){.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3{width:100%;float:none}.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3>p:first-child{height:auto}.pwb-columns-3,.pwb-columns-4{width:50%}}
assets/js/pwb_admin_functions.js CHANGED
@@ -82,6 +82,47 @@ jQuery(document).ready(function( $ ) {
82
 
83
  }
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
  /* ····························· Settings tab ····························· */
87
 
82
 
83
  }
84
 
85
+ /* ····························· Edit brands page ····························· */
86
+ $('.taxonomy-pwb-brand table .column-featured > span').not('pwb-blocked').on('click', function(e){
87
+ e.preventDefault();
88
+ var $currentStar = $(this);
89
+ $currentStar.addClass('pwb-blocked');
90
+ if( $currentStar.hasClass('dashicons-star-filled') ){
91
+ $currentStar.removeClass('dashicons-star-filled');
92
+ $currentStar.addClass('dashicons-star-empty');
93
+ }else{
94
+ $currentStar.removeClass('dashicons-star-empty');
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');
102
+ if( response.data.direction == 'up' ){
103
+ $featuredCount.html( parseInt( $featuredCount.text() ) + 1 );
104
+ }else{
105
+ $featuredCount.html( parseInt( $featuredCount.text() ) - 1 );
106
+ }
107
+ }else{
108
+ alert( response.data.error_msg );
109
+ }
110
+ });
111
+ });
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){
121
+ e.preventDefault();
122
+ $('.taxonomy-pwb-brand #col-left').toggleClass('pwb-force-full-width');
123
+ $('.taxonomy-pwb-brand #col-right').toggleClass('pwb-force-full-width');
124
+ });
125
+ /* ····························· /Edit brands page ····························· */
126
 
127
  /* ····························· Settings tab ····························· */
128
 
assets/js/pwb_admin_functions.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery.noConflict();jQuery(document).ready(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())});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")});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")}})}});
assets/js/pwb_frontend_functions.js CHANGED
@@ -7,11 +7,13 @@ jQuery(document).ready(function( $ ) {
7
  });
8
 
9
  $('.pwb-carousel').slick({
 
10
  infinite: true,
11
  draggable: false,
12
  prevArrow: '<div class="slick-prev"><span title="Prev">&lt;</span></div>',
13
  nextArrow: '<div class="slick-next"><span title="Next">&gt;</span></div>',
14
  speed: 300,
 
15
  responsive: [
16
  {
17
  breakpoint: 1024,
@@ -41,11 +43,13 @@ jQuery(document).ready(function( $ ) {
41
  });
42
 
43
  $('.pwb-product-carousel').slick({
 
44
  infinite: true,
45
  draggable: false,
46
  prevArrow: '<div class="slick-prev"><span title="Prev">&lt;</span></div>',
47
  nextArrow: '<div class="slick-next"><span title="Next">&gt;</span></div>',
48
  speed: 300,
 
49
  responsive: [
50
  {
51
  breakpoint: 1024,
7
  });
8
 
9
  $('.pwb-carousel').slick({
10
+ slide: '.slick-slide',
11
  infinite: true,
12
  draggable: false,
13
  prevArrow: '<div class="slick-prev"><span title="Prev">&lt;</span></div>',
14
  nextArrow: '<div class="slick-next"><span title="Next">&gt;</span></div>',
15
  speed: 300,
16
+ lazyLoad: 'progressive',
17
  responsive: [
18
  {
19
  breakpoint: 1024,
43
  });
44
 
45
  $('.pwb-product-carousel').slick({
46
+ slide: '.slick-slide',
47
  infinite: true,
48
  draggable: false,
49
  prevArrow: '<div class="slick-prev"><span title="Prev">&lt;</span></div>',
50
  nextArrow: '<div class="slick-next"><span title="Next">&gt;</span></div>',
51
  speed: 300,
52
+ lazyLoad: 'progressive',
53
  responsive: [
54
  {
55
  breakpoint: 1024,
assets/js/pwb_frontend_functions.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery.noConflict();jQuery(document).ready(function(e){e(".pwb-dropdown-widget").on("change",function(){var f=e(this).find(":selected").val();location.href=f});e(".pwb-carousel").slick({slide:".slick-slide",infinite:true,draggable:false,prevArrow:'<div class="slick-prev"><span title="Prev">&lt;</span></div>',nextArrow:'<div class="slick-next"><span title="Next">&gt;</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:".slick-slide",infinite:true,draggable:false,prevArrow:'<div class="slick-prev"><span title="Prev">&lt;</span></div>',nextArrow:'<div class="slick-next"><span title="Next">&gt;</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 d=PWBgetUrlParameter("pwb-brand-filter");e(".pwb-filter-products button").on("click",function(){var g=window.location.href;var f="";e('.pwb-filter-products input[type="checkbox"]').each(function(h){var i=e(this).prop("checked");if(i){f+=e(this).val();if(e('.pwb-filter-products input[type="checkbox"]').length-1!=h){f+=","}}});g=g.replace(/&?pwb-brand-filter=([^&]$|[^&]*)/i,"");g=g.replace(/\/page\/\d*\//i,"");if(g.indexOf("?")===-1){g=g+"?pwb-brand-filter="+f}else{g=g+"&pwb-brand-filter="+f}location.href=g});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(f){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/admin/class-edit-brands-page.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Perfect_Woocommerce_Brands\Admin;
3
+
4
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
5
+
6
+ class Edit_Brands_Page {
7
+
8
+ private static $current_user;
9
+
10
+ function __construct(){
11
+ add_filter( 'get_terms', array( $this, 'brand_list_admin_filter' ), 10, 3 );
12
+ add_filter( 'manage_edit-pwb-brand_columns', array( $this, 'brand_taxonomy_columns_head' ) );
13
+ add_filter( 'manage_pwb-brand_custom_column', array( $this, 'brand_taxonomy_columns' ), 10, 3 );
14
+ add_action( 'wp_ajax_pwb_admin_set_featured_brand', array( $this, 'set_featured_brand' ) );
15
+ add_filter( 'screen_settings', array( $this, 'add_screen_options' ), 10, 2 );
16
+ add_action( 'wp_ajax_pwb_admin_save_screen_settings', array( $this, 'save_screen_options' ) );
17
+ add_action( 'plugins_loaded', function(){ self::$current_user = wp_get_current_user(); } );
18
+ add_action( 'after-pwb-brand-table', array( $this, 'add_brands_count' ) );
19
+ }
20
+
21
+ private static function is_edit_brands_page(){
22
+ global $pagenow;
23
+ return ( $pagenow == 'edit-tags.php' && isset( $_GET['taxonomy'] ) && $_GET['taxonomy'] == 'pwb-brand' ) ? true : false;
24
+ }
25
+
26
+ public function add_brands_count( $tax_name ){
27
+ $brands = get_terms(
28
+ $tax_name,
29
+ array( 'hide_empty' => false )
30
+ );
31
+ $brands_featured = get_terms(
32
+ $tax_name,
33
+ array( 'hide_empty' => false, 'meta_query' => array( array( 'key' => 'pwb_featured_brand', 'value' => true ) ) )
34
+ );
35
+
36
+ \Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::render_template(
37
+ 'edit-brands-bottom',
38
+ 'admin',
39
+ array( 'featured_count' => count( $brands_featured ), 'text_featured' => __('featured', 'perfect-woocommerce-brands') )
40
+ );
41
+
42
+ }
43
+
44
+ public function brand_list_admin_filter( $brands, $taxonomies, $args ) {
45
+
46
+ if( self::is_edit_brands_page() ){
47
+
48
+ $featured = get_user_option( 'pwb-first-featured-brands', self::$current_user->ID );
49
+ if( $featured ){
50
+ $featured_brands = array();
51
+ $other_brands = array();
52
+ foreach( $brands as $brand ) {
53
+ if( get_term_meta( $brand->term_id, 'pwb_featured_brand', true ) ){
54
+ $featured_brands[] = $brand;
55
+ }else{
56
+ $other_brands[] = $brand;
57
+ }
58
+ }
59
+ return array_merge( $featured_brands, $other_brands );
60
+ }
61
+
62
+ }
63
+ return $brands;
64
+
65
+ }
66
+
67
+ public function brand_taxonomy_columns_head($defaults) {
68
+
69
+ if( self::is_edit_brands_page() ){
70
+ $defaults['featured'] = '';
71
+
72
+ $newColumns = array(
73
+ 'cb' => $defaults['cb'],
74
+ 'logo' => __( 'Logo', 'perfect-woocommerce-brands' )
75
+ );
76
+
77
+ unset( $defaults['description'] );
78
+ unset( $defaults['cb'] );
79
+
80
+ return array_merge( $newColumns, $defaults );
81
+ }
82
+ return $defaults;
83
+
84
+ }
85
+
86
+ public function brand_taxonomy_columns($c, $column_name, $term_id){
87
+ switch( $column_name ){
88
+ case 'logo':
89
+ $image = wp_get_attachment_image( get_term_meta( $term_id, 'pwb_brand_image', 1 ), array('60','60') );
90
+ return ( $image ) ? $image : "-";
91
+ break;
92
+ case 'featured':
93
+ $featured_class = ( $this->is_featured_brand( $term_id ) ) ? 'dashicons-star-filled' : 'dashicons-star-empty';
94
+ printf(
95
+ '<span class="dashicons %1$s" title="%2$s" data-brand-id="%3$s"></span>',
96
+ $featured_class, __('Set as featured', 'perfect-woocommerce-brands'), $term_id
97
+ );
98
+ break;
99
+ }
100
+ }
101
+
102
+ private function is_featured_brand( $brand_id ){
103
+ return ( get_term_meta( $brand_id, 'pwb_featured_brand', true ) );
104
+ }
105
+
106
+ public function set_featured_brand(){
107
+ if( isset( $_POST['brand'] ) ){
108
+ $direction = 'up';
109
+ $brand = intval( $_POST['brand'] );
110
+ if( $this->is_featured_brand( $brand ) ){
111
+ update_term_meta( $brand, 'pwb_featured_brand', false );
112
+ $direction = 'down';
113
+ }else{
114
+ update_term_meta( $brand, 'pwb_featured_brand', true );
115
+ }
116
+ wp_send_json_success( array( 'success' => true, 'direction' => $direction ) );
117
+ }else{
118
+ wp_send_json_error( array( 'success' => false, 'error_msg' => __( 'Error!','perfect-woocommerce-brands' ) ) );
119
+ }
120
+ wp_die();
121
+ }
122
+
123
+ public function add_screen_options( $status, $args ){
124
+ if( self::is_edit_brands_page() ){
125
+ $featured = get_user_option( 'pwb-first-featured-brands', self::$current_user->ID );
126
+ ob_start();
127
+ ?>
128
+ <legend><?php _e('Brands','perfect-woocommerce-brands');?></legend>
129
+ <label>
130
+ <input id="pwb-first-featured-brands" type="checkbox" <?php checked($featured,true);?>>
131
+ <?php _e('Show featured brands first','perfect-woocommerce-brands');?>
132
+ </label>
133
+ <?php
134
+ return ob_get_clean();
135
+ }
136
+ }
137
+
138
+ public function save_screen_options(){
139
+ if( isset( $_POST['new_val'] ) ){
140
+ $new_val = ( $_POST['new_val'] == 'true' ) ? true : false;
141
+ update_user_option( self::$current_user->ID, 'pwb-first-featured-brands', $new_val );
142
+ }
143
+ wp_die();
144
+ }
145
+
146
+ }
classes/admin/class-pwb-admin-tab.php CHANGED
@@ -66,6 +66,7 @@
66
  foreach($available_image_sizes as $image_size){
67
  $available_image_sizes_adapted[$image_size] = $image_size;
68
  }
 
69
 
70
  $settings = array(
71
  'section_title' => array(
66
  foreach($available_image_sizes as $image_size){
67
  $available_image_sizes_adapted[$image_size] = $image_size;
68
  }
69
+ $available_image_sizes_adapted['full'] = 'full';
70
 
71
  $settings = array(
72
  'section_title' => array(
classes/admin/class-pwb-coupon.php CHANGED
@@ -9,6 +9,7 @@
9
  add_action( 'woocommerce_coupon_options_usage_restriction', array( $this, 'coupon_restriction' ) );
10
  add_action( 'woocommerce_coupon_options_save', array( $this, 'coupon_save' ) );
11
  add_filter( 'woocommerce_coupon_is_valid', array( $this, 'is_valid_coupon' ), 10, 2 );
 
12
  }
13
 
14
  public function coupon_restriction() {
@@ -56,4 +57,17 @@
56
  return true;
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
9
  add_action( 'woocommerce_coupon_options_usage_restriction', array( $this, 'coupon_restriction' ) );
10
  add_action( 'woocommerce_coupon_options_save', array( $this, 'coupon_save' ) );
11
  add_filter( 'woocommerce_coupon_is_valid', array( $this, 'is_valid_coupon' ), 10, 2 );
12
+ add_filter( 'woocommerce_coupon_is_valid_for_product', array( $this, 'is_valid_for_product_brand' ), 10, 4 );
13
  }
14
 
15
  public function coupon_restriction() {
57
  return true;
58
  }
59
 
60
+ public function is_valid_for_product_brand( $valid, $product, $coupon, $values ){
61
+ if ( !$valid ) return false;
62
+
63
+ $coupon_id = is_callable( array( $coupon, 'get_id' ) ) ? $coupon->get_id() : $coupon->id;
64
+ $selected_brands = get_post_meta( $coupon_id, '_pwb_coupon_restriction', true );
65
+ if ( empty( $selected_brands ) ) return;
66
+
67
+ $product_id = is_callable( array( $product, 'get_id' ) ) ? $product->get_id() : $product->id;
68
+ $product_brands = wp_get_post_terms( $product_id, 'pwb-brand', array( 'fields' => 'ids' ) );
69
+ $valid_brands = array_intersect( $selected_brands, $product_brands );
70
+ return !empty( $valid_brands );
71
+ }
72
+
73
  }
classes/class-perfect-woocommerce-brands.php CHANGED
@@ -1,929 +1,860 @@
1
  <?php
2
- namespace Perfect_Woocommerce_Brands;
3
-
4
- defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
5
-
6
- class Perfect_Woocommerce_Brands{
7
-
8
- function __construct(){
9
- add_action( 'woocommerce_init', array( $this, 'register_brands_taxonomy' ), 10, 0 );
10
- add_action( 'init', array( $this, 'add_brands_metafields' ) );
11
- add_action( 'pwb-brand_add_form_fields', array( $this, 'add_brands_metafields_form' ) );
12
- add_action( 'pwb-brand_edit_form_fields', array( $this, 'add_brands_metafields_form_edit' ) );
13
- add_action( 'edit_pwb-brand', array( $this, 'add_brands_metafields_save' ) );
14
- add_action( 'create_pwb-brand', array( $this, 'add_brands_metafields_save' ) );
15
- add_filter( 'manage_edit-pwb-brand_columns', array( $this, 'brand_taxonomy_columns_head' ) );
16
- add_filter( 'manage_pwb-brand_custom_column', array( $this, 'brand_taxonomy_columns' ), 10, 3 );
17
- add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) );
18
- $this->brand_logo_position();
19
- add_action( 'woocommerce_before_shop_loop', array( $this, 'archive_page_banner' ), 9);
20
- add_action( 'woocommerce_after_shop_loop_item_title', array( $this, 'show_brands_in_loop' ) );
21
- if( !is_admin() ) add_action( 'init', array( $this, 'register_frontend_scripts' ) );
22
- $this->add_shortcodes();
23
- if( is_plugin_active('js_composer/js_composer.php') || is_plugin_active('visual_composer/js_composer.php') ){
24
- add_action( 'vc_before_init', array( $this,'vc_map_shortcodes' ) );
25
- }
26
- add_action( 'widgets_init', array( $this, 'register_widgets' ) );
27
-
28
- if( defined('PWB_WC_VERSION') && version_compare( PWB_WC_VERSION, '3.0.0', '>=' ) ){
29
- add_filter( 'woocommerce_structured_data_product', array( $this, 'product_microdata' ), 10, 2 );
30
- }else{
31
- add_action( 'wp_head' , array( $this, 'product_microdata_legacy' ), 40 );
32
- }
33
-
34
- add_action( 'pre_get_posts', array( $this, 'pwb_brand_filter' ) );
35
- add_filter( 'plugin_action_links_' . PWB_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
36
- add_action( 'wp_ajax_dismiss_pwb_notice', array( $this, 'dismiss_pwb_notice' ) );
37
- add_action( 'admin_notices', array( $this, 'review_notice' ) );
38
-
39
- add_action( 'pre_get_posts', function(){
40
- if( is_tax('pwb-brand') )
41
- remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
42
- });
43
  }
 
44
 
45
- public function review_notice(){
46
- $show_notice = get_option('wc_pwb_notice_plugin_review', true);
47
- $activate_on = get_option('pwb_activate_on', time());
48
- $now = time();
49
- $one_month = 2592000;
50
- $date_diff = $now - $activate_on;
51
-
52
- if ( $show_notice && $date_diff > $one_month ) {
53
- ?>
54
- <div class="notice notice-info pwb-notice-dismissible is-dismissible" data-notice="wc_pwb_notice_plugin_review">
55
- <p><?php echo __('We know that you´re in love with Perfect WooCommerce Brands, you can help us making it a bit better. Thanks a lot!', 'perfect-woocommerce-brands' ); ?><span class="dashicons dashicons-heart"></span></p>
56
- <p>
57
- <?php _e( '<a href="https://wordpress.org/support/plugin/perfect-woocommerce-brands/reviews/?rate=5#new-post" target="_blank">Leave a review</a>', 'perfect-woocommerce-brands' ); ?>
58
- <?php _e( '<a href="https://translate.wordpress.org/projects/wp-plugins/perfect-woocommerce-brands" target="_blank">Translate the plugin</a>', 'perfect-woocommerce-brands' ); ?>
59
- <?php _e( '<a href="https://github.com/titodevera/perfect-woocommerce-brands" target="_blank">View on GitHub</a>', 'perfect-woocommerce-brands' ); ?>
60
- </p>
61
- </div>
62
- <?php
63
- }
64
  }
65
 
66
- public function dismiss_pwb_notice(){
67
- $notice_name_whitelist = array( 'wc_pwb_notice_plugin_review' );
68
- if( isset( $_POST['notice_name'] ) && in_array( $_POST['notice_name'], $notice_name_whitelist ) ){
69
- update_option( $_POST['notice_name'], 0 );
70
- echo 'ok';
71
- }else{
72
- echo 'error';
73
- }
74
- wp_die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
 
76
 
77
- /**
78
- * Adds a settings shortcut to plugin´s actions on plugins list
79
- */
80
- public function plugin_action_links( $links ) {
81
- $settings_url = esc_url( admin_url( 'admin.php?page=wc-settings&tab=pwb_admin_tab' ) );
82
- $links[] = '<a href="'. $settings_url .'">'.__('Settings','perfect-woocommerce-brands').'</a>';
83
- return $links;
84
  }
 
 
85
 
86
- public function pwb_brand_filter( $query ){
 
 
 
 
 
 
 
87
 
88
- if( !empty($_GET['pwb-brand-filter']) ){
89
 
90
- $terms_array = explode(',',$_GET['pwb-brand-filter']);
91
 
92
- //remove invalid terms (security)
93
- for($i=0; $i < count($terms_array); $i++) {
94
- if( !term_exists( $terms_array[$i], 'pwb-brand' ) ) unset($terms_array[$i]);
95
- }
96
 
97
- $filterable_product = false;
98
- if( is_product_category() || is_post_type_archive( 'product' ) )
99
- $filterable_product = true;
 
100
 
101
- if( $filterable_product && $query->is_main_query() ) {
 
 
102
 
103
- $query->set('tax_query', array(
104
- array (
105
- 'taxonomy' => 'pwb-brand',
106
- 'field' => 'slug',
107
- 'terms' => $terms_array
108
- )
109
- ));
110
 
111
- }
 
 
 
 
 
 
112
 
113
  }
114
 
115
  }
116
 
117
- /*
118
- * Adds microdata (brands) to single products (WooCommerce < 3.0.0)
119
- */
120
- public function product_microdata_legacy(){
121
- global $post;
122
-
123
- if( isset( $post->post_type ) && $post->post_type==='product' ){
124
- $brands = wp_get_post_terms( $post->ID, 'pwb-brand');
125
- foreach ($brands as $brand) {
126
- echo '<meta itemprop="brand" content="'.$brand->name.'">';
127
- }
128
- }
129
-
130
- }
131
 
132
- /*
133
- * Adds microdata (brands) to single products (WooCommerce > 3.0.0)
134
- */
135
- public function product_microdata( $markup, $product ){
 
136
 
137
- $new_markup = array();
138
- $brands = wp_get_post_terms( $product->get_id(), 'pwb-brand');
139
  foreach ($brands as $brand) {
140
- $new_markup['brand'][] = $brand->name;
141
  }
 
142
 
143
- return array_merge( $markup, $new_markup );
144
 
145
- }
 
 
 
146
 
147
- public function add_shortcodes(){
148
- add_shortcode( 'pwb-carousel', array(
149
- '\Perfect_Woocommerce_Brands\Shortcodes\PWB_Carousel_Shortcode',
150
- 'carousel_shortcode'
151
- ) );
152
- add_shortcode( 'pwb-product-carousel', array(
153
- '\Perfect_Woocommerce_Brands\Shortcodes\PWB_Product_Carousel_Shortcode',
154
- 'product_carousel_shortcode'
155
- ) );
156
- add_shortcode( 'pwb-all-brands', array(
157
- '\Perfect_Woocommerce_Brands\Shortcodes\PWB_All_Brands_Shortcode',
158
- 'all_brands_shortcode'
159
- ) );
160
- add_shortcode( 'pwb-brand', array(
161
- '\Perfect_Woocommerce_Brands\Shortcodes\PWB_Brand_Shortcode',
162
- 'brand_shortcode'
163
- ) );
164
  }
165
 
166
- public function register_widgets(){
167
- register_widget( '\Perfect_Woocommerce_Brands\Widgets\PWB_List_Widget' );
168
- register_widget( '\Perfect_Woocommerce_Brands\Widgets\PWB_Dropdown_Widget' );
169
- register_widget( '\Perfect_Woocommerce_Brands\Widgets\PWB_Filter_By_Brand_Widget' );
170
- }
171
 
172
- public function show_brands_in_loop(){
173
 
174
- $brands_in_loop = get_option('wc_pwb_admin_tab_brands_in_loop');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
 
176
- if( $brands_in_loop == 'brand_link' || $brands_in_loop == 'brand_image' ){
 
 
 
 
177
 
178
- global $product;
179
- $product_id = $product->get_id();
180
- $product_brands = wp_get_post_terms($product_id, 'pwb-brand');
181
- if(!empty($product_brands)){
182
- echo '<div class="pwb-brands-in-loop">';
183
- foreach ($product_brands as $brand) {
184
 
185
- echo '<span>';
186
- $brand_link = get_term_link ( $brand->term_id, 'pwb-brand' );
187
- $attachment_id = get_term_meta( $brand->term_id, 'pwb_brand_image', 1 );
188
 
189
- $attachment_html = wp_get_attachment_image( $attachment_id, 'thumbnail' );
190
- if( !empty($attachment_html) && $brands_in_loop == 'brand_image' ){
191
- echo '<a href="'.$brand_link.'">'.$attachment_html.'</a>';
192
- }else{
193
- echo '<a href="'.$brand_link.'">'.$brand->name.'</a>';
194
- }
195
- echo '</span>';
196
 
197
- }
198
- echo '</div>';
199
- }
 
 
 
200
 
201
- }
 
 
202
 
203
- }
 
 
 
 
 
 
204
 
205
- /**
206
- * woocommerce_single_product_summary hook.
207
- *
208
- * @hooked woocommerce_template_single_title - 5
209
- * @hooked woocommerce_template_single_rating - 10
210
- * @hooked woocommerce_template_single_price - 10
211
- * @hooked woocommerce_template_single_excerpt - 20
212
- * @hooked woocommerce_template_single_add_to_cart - 30
213
- * @hooked woocommerce_template_single_meta - 40
214
- * @hooked woocommerce_template_single_sharing - 50
215
- */
216
- private function brand_logo_position(){
217
- $position = 41;
218
- $position_selected = get_option('wc_pwb_admin_tab_brand_single_position');
219
- if(!$position_selected){
220
- update_option('wc_pwb_admin_tab_brand_single_position','after_meta');
221
- }
222
- switch ($position_selected) {
223
- case 'before_title':
224
- $position = 4;
225
- break;
226
- case 'after_title':
227
- $position = 6;
228
- break;
229
- case 'after_price':
230
- $position = 11;
231
- break;
232
- case 'after_excerpt':
233
- $position = 21;
234
- break;
235
- case 'after_add_to_cart':
236
- $position = 31;
237
- break;
238
- case 'after_meta':
239
- $position = 41;
240
- break;
241
- case 'after_sharing':
242
- $position = 51;
243
- break;
244
  }
245
- add_action('woocommerce_single_product_summary', array($this,'action_woocommerce_single_product_summary'), $position);
246
  }
247
 
 
248
 
249
- /*
250
- * Maps shortcode (for visual composer plugin)
251
- *
252
- * @since 1.0
253
- * @link https://vc.wpbakery.com/
254
- * @return mixed
255
- */
256
- public function vc_map_shortcodes(){
257
- $available_image_sizes_adapted = array();
258
- $available_image_sizes = get_intermediate_image_sizes();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
 
260
- foreach($available_image_sizes as $image_size){
261
- $available_image_sizes_adapted[$image_size] = $image_size;
262
- }
263
 
264
- vc_map(array(
265
- "name" => __( "PWB Product carousel", "perfect-woocommerce-brands" ),
266
- "description" => __( "Product carousel by brand or by category", "perfect-woocommerce-brands" ),
267
- "base" => "pwb-product-carousel",
268
- "class" => "",
269
- "icon" => PWB_PLUGIN.'/assets/img/icon_pwb.jpg',
270
- "category" => "Woocommerce",
271
- "params" => array(
272
- array(
273
- "type" => "dropdown",
274
- "heading" => __( "Brand", "perfect-woocommerce-brands" ),
275
- "param_name" => "brand",
276
- "admin_label" => true,
277
- "value" => self::get_brands_array( true )
278
- ),
279
- array(
280
- "type" => "textfield",
281
- "holder" => "div",
282
- "heading" => __( "Products", "perfect-woocommerce-brands" ),
283
- "param_name" => "products",
284
- "value" => "10",
285
- "description" => __( "Number of products to load", "perfect-woocommerce-brands" )
286
- ),
287
- array(
288
- "type" => "textfield",
289
- "holder" => "div",
290
- "heading" => __( "Products to show", "perfect-woocommerce-brands" ),
291
- "param_name" => "products_to_show",
292
- "value" => "5",
293
- "description" => __( "Number of products to show", "perfect-woocommerce-brands" )
294
- ),
295
- array(
296
- "type" => "textfield",
297
- "holder" => "div",
298
- "heading" => __( "Products to scroll", "perfect-woocommerce-brands" ),
299
- "param_name" => "products_to_scroll",
300
- "value" => "1",
301
- "description" => __( "Number of products to scroll", "perfect-woocommerce-brands" )
302
- ),
303
- array(
304
- "type" => "checkbox",
305
- "holder" => "div",
306
- "heading" => __( "Autoplay", "perfect-woocommerce-brands" ),
307
- "param_name" => "autoplay",
308
- "description" => __( "Autoplay carousel", "perfect-woocommerce-brands" )
309
- ),
310
- array(
311
- "type" => "checkbox",
312
- "holder" => "div",
313
- "heading" => __( "Arrows", "perfect-woocommerce-brands" ),
314
- "param_name" => "arrows",
315
- "description" => __( "Display prev and next arrows", "perfect-woocommerce-brands" )
316
- )
317
- )
318
- ));
319
 
320
- vc_map(array(
321
- "name" => __( "PWB Brands carousel", "perfect-woocommerce-brands" ),
322
- "description" => __( "Brands carousel", "perfect-woocommerce-brands" ),
323
- "base" => "pwb-carousel",
324
- "class" => "",
325
- "icon" => PWB_PLUGIN.'/assets/img/icon_pwb.jpg',
326
- "category" => "Woocommerce",
327
- "params" => array(
328
- array(
329
- "type" => "textfield",
330
- "holder" => "div",
331
- "heading" => __( "Items", "perfect-woocommerce-brands" ),
332
- "param_name" => "items",
333
- "value" => "10",
334
- "description" => __( "Number of items to load", "perfect-woocommerce-brands" )
335
- ),
336
- array(
337
- "type" => "textfield",
338
- "holder" => "div",
339
- "heading" => __( "Items to show", "perfect-woocommerce-brands" ),
340
- "param_name" => "items_to_show",
341
- "value" => "5",
342
- "description" => __( "Number of items to show", "perfect-woocommerce-brands" )
343
- ),
344
- array(
345
- "type" => "textfield",
346
- "holder" => "div",
347
- "heading" => __( "Items to scroll", "perfect-woocommerce-brands" ),
348
- "param_name" => "items_to_scroll",
349
- "value" => "1",
350
- "description" => __( "Number of items to scroll", "perfect-woocommerce-brands" )
351
- ),
352
- array(
353
- "type" => "checkbox",
354
- "holder" => "div",
355
- "heading" => __( "Autoplay", "perfect-woocommerce-brands" ),
356
- "param_name" => "autoplay",
357
- "description" => __( "Autoplay carousel", "perfect-woocommerce-brands" )
358
- ),
359
- array(
360
- "type" => "checkbox",
361
- "holder" => "div",
362
- "heading" => __( "Arrows", "perfect-woocommerce-brands" ),
363
- "param_name" => "arrows",
364
- "description" => __( "Display prev and next arrows", "perfect-woocommerce-brands" )
365
- ),
366
- array(
367
- "type" => "dropdown",
368
- "heading" => __( "Brand logo size", "perfect-woocommerce-brands" ),
369
- "param_name" => "image_size",
370
- "admin_label" => true,
371
- "value" => $available_image_sizes_adapted
372
- )
373
- )
374
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
 
376
- ));
377
 
378
- vc_map(array(
379
- "name" => __( "PWB All brands", "perfect-woocommerce-brands" ),
380
- "description" => __( "Show all brands", "perfect-woocommerce-brands" ),
381
- "base" => "pwb-all-brands",
382
- "class" => "",
383
- "icon" => PWB_PLUGIN.'/assets/img/icon_pwb.jpg',
384
- "category" => "Woocommerce",
385
- "params" => array(
386
- array(
387
- "type" => "textfield",
388
- "holder" => "div",
389
- "heading" => __( "Brands per page", "perfect-woocommerce-brands" ),
390
- "param_name" => "per_page",
391
- "value" => "10",
392
- "description" => __( "Show x brands per page", "perfect-woocommerce-brands" )
393
- ),
394
- array(
395
- "type" => "dropdown",
396
- "heading" => __( "Brand logo size", "perfect-woocommerce-brands" ),
397
- "param_name" => "image_size",
398
- "admin_label" => true,
399
- "value" => $available_image_sizes_adapted
400
- ),
401
- array(
402
- "type" => "dropdown",
403
- "heading" => __( "Order by", "perfect-woocommerce-brands" ),
404
- "param_name" => "order_by",
405
- "admin_label" => true,
406
- "value" => array(
407
- 'name' => 'name',
408
- 'slug' => 'slug',
409
- 'term_id' => 'term_id',
410
- 'id' => 'id',
411
- 'description' => 'description',
412
- 'rand' => 'rand'
413
- )
414
- ),
415
- array(
416
- "type" => "dropdown",
417
- "heading" => __( "Order", "perfect-woocommerce-brands" ),
418
- "param_name" => "order",
419
- "admin_label" => true,
420
- "value" => array(
421
- 'ASC' => 'ASC',
422
- 'DSC' => 'DSC'
423
- )
424
- ),
425
- array(
426
- "type" => "dropdown",
427
- "heading" => __( "Title position", "perfect-woocommerce-brands" ),
428
- "param_name" => "title_position",
429
- "admin_label" => true,
430
- "value" => array(
431
- __( "Before image", "perfect-woocommerce-brands" ) => 'before',
432
- __( "After image", "perfect-woocommerce-brands" ) => 'after',
433
- __( "Hide", "perfect-woocommerce-brands" ) => 'none'
434
- )
435
- ),
436
- array(
437
- "type" => "checkbox",
438
- "holder" => "div",
439
- "heading" => __( "Hide empty", "perfect-woocommerce-brands" ),
440
- "param_name" => "hide_empty",
441
- "description" => __( "Hide brands that have not been assigned to any product", "perfect-woocommerce-brands" )
442
- )
443
- )
444
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
445
 
446
- ));
447
 
448
- vc_map(array(
449
- "name" => __( "PWB brand", "perfect-woocommerce-brands" ),
450
- "description" => __( "Show brand for a specific product", "perfect-woocommerce-brands" ),
451
- "base" => "pwb-brand",
452
- "class" => "",
453
- "icon" => PWB_PLUGIN.'/assets/img/icon_pwb.jpg',
454
- "category" => "Woocommerce",
455
-
456
- "params" => array(
457
- array(
458
- "type" => "textfield",
459
- "holder" => "div",
460
- "heading" => __( "Product id", "perfect-woocommerce-brands" ),
461
- "param_name" => "product_id",
462
- "value" => null,
463
- "description" => __( "Product id (post id)", "perfect-woocommerce-brands" )
464
- ),
465
- array(
466
- "type" => "dropdown",
467
- "heading" => __( "Brand logo size", "perfect-woocommerce-brands" ),
468
- "param_name" => "image_size",
469
- "admin_label" => true,
470
- "value" => $available_image_sizes_adapted
471
- )
472
-
473
- )
474
 
 
 
 
 
 
 
 
475
 
476
- ));
477
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
478
 
479
- public function action_woocommerce_single_product_summary() {
480
- $brands = wp_get_post_terms( get_the_ID(), 'pwb-brand');
481
 
482
- if( !is_wp_error( $brands ) ){
 
483
 
484
- if( sizeof( $brands>0 ) ){
 
485
 
486
- $show_as = get_option( 'wc_pwb_admin_tab_brands_in_single' );
487
 
488
- if( $show_as!='no' ){
489
 
490
- do_action( 'pwb_before_single_product_brands', $brands );
491
 
492
- echo '<div class="pwb-single-product-brands pwb-clearfix">';
493
- foreach( $brands as $brand ){
494
- $brand_link = get_term_link ( $brand->term_id, 'pwb-brand' );
495
- $attachment_id = get_term_meta( $brand->term_id, 'pwb_brand_image', 1 );
496
 
497
- $image_size = 'thumbnail';
498
- $image_size_selected = get_option('wc_pwb_admin_tab_brand_logo_size');
499
- if($image_size_selected!=false){
500
- $image_size = $image_size_selected;
501
- }
502
 
503
- $attachment_html = wp_get_attachment_image($attachment_id,$image_size);
 
 
 
504
 
505
- if( !empty($attachment_html) && $show_as=='brand_image' || !empty($attachment_html) && !$show_as ){
506
- echo '<a href="'.$brand_link.'" title="'.__( 'View brand', 'perfect-woocommerce-brands' ).'">'.$attachment_html.'</a>';
507
- }else{
508
- echo '<a href="'.$brand_link.'" title="'.__( 'View brand', 'perfect-woocommerce-brands' ).'">'.$brand->name.'</a>';
509
- }
510
- }
511
- echo '</div>';
512
 
513
- do_action( 'pwb_after_single_product_brands', $brands );
514
 
 
 
 
 
 
515
  }
 
 
 
516
 
517
  }
518
 
519
- }
520
 
521
- }
522
 
523
- public function register_frontend_scripts(){
524
-
525
- wp_register_script(
526
- 'pwb_slick_lib',
527
- PWB_PLUGIN . '/assets/js/slick/slick.min.js',
528
- array('jquery'),
529
- '1.8.0',
530
- true
531
- );
532
- wp_enqueue_script('pwb_frontend_functions');
533
-
534
- wp_enqueue_style(
535
- 'pwb_slick_lib',
536
- PWB_PLUGIN . '/assets/js/slick/slick.css',
537
- array(),
538
- '1.8.0',
539
- 'all'
540
- );
541
-
542
- wp_enqueue_style(
543
- 'pwb_frontend_styles',
544
- PWB_PLUGIN . '/assets/css/styles-frontend.css',
545
- array('pwb_slick_lib'),
546
- PWB_PLUGIN_VERSION,
547
- 'all'
548
- );
549
-
550
- wp_register_script(
551
- 'pwb_frontend_functions',
552
- PWB_PLUGIN . '/assets/js/pwb_frontend_functions.js',
553
- array('jquery','pwb_slick_lib'),
554
- PWB_PLUGIN_VERSION,
555
- true
556
- );
557
- wp_enqueue_script('pwb_frontend_functions');
558
 
559
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
560
 
561
- public function register_admin_scripts($hook){
562
- $screen = get_current_screen();
563
 
564
- wp_register_style('pwb_styles_brands', PWB_PLUGIN . '/assets/css/styles-admin.css', array(), PWB_PLUGIN_VERSION);
565
- wp_register_script('pwb_brands_js', PWB_PLUGIN . '/assets/js/pwb_admin_functions.js', array('jquery'), PWB_PLUGIN_VERSION, true);
566
 
567
- if ($hook == 'edit-tags.php' && $screen->taxonomy == 'pwb-brand' || $hook == 'term.php' && $screen->taxonomy == 'pwb-brand') {
568
- wp_enqueue_media();
569
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
 
571
- wp_enqueue_style( 'pwb_styles_brands' );
572
- wp_enqueue_script( 'pwb_brands_js' );
573
- wp_localize_script( 'pwb_brands_js', 'ajax_object', array(
574
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
575
- 'site_url' => site_url(),
576
- 'brands_url' => admin_url( 'edit-tags.php?taxonomy=pwb-brand&post_type=product' ),
577
- 'translations' => array(
578
- 'migrate_notice' => __('¿Start migration?','perfect-woocommerce-brands'),
579
- 'migrating' => __('We are migrating the product brands. ¡Don´t close this window until the process is finished!','perfect-woocommerce-brands'),
580
- 'dummy_data_notice' => __('¿Start loading dummy data?','perfect-woocommerce-brands'),
581
- 'dummy_data' => __('We are importing the dummy data. ¡Don´t close this window until the process is finished!','perfect-woocommerce-brands')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
582
  )
583
- ) );
584
 
585
- }
586
 
587
- public function register_brands_taxonomy(){
588
- $labels = array(
589
- 'name' => __( 'Brands', 'perfect-woocommerce-brands' ),
590
- 'singular_name' => __( 'Brand', 'perfect-woocommerce-brands' ),
591
- 'menu_name' => __( 'Brands', 'perfect-woocommerce-brands' ),
592
- 'all_items' => __( 'All Brands', 'perfect-woocommerce-brands' ),
593
- 'edit_item' => __( 'Edit Brand', 'perfect-woocommerce-brands' ),
594
- 'view_item' => __( 'View Brand', 'perfect-woocommerce-brands' ),
595
- 'update_item' => __( 'Update Brand', 'perfect-woocommerce-brands' ),
596
- 'add_new_item' => __( 'Add New Brand', 'perfect-woocommerce-brands' ),
597
- 'new_item_name' => __( 'New Brand Name', 'perfect-woocommerce-brands' ),
598
- 'parent_item' => __( 'Parent Brand', 'perfect-woocommerce-brands' ),
599
- 'parent_item_colon' => __( 'Parent Brand:', 'perfect-woocommerce-brands' ),
600
- 'search_items' => __( 'Search Brands', 'perfect-woocommerce-brands' ),
601
- 'popular_items' => __( 'Popular Brands', 'perfect-woocommerce-brands' ),
602
- 'separate_items_with_commas' => __( 'Separate brands with commas', 'perfect-woocommerce-brands' ),
603
- 'add_or_remove_items' => __( 'Add or remove brands', 'perfect-woocommerce-brands' ),
604
- 'choose_from_most_used' => __( 'Choose from the most used brands', 'perfect-woocommerce-brands' ),
605
- 'not_found' => __( 'No brands found', 'perfect-woocommerce-brands' )
606
- );
607
-
608
- $new_slug = get_option('wc_pwb_admin_tab_slug');
609
- $old_slug = get_option('old_wc_pwb_admin_tab_slug');
610
-
611
- $new_slug = ($new_slug!=false) ? $new_slug : 'brand';
612
- $old_slug = ($old_slug!=false) ? $old_slug : 'null';
613
-
614
- $args = array(
615
- 'hierarchical' => true,
616
- 'labels' => $labels,
617
- 'show_ui' => true,
618
- 'query_var' => true,
619
- 'public' => true,
620
- 'show_admin_column' => true,
621
- 'rewrite' => array(
622
- 'slug' => $new_slug,
623
- 'hierarchical' => true,
624
- 'ep_mask' => EP_PERMALINK
625
- )
626
- );
627
-
628
- register_taxonomy( 'pwb-brand', array( 'product' ), $args );
629
-
630
- if($new_slug != false && $old_slug!= false && $new_slug != $old_slug){
631
- flush_rewrite_rules();
632
- update_option( 'old_wc_pwb_admin_tab_slug', $new_slug );
633
- }
634
 
635
- }
636
 
637
- public function add_brands_metafields(){
638
- register_meta( 'term', 'pwb_brand_image', array($this,'add_brands_metafields_sanitize') );
639
- }
640
 
641
- public function add_brands_metafields_sanitize($brand_img){
642
- return $brand_img;
643
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
644
 
645
- public function add_brands_metafields_form(){
646
- ob_start();
647
- ?>
648
- <div class="form-field pwb_brand_cont">
 
 
 
 
 
649
  <label for="pwb_brand_image"><?php _e( 'Brand logo', 'perfect-woocommerce-brands' ); ?></label>
650
- <input type="text" name="pwb_brand_image" id="pwb_brand_image" value="" >
 
 
651
  <a href="#" id="pwb_brand_image_select" class="button"><?php _e('Select image','perfect-woocommerce-brands');?></a>
652
- </div>
653
 
654
- <div class="form-field pwb_brand_cont">
 
 
 
 
 
 
 
 
 
 
 
 
 
655
  <label for="pwb_brand_banner"><?php _e( 'Brand banner', 'perfect-woocommerce-brands' ); ?></label>
656
- <input type="text" name="pwb_brand_banner" id="pwb_brand_banner" value="" >
 
 
657
  <a href="#" id="pwb_brand_banner_select" class="button"><?php _e('Select image','perfect-woocommerce-brands');?></a>
658
- <p><?php _e( 'This image will be shown on brand page', 'perfect-woocommerce-brands' ); ?></p>
659
- </div>
660
 
661
- <div class="form-field pwb_brand_cont">
 
 
 
 
 
 
 
 
 
 
 
 
 
662
  <label for="pwb_brand_banner_link"><?php _e( 'Brand banner link', 'perfect-woocommerce-brands' ); ?></label>
663
- <input type="text" name="pwb_brand_banner_link" id="pwb_brand_banner_link" value="" >
664
- <p><?php _e( 'This link should be relative to site url. Example: product/product-name', 'perfect-woocommerce-brands' ); ?></p>
665
- </div>
666
-
667
- <?php echo wp_nonce_field( basename( __FILE__ ), 'pwb_nonce' ); ?>
668
-
669
- <?php
670
- echo ob_get_clean();
671
- }
672
-
673
- public function add_brands_metafields_form_edit($term){
674
- $term_value_image = get_term_meta( $term->term_id, 'pwb_brand_image', true );
675
- $term_value_banner = get_term_meta( $term->term_id, 'pwb_brand_banner', true );
676
- $term_value_banner_link = get_term_meta( $term->term_id, 'pwb_brand_banner_link', true );
677
- ob_start();
678
- ?>
679
- <table class="form-table pwb_brand_cont">
680
- <tr class="form-field">
681
- <th>
682
- <label for="pwb_brand_image"><?php _e( 'Brand logo', 'perfect-woocommerce-brands' ); ?></label>
683
- </th>
684
- <td>
685
- <input type="text" name="pwb_brand_image" id="pwb_brand_image" value="<?php echo $term_value_image;?>" >
686
- <a href="#" id="pwb_brand_image_select" class="button"><?php _e('Select image','perfect-woocommerce-brands');?></a>
687
-
688
- <?php $current_image = wp_get_attachment_image ( $term_value_image, array('90','90'), false ); ?>
689
- <?php if( !empty($current_image) ): ?>
690
- <div class="pwb_brand_image_selected">
691
- <span>
692
- <?php echo $current_image;?>
693
- <a href="#" class="pwb_brand_image_selected_remove">X</a>
694
- </span>
695
- </div>
696
- <?php endif; ?>
697
-
698
- </td>
699
- </tr>
700
- <tr class="form-field">
701
- <th>
702
- <label for="pwb_brand_banner"><?php _e( 'Brand banner', 'perfect-woocommerce-brands' ); ?></label>
703
- </th>
704
- <td>
705
- <input type="text" name="pwb_brand_banner" id="pwb_brand_banner" value="<?php echo $term_value_banner;?>" >
706
- <a href="#" id="pwb_brand_banner_select" class="button"><?php _e('Select image','perfect-woocommerce-brands');?></a>
707
-
708
- <?php $current_image = wp_get_attachment_image ( $term_value_banner, array('90','90'), false ); ?>
709
- <?php if( !empty($current_image) ): ?>
710
- <div class="pwb_brand_image_selected">
711
- <span>
712
- <?php echo $current_image;?>
713
- <a href="#" class="pwb_brand_image_selected_remove">X</a>
714
- </span>
715
- </div>
716
- <?php endif; ?>
717
-
718
- </td>
719
- </tr>
720
- <tr class="form-field">
721
- <th>
722
- <label for="pwb_brand_banner_link"><?php _e( 'Brand banner link', 'perfect-woocommerce-brands' ); ?></label>
723
- </th>
724
- <td>
725
- <input type="text" name="pwb_brand_banner_link" id="pwb_brand_banner_link" value="<?php echo $term_value_banner_link;?>" >
726
- <p class="description"><?php _e( 'This link should be relative to site url. Example: product/product-name', 'perfect-woocommerce-brands' ); ?></p>
727
- <div id="pwb_brand_banner_link_result"><?php echo wp_get_attachment_image ( $term_value_banner_link, array('90','90'), false );?></div>
728
- </td>
729
- </tr>
730
- </table>
731
-
732
- <?php echo wp_nonce_field( basename( __FILE__ ), 'pwb_nonce' );?>
733
-
734
- <?php
735
- echo ob_get_clean();
736
- }
737
-
738
- public function add_brands_metafields_save( $term_id ){
739
-
740
- if ( ! isset( $_POST['pwb_nonce'] ) || ! wp_verify_nonce( $_POST['pwb_nonce'], basename( __FILE__ ) ) )
741
- return;
742
-
743
- /* ·············· Brand image ·············· */
744
- $old_img = get_term_meta( $term_id, 'pwb_brand_image', true );
745
- $new_img = isset( $_POST['pwb_brand_image'] ) ? $_POST['pwb_brand_image'] : '';
746
-
747
- if ( $old_img && '' === $new_img )
748
- delete_term_meta( $term_id, 'pwb_brand_image' );
749
 
750
- else if ( $old_img !== $new_img )
751
- update_term_meta( $term_id, 'pwb_brand_image', $new_img );
752
- /* ·············· /Brand image ·············· */
753
 
754
- /* ·············· Brand banner ·············· */
755
- $old_img = get_term_meta( $term_id, 'pwb_brand_banner', true );
756
- $new_img = isset( $_POST['pwb_brand_banner'] ) ? $_POST['pwb_brand_banner'] : '';
757
 
758
- if ( $old_img && '' === $new_img )
759
- delete_term_meta( $term_id, 'pwb_brand_banner' );
 
760
 
761
- else if ( $old_img !== $new_img )
762
- update_term_meta( $term_id, 'pwb_brand_banner', $new_img );
763
- /* ·············· /Brand banner ·············· */
764
 
765
- /* ·············· Brand banner link ·············· */
766
- $old_img = get_term_meta( $term_id, 'pwb_brand_banner_link', true );
767
- $new_img = isset( $_POST['pwb_brand_banner_link'] ) ? $_POST['pwb_brand_banner_link'] : '';
768
 
769
- if ( $old_img && '' === $new_img )
770
- delete_term_meta( $term_id, 'pwb_brand_banner_link' );
 
771
 
772
- else if ( $old_img !== $new_img )
773
- update_term_meta( $term_id, 'pwb_brand_banner_link', $new_img );
774
- /* ·············· /Brand banner link ·············· */
775
- }
776
 
777
- public function brand_taxonomy_columns_head($defaults) {
 
 
778
 
779
- global $pagenow;
 
 
780
 
781
- if( $pagenow == 'edit-tags.php' ){
782
- $newColumns = array(
783
- 'cb' => $defaults['cb'],
784
- 'logo' => __( 'Logo', 'perfect-woocommerce-brands' )
785
- );
786
 
787
- unset($defaults['description']);
788
- unset($defaults['cb']);
 
 
789
 
790
- return array_merge($newColumns,$defaults);
791
- }
792
- return $defaults;
793
 
794
- }
 
795
 
796
- public function brand_taxonomy_columns($c, $column_name, $term_id){
797
- $image = wp_get_attachment_image( get_term_meta( $term_id, 'pwb_brand_image', 1 ), array('60','60') );
798
- if($image){
799
- return $image;
800
- }else{
801
- return "-";
802
- }
803
- }
804
 
805
- public static function get_brands( $hide_empty = false, $order_by = 'name', $order = 'ASC' ){
806
- $result = array();
807
 
808
- $brands = get_terms('pwb-brand',array(
809
- 'hide_empty' => $hide_empty,
810
- 'order_by' => $order_by,
811
- 'order' => $order
812
- ));
813
 
814
- if(is_array($brands) && count($brands)>0){
815
- $result = $brands;
816
- }
817
 
818
- return $result;
 
 
819
 
820
- }
 
 
821
 
822
- public static function get_brands_array( $is_select = false ){
823
- $result = array();
 
824
 
825
- //if is for select input adds default value
826
- if( $is_select )
827
- $result[0] = __( 'All', 'perfect-woocommerce-brands' );
828
 
829
- $brands = get_terms('pwb-brand',array(
830
- 'hide_empty' => false
831
- ));
832
 
833
- foreach ($brands as $brand) {
834
- $result[$brand->term_id] = $brand->slug;
835
- }
836
 
837
- return $result;
838
 
839
- }
 
 
840
 
841
- public static function get_products_by_brand($brand_id, $count){
842
-
843
- if($brand_id === 'all'){
844
- $args = array(
845
- 'post_type' => 'product',
846
- 'posts_per_page' => $count,
847
- 'paged' => false
848
- );
849
- }else{
850
- $args = array(
851
- 'post_type' => 'product',
852
- 'tax_query' => array(
853
- array(
854
- 'taxonomy' => 'pwb-brand',
855
- 'field' => 'slug',
856
- 'terms' => $brand_id,
857
- )
858
- ),
859
- 'posts_per_page' => $count,
860
- 'paged' => false
861
- );
862
  }
863
 
864
- ob_start();
865
-
866
- $loop = new \WP_Query( $args );
867
- if ( $loop->have_posts() && function_exists('wc_get_product') && function_exists('woocommerce_template_loop_add_to_cart') && function_exists('woocommerce_get_product_thumbnail') ) {
868
- while ( $loop->have_posts() ) : $loop->the_post();
869
- $product = wc_get_product( get_the_ID() );
870
-
871
- echo '<div>';
872
- echo '<a href="'.get_the_permalink().'">';
873
- echo woocommerce_get_product_thumbnail();
874
- echo '<h3>'.$product->get_title().'</h3>';
875
- echo '<span class="pwb-amount">'.$product->get_price_html().'</span>';
876
- woocommerce_template_loop_add_to_cart();
877
- echo '</a>';
878
  echo '</div>';
879
-
880
- endwhile;
881
- } else {
882
- echo __( 'No products found', 'perfect-woocommerce-brands' );
883
- }
884
- wp_reset_postdata();
885
-
886
- return ob_get_clean();
887
-
888
- }
889
-
890
- public function archive_page_banner(){
891
- $queried_object = get_queried_object();
892
-
893
- if( is_tax('pwb-brand') ){
894
-
895
- $brand_banner = get_term_meta( $queried_object->term_id, 'pwb_brand_banner', true );
896
- $brand_banner_link = get_term_meta( $queried_object->term_id, 'pwb_brand_banner_link', true );
897
- $show_desc = get_option('wc_pwb_admin_tab_brand_desc');
898
-
899
- if( $brand_banner!='' || $queried_object->description != '' && $show_desc !== 'no' ){
900
- echo '<div class="pwb-brand-banner-cont">';
901
  }
902
 
903
- //pwb-brand archive
904
- if( $brand_banner!='' ){
905
- echo '<div class="pwb-brand-banner pwb-clearfix">';
906
- if($brand_banner_link!=''){
907
- echo '<a href="'.site_url($brand_banner_link).'">'.wp_get_attachment_image ( $brand_banner, 'full', false ).'</a>';
908
- }else{
909
- echo wp_get_attachment_image ( $brand_banner, 'full', false );
910
- }
911
- echo '</div>';
912
- }
913
-
914
- //show brand description
915
- if( $queried_object->description != '' && $show_desc !== 'no' ){
916
- echo '<div class="pwb-brand-description">';
917
- echo $queried_object->description;
918
- echo '</div>';
919
- }
920
-
921
- if( $brand_banner!='' || $queried_object->description != '' && $show_desc !== 'no' ){
922
  echo '</div>';
923
  }
924
 
 
 
925
  }
926
 
927
  }
928
 
929
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ namespace Perfect_Woocommerce_Brands;
3
+
4
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
5
+
6
+ class Perfect_Woocommerce_Brands{
7
+
8
+ function __construct(){
9
+ add_action( 'woocommerce_init', array( $this, 'register_brands_taxonomy' ), 10, 0 );
10
+ add_action( 'init', array( $this, 'add_brands_metafields' ) );
11
+ add_action( 'pwb-brand_add_form_fields', array( $this, 'add_brands_metafields_form' ) );
12
+ add_action( 'pwb-brand_edit_form_fields', array( $this, 'add_brands_metafields_form_edit' ) );
13
+ add_action( 'edit_pwb-brand', array( $this, 'add_brands_metafields_save' ) );
14
+ add_action( 'create_pwb-brand', array( $this, 'add_brands_metafields_save' ) );
15
+ add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) );
16
+ $this->brand_logo_position();
17
+ add_action( 'woocommerce_before_shop_loop', array( $this, 'archive_page_banner' ), 9);
18
+ add_action( 'woocommerce_after_shop_loop_item_title', array( $this, 'show_brands_in_loop' ) );
19
+ if( !is_admin() ) add_action( 'init', array( $this, 'register_frontend_scripts' ) );
20
+ $this->add_shortcodes();
21
+ if( is_plugin_active('js_composer/js_composer.php') || is_plugin_active('visual_composer/js_composer.php') ){
22
+ add_action( 'vc_before_init', array( $this,'vc_map_shortcodes' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
+ add_action( 'widgets_init', array( $this, 'register_widgets' ) );
25
 
26
+ if( defined('PWB_WC_VERSION') && version_compare( PWB_WC_VERSION, '3.0.0', '>=' ) ){
27
+ add_filter( 'woocommerce_structured_data_product', array( $this, 'product_microdata' ), 10, 2 );
28
+ }else{
29
+ add_action( 'wp_head' , array( $this, 'product_microdata_legacy' ), 40 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
 
32
+ add_action( 'pre_get_posts', array( $this, 'pwb_brand_filter' ) );
33
+ add_filter( 'plugin_action_links_' . PWB_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
34
+ add_action( 'wp_ajax_dismiss_pwb_notice', array( $this, 'dismiss_pwb_notice' ) );
35
+ add_action( 'admin_notices', array( $this, 'review_notice' ) );
36
+
37
+ add_action( 'pre_get_posts', function(){
38
+ if( is_tax('pwb-brand') )
39
+ remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
40
+ });
41
+ add_action( 'woocommerce_product_duplicate', array( $this, 'product_duplicate_save' ), 10, 2 );
42
+ }
43
+
44
+ public function review_notice(){
45
+ $show_notice = get_option('wc_pwb_notice_plugin_review', true);
46
+ $activate_on = get_option('pwb_activate_on', time());
47
+ $now = time();
48
+ $one_month = 2592000;
49
+ $date_diff = $now - $activate_on;
50
+
51
+ if ( $show_notice && $date_diff > $one_month ) {
52
+ ?>
53
+ <div class="notice notice-info pwb-notice-dismissible is-dismissible" data-notice="wc_pwb_notice_plugin_review">
54
+ <p><?php echo __('We know that you´re in love with Perfect WooCommerce Brands, you can help us making it a bit better. Thanks a lot!', 'perfect-woocommerce-brands' ); ?><span class="dashicons dashicons-heart"></span></p>
55
+ <p>
56
+ <?php _e( '<a href="https://wordpress.org/support/plugin/perfect-woocommerce-brands/reviews/?rate=5#new-post" target="_blank">Leave a review</a>', 'perfect-woocommerce-brands' ); ?>
57
+ <?php _e( '<a href="https://translate.wordpress.org/projects/wp-plugins/perfect-woocommerce-brands" target="_blank">Translate the plugin</a>', 'perfect-woocommerce-brands' ); ?>
58
+ <?php _e( '<a href="https://github.com/titodevera/perfect-woocommerce-brands" target="_blank">View on GitHub</a>', 'perfect-woocommerce-brands' ); ?>
59
+ </p>
60
+ </div>
61
+ <?php
62
  }
63
+ }
64
 
65
+ public function dismiss_pwb_notice(){
66
+ $notice_name_whitelist = array( 'wc_pwb_notice_plugin_review' );
67
+ if( isset( $_POST['notice_name'] ) && in_array( $_POST['notice_name'], $notice_name_whitelist ) ){
68
+ update_option( $_POST['notice_name'], 0 );
69
+ echo 'ok';
70
+ }else{
71
+ echo 'error';
72
  }
73
+ wp_die();
74
+ }
75
 
76
+ /**
77
+ * Adds a settings shortcut to plugin´s actions on plugins list
78
+ */
79
+ public function plugin_action_links( $links ) {
80
+ $settings_url = esc_url( admin_url( 'admin.php?page=wc-settings&tab=pwb_admin_tab' ) );
81
+ $links[] = '<a href="'. $settings_url .'">'.__('Settings','perfect-woocommerce-brands').'</a>';
82
+ return $links;
83
+ }
84
 
85
+ public function pwb_brand_filter( $query ){
86
 
87
+ if( !empty($_GET['pwb-brand-filter']) ){
88
 
89
+ $terms_array = explode(',',$_GET['pwb-brand-filter']);
 
 
 
90
 
91
+ //remove invalid terms (security)
92
+ for($i=0; $i < count($terms_array); $i++) {
93
+ if( !term_exists( $terms_array[$i], 'pwb-brand' ) ) unset($terms_array[$i]);
94
+ }
95
 
96
+ $filterable_product = false;
97
+ if( is_product_category() || is_post_type_archive( 'product' ) )
98
+ $filterable_product = true;
99
 
100
+ if( $filterable_product && $query->is_main_query() ) {
 
 
 
 
 
 
101
 
102
+ $query->set('tax_query', array(
103
+ array (
104
+ 'taxonomy' => 'pwb-brand',
105
+ 'field' => 'slug',
106
+ 'terms' => $terms_array
107
+ )
108
+ ));
109
 
110
  }
111
 
112
  }
113
 
114
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
+ /*
117
+ * Adds microdata (brands) to single products (WooCommerce < 3.0.0)
118
+ */
119
+ public function product_microdata_legacy(){
120
+ global $post;
121
 
122
+ if( isset( $post->post_type ) && $post->post_type==='product' ){
123
+ $brands = wp_get_post_terms( $post->ID, 'pwb-brand');
124
  foreach ($brands as $brand) {
125
+ echo '<meta itemprop="brand" content="'.$brand->name.'">';
126
  }
127
+ }
128
 
129
+ }
130
 
131
+ /*
132
+ * Adds microdata (brands) to single products (WooCommerce > 3.0.0)
133
+ */
134
+ public function product_microdata( $markup, $product ){
135
 
136
+ $new_markup = array();
137
+ $brands = wp_get_post_terms( $product->get_id(), 'pwb-brand');
138
+ foreach ($brands as $brand) {
139
+ $new_markup['brand'][] = $brand->name;
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  }
141
 
142
+ return array_merge( $markup, $new_markup );
 
 
 
 
143
 
144
+ }
145
 
146
+ public function add_shortcodes(){
147
+ add_shortcode( 'pwb-carousel', array(
148
+ '\Perfect_Woocommerce_Brands\Shortcodes\PWB_Carousel_Shortcode',
149
+ 'carousel_shortcode'
150
+ ) );
151
+ add_shortcode( 'pwb-product-carousel', array(
152
+ '\Perfect_Woocommerce_Brands\Shortcodes\PWB_Product_Carousel_Shortcode',
153
+ 'product_carousel_shortcode'
154
+ ) );
155
+ add_shortcode( 'pwb-all-brands', array(
156
+ '\Perfect_Woocommerce_Brands\Shortcodes\PWB_All_Brands_Shortcode',
157
+ 'all_brands_shortcode'
158
+ ) );
159
+ add_shortcode( 'pwb-brand', array(
160
+ '\Perfect_Woocommerce_Brands\Shortcodes\PWB_Brand_Shortcode',
161
+ 'brand_shortcode'
162
+ ) );
163
+ }
164
 
165
+ public function register_widgets(){
166
+ register_widget( '\Perfect_Woocommerce_Brands\Widgets\PWB_List_Widget' );
167
+ register_widget( '\Perfect_Woocommerce_Brands\Widgets\PWB_Dropdown_Widget' );
168
+ register_widget( '\Perfect_Woocommerce_Brands\Widgets\PWB_Filter_By_Brand_Widget' );
169
+ }
170
 
171
+ public function show_brands_in_loop(){
 
 
 
 
 
172
 
173
+ $brands_in_loop = get_option('wc_pwb_admin_tab_brands_in_loop');
 
 
174
 
175
+ if( $brands_in_loop == 'brand_link' || $brands_in_loop == 'brand_image' ){
 
 
 
 
 
 
176
 
177
+ global $product;
178
+ $product_id = $product->get_id();
179
+ $product_brands = wp_get_post_terms($product_id, 'pwb-brand');
180
+ if(!empty($product_brands)){
181
+ echo '<div class="pwb-brands-in-loop">';
182
+ foreach ($product_brands as $brand) {
183
 
184
+ echo '<span>';
185
+ $brand_link = get_term_link ( $brand->term_id, 'pwb-brand' );
186
+ $attachment_id = get_term_meta( $brand->term_id, 'pwb_brand_image', 1 );
187
 
188
+ $attachment_html = wp_get_attachment_image( $attachment_id, 'thumbnail' );
189
+ if( !empty($attachment_html) && $brands_in_loop == 'brand_image' ){
190
+ echo '<a href="'.$brand_link.'">'.$attachment_html.'</a>';
191
+ }else{
192
+ echo '<a href="'.$brand_link.'">'.$brand->name.'</a>';
193
+ }
194
+ echo '</span>';
195
 
196
+ }
197
+ echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  }
199
+
200
  }
201
 
202
+ }
203
 
204
+ /**
205
+ * woocommerce_single_product_summary hook.
206
+ *
207
+ * @hooked woocommerce_template_single_title - 5
208
+ * @hooked woocommerce_template_single_rating - 10
209
+ * @hooked woocommerce_template_single_price - 10
210
+ * @hooked woocommerce_template_single_excerpt - 20
211
+ * @hooked woocommerce_template_single_add_to_cart - 30
212
+ * @hooked woocommerce_template_single_meta - 40
213
+ * @hooked woocommerce_template_single_sharing - 50
214
+ */
215
+ private function brand_logo_position(){
216
+ $position = 41;
217
+ $position_selected = get_option('wc_pwb_admin_tab_brand_single_position');
218
+ if(!$position_selected){
219
+ update_option('wc_pwb_admin_tab_brand_single_position','after_meta');
220
+ }
221
+ switch ($position_selected) {
222
+ case 'before_title':
223
+ $position = 4;
224
+ break;
225
+ case 'after_title':
226
+ $position = 6;
227
+ break;
228
+ case 'after_price':
229
+ $position = 11;
230
+ break;
231
+ case 'after_excerpt':
232
+ $position = 21;
233
+ break;
234
+ case 'after_add_to_cart':
235
+ $position = 31;
236
+ break;
237
+ case 'after_meta':
238
+ $position = 41;
239
+ break;
240
+ case 'after_sharing':
241
+ $position = 51;
242
+ break;
243
+ }
244
+ add_action('woocommerce_single_product_summary', array($this,'action_woocommerce_single_product_summary'), $position);
245
+ }
246
 
 
 
 
247
 
248
+ /*
249
+ * Maps shortcode (for visual composer plugin)
250
+ *
251
+ * @since 1.0
252
+ * @link https://vc.wpbakery.com/
253
+ * @return mixed
254
+ */
255
+ public function vc_map_shortcodes(){
256
+ $available_image_sizes_adapted = array();
257
+ $available_image_sizes = get_intermediate_image_sizes();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
 
259
+ foreach($available_image_sizes as $image_size){
260
+ $available_image_sizes_adapted[$image_size] = $image_size;
261
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
263
+ vc_map(array(
264
+ "name" => __( "PWB Product carousel", "perfect-woocommerce-brands" ),
265
+ "description" => __( "Product carousel by brand or by category", "perfect-woocommerce-brands" ),
266
+ "base" => "pwb-product-carousel",
267
+ "class" => "",
268
+ "icon" => PWB_PLUGIN.'/assets/img/icon_pwb.jpg',
269
+ "category" => "Woocommerce",
270
+ "params" => array(
271
+ array(
272
+ "type" => "dropdown",
273
+ "heading" => __( "Brand", "perfect-woocommerce-brands" ),
274
+ "param_name" => "brand",
275
+ "admin_label" => true,
276
+ "value" => self::get_brands_array( true )
277
+ ),
278
+ array(
279
+ "type" => "textfield",
280
+ "holder" => "div",
281
+ "heading" => __( "Products", "perfect-woocommerce-brands" ),
282
+ "param_name" => "products",
283
+ "value" => "10",
284
+ "description" => __( "Number of products to load", "perfect-woocommerce-brands" )
285
+ ),
286
+ array(
287
+ "type" => "textfield",
288
+ "holder" => "div",
289
+ "heading" => __( "Products to show", "perfect-woocommerce-brands" ),
290
+ "param_name" => "products_to_show",
291
+ "value" => "5",
292
+ "description" => __( "Number of products to show", "perfect-woocommerce-brands" )
293
+ ),
294
+ array(
295
+ "type" => "textfield",
296
+ "holder" => "div",
297
+ "heading" => __( "Products to scroll", "perfect-woocommerce-brands" ),
298
+ "param_name" => "products_to_scroll",
299
+ "value" => "1",
300
+ "description" => __( "Number of products to scroll", "perfect-woocommerce-brands" )
301
+ ),
302
+ array(
303
+ "type" => "checkbox",
304
+ "holder" => "div",
305
+ "heading" => __( "Autoplay", "perfect-woocommerce-brands" ),
306
+ "param_name" => "autoplay",
307
+ "description" => __( "Autoplay carousel", "perfect-woocommerce-brands" )
308
+ ),
309
+ array(
310
+ "type" => "checkbox",
311
+ "holder" => "div",
312
+ "heading" => __( "Arrows", "perfect-woocommerce-brands" ),
313
+ "param_name" => "arrows",
314
+ "description" => __( "Display prev and next arrows", "perfect-woocommerce-brands" )
315
+ )
316
+ )
317
+ ));
318
+
319
+ vc_map(array(
320
+ "name" => __( "PWB Brands carousel", "perfect-woocommerce-brands" ),
321
+ "description" => __( "Brands carousel", "perfect-woocommerce-brands" ),
322
+ "base" => "pwb-carousel",
323
+ "class" => "",
324
+ "icon" => PWB_PLUGIN.'/assets/img/icon_pwb.jpg',
325
+ "category" => "Woocommerce",
326
+ "params" => array(
327
+ array(
328
+ "type" => "textfield",
329
+ "holder" => "div",
330
+ "heading" => __( "Items", "perfect-woocommerce-brands" ),
331
+ "param_name" => "items",
332
+ "value" => "10",
333
+ "description" => __( "Number of items to load (or 'featured')", "perfect-woocommerce-brands" )
334
+ ),
335
+ array(
336
+ "type" => "textfield",
337
+ "holder" => "div",
338
+ "heading" => __( "Items to show", "perfect-woocommerce-brands" ),
339
+ "param_name" => "items_to_show",
340
+ "value" => "5",
341
+ "description" => __( "Number of items to show", "perfect-woocommerce-brands" )
342
+ ),
343
+ array(
344
+ "type" => "textfield",
345
+ "holder" => "div",
346
+ "heading" => __( "Items to scroll", "perfect-woocommerce-brands" ),
347
+ "param_name" => "items_to_scroll",
348
+ "value" => "1",
349
+ "description" => __( "Number of items to scroll", "perfect-woocommerce-brands" )
350
+ ),
351
+ array(
352
+ "type" => "checkbox",
353
+ "holder" => "div",
354
+ "heading" => __( "Autoplay", "perfect-woocommerce-brands" ),
355
+ "param_name" => "autoplay",
356
+ "description" => __( "Autoplay carousel", "perfect-woocommerce-brands" )
357
+ ),
358
+ array(
359
+ "type" => "checkbox",
360
+ "holder" => "div",
361
+ "heading" => __( "Arrows", "perfect-woocommerce-brands" ),
362
+ "param_name" => "arrows",
363
+ "description" => __( "Display prev and next arrows", "perfect-woocommerce-brands" )
364
+ ),
365
+ array(
366
+ "type" => "dropdown",
367
+ "heading" => __( "Brand logo size", "perfect-woocommerce-brands" ),
368
+ "param_name" => "image_size",
369
+ "admin_label" => true,
370
+ "value" => $available_image_sizes_adapted
371
+ )
372
+ )
373
 
 
374
 
375
+ ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
 
377
+ vc_map(array(
378
+ "name" => __( "PWB All brands", "perfect-woocommerce-brands" ),
379
+ "description" => __( "Show all brands", "perfect-woocommerce-brands" ),
380
+ "base" => "pwb-all-brands",
381
+ "class" => "",
382
+ "icon" => PWB_PLUGIN.'/assets/img/icon_pwb.jpg',
383
+ "category" => "Woocommerce",
384
+ "params" => array(
385
+ array(
386
+ "type" => "textfield",
387
+ "holder" => "div",
388
+ "heading" => __( "Brands per page", "perfect-woocommerce-brands" ),
389
+ "param_name" => "per_page",
390
+ "value" => "10",
391
+ "description" => __( "Show x brands per page", "perfect-woocommerce-brands" )
392
+ ),
393
+ array(
394
+ "type" => "dropdown",
395
+ "heading" => __( "Brand logo size", "perfect-woocommerce-brands" ),
396
+ "param_name" => "image_size",
397
+ "admin_label" => true,
398
+ "value" => $available_image_sizes_adapted
399
+ ),
400
+ array(
401
+ "type" => "dropdown",
402
+ "heading" => __( "Order by", "perfect-woocommerce-brands" ),
403
+ "param_name" => "order_by",
404
+ "admin_label" => true,
405
+ "value" => array(
406
+ 'name' => 'name',
407
+ 'slug' => 'slug',
408
+ 'term_id' => 'term_id',
409
+ 'id' => 'id',
410
+ 'description' => 'description',
411
+ 'rand' => 'rand'
412
+ )
413
+ ),
414
+ array(
415
+ "type" => "dropdown",
416
+ "heading" => __( "Order", "perfect-woocommerce-brands" ),
417
+ "param_name" => "order",
418
+ "admin_label" => true,
419
+ "value" => array(
420
+ 'ASC' => 'ASC',
421
+ 'DSC' => 'DSC'
422
+ )
423
+ ),
424
+ array(
425
+ "type" => "dropdown",
426
+ "heading" => __( "Title position", "perfect-woocommerce-brands" ),
427
+ "param_name" => "title_position",
428
+ "admin_label" => true,
429
+ "value" => array(
430
+ __( "Before image", "perfect-woocommerce-brands" ) => 'before',
431
+ __( "After image", "perfect-woocommerce-brands" ) => 'after',
432
+ __( "Hide", "perfect-woocommerce-brands" ) => 'none'
433
+ )
434
+ ),
435
+ array(
436
+ "type" => "checkbox",
437
+ "holder" => "div",
438
+ "heading" => __( "Hide empty", "perfect-woocommerce-brands" ),
439
+ "param_name" => "hide_empty",
440
+ "description" => __( "Hide brands that have not been assigned to any product", "perfect-woocommerce-brands" )
441
+ )
442
+ )
443
 
 
444
 
445
+ ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
 
447
+ vc_map(array(
448
+ "name" => __( "PWB brand", "perfect-woocommerce-brands" ),
449
+ "description" => __( "Show brand for a specific product", "perfect-woocommerce-brands" ),
450
+ "base" => "pwb-brand",
451
+ "class" => "",
452
+ "icon" => PWB_PLUGIN.'/assets/img/icon_pwb.jpg',
453
+ "category" => "Woocommerce",
454
 
455
+ "params" => array(
456
+ array(
457
+ "type" => "textfield",
458
+ "holder" => "div",
459
+ "heading" => __( "Product id", "perfect-woocommerce-brands" ),
460
+ "param_name" => "product_id",
461
+ "value" => null,
462
+ "description" => __( "Product id (post id)", "perfect-woocommerce-brands" )
463
+ ),
464
+ array(
465
+ "type" => "dropdown",
466
+ "heading" => __( "Brand logo size", "perfect-woocommerce-brands" ),
467
+ "param_name" => "image_size",
468
+ "admin_label" => true,
469
+ "value" => $available_image_sizes_adapted
470
+ )
471
+
472
+ )
473
 
 
 
474
 
475
+ ));
476
+ }
477
 
478
+ public function action_woocommerce_single_product_summary() {
479
+ $brands = wp_get_post_terms( get_the_ID(), 'pwb-brand');
480
 
481
+ if( !is_wp_error( $brands ) ){
482
 
483
+ if( sizeof( $brands ) > 0 ){
484
 
485
+ $show_as = get_option( 'wc_pwb_admin_tab_brands_in_single' );
486
 
487
+ if( $show_as!='no' ){
 
 
 
488
 
489
+ do_action( 'pwb_before_single_product_brands', $brands );
 
 
 
 
490
 
491
+ echo '<div class="pwb-single-product-brands pwb-clearfix">';
492
+ foreach( $brands as $brand ){
493
+ $brand_link = get_term_link ( $brand->term_id, 'pwb-brand' );
494
+ $attachment_id = get_term_meta( $brand->term_id, 'pwb_brand_image', 1 );
495
 
496
+ $image_size = 'thumbnail';
497
+ $image_size_selected = get_option('wc_pwb_admin_tab_brand_logo_size');
498
+ if($image_size_selected!=false){
499
+ $image_size = $image_size_selected;
500
+ }
 
 
501
 
502
+ $attachment_html = wp_get_attachment_image($attachment_id,$image_size);
503
 
504
+ if( !empty($attachment_html) && $show_as=='brand_image' || !empty($attachment_html) && !$show_as ){
505
+ echo '<a href="'.$brand_link.'" title="'.__( 'View brand', 'perfect-woocommerce-brands' ).'">'.$attachment_html.'</a>';
506
+ }else{
507
+ echo '<a href="'.$brand_link.'" title="'.__( 'View brand', 'perfect-woocommerce-brands' ).'">'.$brand->name.'</a>';
508
+ }
509
  }
510
+ echo '</div>';
511
+
512
+ do_action( 'pwb_after_single_product_brands', $brands );
513
 
514
  }
515
 
516
+ }
517
 
518
+ }
519
 
520
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
 
522
+ public function register_frontend_scripts(){
523
+
524
+ wp_register_script(
525
+ 'pwb_slick_lib',
526
+ PWB_PLUGIN . '/assets/js/slick/slick.min.js',
527
+ array('jquery'),
528
+ '1.8.0',
529
+ true
530
+ );
531
+ wp_enqueue_script('pwb_frontend_functions');
532
+
533
+ wp_enqueue_style(
534
+ 'pwb_slick_lib',
535
+ PWB_PLUGIN . '/assets/js/slick/slick.css',
536
+ array(),
537
+ '1.8.0',
538
+ 'all'
539
+ );
540
+
541
+ wp_enqueue_style(
542
+ 'pwb_frontend_styles',
543
+ PWB_PLUGIN . '/assets/css/styles-frontend.min.css',
544
+ array('pwb_slick_lib'),
545
+ PWB_PLUGIN_VERSION,
546
+ 'all'
547
+ );
548
+
549
+ wp_register_script(
550
+ 'pwb_frontend_functions',
551
+ PWB_PLUGIN . '/assets/js/pwb_frontend_functions.min.js',
552
+ array('jquery','pwb_slick_lib'),
553
+ PWB_PLUGIN_VERSION,
554
+ true
555
+ );
556
+ wp_enqueue_script('pwb_frontend_functions');
557
 
558
+ }
 
559
 
560
+ public function register_admin_scripts($hook){
561
+ $screen = get_current_screen();
562
 
563
+ wp_register_style('pwb_styles_brands', PWB_PLUGIN . '/assets/css/styles-admin.min.css', array(), PWB_PLUGIN_VERSION);
564
+ wp_register_script('pwb_brands_js', PWB_PLUGIN . '/assets/js/pwb_admin_functions.min.js', array('jquery'), PWB_PLUGIN_VERSION, true);
565
+
566
+ if ($hook == 'edit-tags.php' && $screen->taxonomy == 'pwb-brand' || $hook == 'term.php' && $screen->taxonomy == 'pwb-brand') {
567
+ wp_enqueue_media();
568
+ }
569
+
570
+ wp_enqueue_style( 'pwb_styles_brands' );
571
+ wp_enqueue_script( 'pwb_brands_js' );
572
+ wp_localize_script( 'pwb_brands_js', 'ajax_object', array(
573
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
574
+ 'site_url' => site_url(),
575
+ 'brands_url' => admin_url( 'edit-tags.php?taxonomy=pwb-brand&post_type=product' ),
576
+ 'translations' => array(
577
+ 'migrate_notice' => __('¿Start migration?','perfect-woocommerce-brands'),
578
+ 'migrating' => __('We are migrating the product brands. ¡Don´t close this window until the process is finished!','perfect-woocommerce-brands'),
579
+ 'dummy_data_notice' => __('¿Start loading dummy data?','perfect-woocommerce-brands'),
580
+ 'dummy_data' => __('We are importing the dummy data. ¡Don´t close this window until the process is finished!','perfect-woocommerce-brands')
581
+ )
582
+ ) );
583
+
584
+ }
585
 
586
+ public function register_brands_taxonomy(){
587
+ $labels = array(
588
+ 'name' => __( 'Brands', 'perfect-woocommerce-brands' ),
589
+ 'singular_name' => __( 'Brand', 'perfect-woocommerce-brands' ),
590
+ 'menu_name' => __( 'Brands', 'perfect-woocommerce-brands' ),
591
+ 'all_items' => __( 'All Brands', 'perfect-woocommerce-brands' ),
592
+ 'edit_item' => __( 'Edit Brand', 'perfect-woocommerce-brands' ),
593
+ 'view_item' => __( 'View Brand', 'perfect-woocommerce-brands' ),
594
+ 'update_item' => __( 'Update Brand', 'perfect-woocommerce-brands' ),
595
+ 'add_new_item' => __( 'Add New Brand', 'perfect-woocommerce-brands' ),
596
+ 'new_item_name' => __( 'New Brand Name', 'perfect-woocommerce-brands' ),
597
+ 'parent_item' => __( 'Parent Brand', 'perfect-woocommerce-brands' ),
598
+ 'parent_item_colon' => __( 'Parent Brand:', 'perfect-woocommerce-brands' ),
599
+ 'search_items' => __( 'Search Brands', 'perfect-woocommerce-brands' ),
600
+ 'popular_items' => __( 'Popular Brands', 'perfect-woocommerce-brands' ),
601
+ 'separate_items_with_commas' => __( 'Separate brands with commas', 'perfect-woocommerce-brands' ),
602
+ 'add_or_remove_items' => __( 'Add or remove brands', 'perfect-woocommerce-brands' ),
603
+ 'choose_from_most_used' => __( 'Choose from the most used brands', 'perfect-woocommerce-brands' ),
604
+ 'not_found' => __( 'No brands found', 'perfect-woocommerce-brands' )
605
+ );
606
+
607
+ $new_slug = get_option('wc_pwb_admin_tab_slug');
608
+ $old_slug = get_option('old_wc_pwb_admin_tab_slug');
609
+
610
+ $new_slug = ($new_slug!=false) ? $new_slug : 'brand';
611
+ $old_slug = ($old_slug!=false) ? $old_slug : 'null';
612
+
613
+ $args = array(
614
+ 'hierarchical' => true,
615
+ 'labels' => $labels,
616
+ 'show_ui' => true,
617
+ 'query_var' => true,
618
+ 'public' => true,
619
+ 'show_admin_column' => true,
620
+ 'rewrite' => array(
621
+ 'slug' => $new_slug,
622
+ 'hierarchical' => true,
623
+ 'ep_mask' => EP_PERMALINK
624
  )
625
+ );
626
 
627
+ register_taxonomy( 'pwb-brand', array( 'product' ), $args );
628
 
629
+ if($new_slug != false && $old_slug!= false && $new_slug != $old_slug){
630
+ flush_rewrite_rules();
631
+ update_option( 'old_wc_pwb_admin_tab_slug', $new_slug );
632
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
633
 
634
+ }
635
 
636
+ public function add_brands_metafields(){
637
+ register_meta( 'term', 'pwb_brand_image', array($this,'add_brands_metafields_sanitize') );
638
+ }
639
 
640
+ public function add_brands_metafields_sanitize($brand_img){
641
+ return $brand_img;
642
+ }
643
+
644
+ public function add_brands_metafields_form(){
645
+ ob_start();
646
+ ?>
647
+ <div class="form-field pwb_brand_cont">
648
+ <label for="pwb_brand_image"><?php _e( 'Brand logo', 'perfect-woocommerce-brands' ); ?></label>
649
+ <input type="text" name="pwb_brand_image" id="pwb_brand_image" value="" >
650
+ <a href="#" id="pwb_brand_image_select" class="button"><?php _e('Select image','perfect-woocommerce-brands');?></a>
651
+ </div>
652
+
653
+ <div class="form-field pwb_brand_cont">
654
+ <label for="pwb_brand_banner"><?php _e( 'Brand banner', 'perfect-woocommerce-brands' ); ?></label>
655
+ <input type="text" name="pwb_brand_banner" id="pwb_brand_banner" value="" >
656
+ <a href="#" id="pwb_brand_banner_select" class="button"><?php _e('Select image','perfect-woocommerce-brands');?></a>
657
+ <p><?php _e( 'This image will be shown on brand page', 'perfect-woocommerce-brands' ); ?></p>
658
+ </div>
659
+
660
+ <div class="form-field pwb_brand_cont">
661
+ <label for="pwb_brand_banner_link"><?php _e( 'Brand banner link', 'perfect-woocommerce-brands' ); ?></label>
662
+ <input type="text" name="pwb_brand_banner_link" id="pwb_brand_banner_link" value="" >
663
+ <p><?php _e( 'This link should be relative to site url. Example: product/product-name', 'perfect-woocommerce-brands' ); ?></p>
664
+ </div>
665
+
666
+ <?php echo wp_nonce_field( basename( __FILE__ ), 'pwb_nonce' ); ?>
667
+
668
+ <?php
669
+ echo ob_get_clean();
670
+ }
671
 
672
+ public function add_brands_metafields_form_edit($term){
673
+ $term_value_image = get_term_meta( $term->term_id, 'pwb_brand_image', true );
674
+ $term_value_banner = get_term_meta( $term->term_id, 'pwb_brand_banner', true );
675
+ $term_value_banner_link = get_term_meta( $term->term_id, 'pwb_brand_banner_link', true );
676
+ ob_start();
677
+ ?>
678
+ <table class="form-table pwb_brand_cont">
679
+ <tr class="form-field">
680
+ <th>
681
  <label for="pwb_brand_image"><?php _e( 'Brand logo', 'perfect-woocommerce-brands' ); ?></label>
682
+ </th>
683
+ <td>
684
+ <input type="text" name="pwb_brand_image" id="pwb_brand_image" value="<?php echo $term_value_image;?>" >
685
  <a href="#" id="pwb_brand_image_select" class="button"><?php _e('Select image','perfect-woocommerce-brands');?></a>
 
686
 
687
+ <?php $current_image = wp_get_attachment_image ( $term_value_image, array('90','90'), false ); ?>
688
+ <?php if( !empty($current_image) ): ?>
689
+ <div class="pwb_brand_image_selected">
690
+ <span>
691
+ <?php echo $current_image;?>
692
+ <a href="#" class="pwb_brand_image_selected_remove">X</a>
693
+ </span>
694
+ </div>
695
+ <?php endif; ?>
696
+
697
+ </td>
698
+ </tr>
699
+ <tr class="form-field">
700
+ <th>
701
  <label for="pwb_brand_banner"><?php _e( 'Brand banner', 'perfect-woocommerce-brands' ); ?></label>
702
+ </th>
703
+ <td>
704
+ <input type="text" name="pwb_brand_banner" id="pwb_brand_banner" value="<?php echo $term_value_banner;?>" >
705
  <a href="#" id="pwb_brand_banner_select" class="button"><?php _e('Select image','perfect-woocommerce-brands');?></a>
 
 
706
 
707
+ <?php $current_image = wp_get_attachment_image ( $term_value_banner, array('90','90'), false ); ?>
708
+ <?php if( !empty($current_image) ): ?>
709
+ <div class="pwb_brand_image_selected">
710
+ <span>
711
+ <?php echo $current_image;?>
712
+ <a href="#" class="pwb_brand_image_selected_remove">X</a>
713
+ </span>
714
+ </div>
715
+ <?php endif; ?>
716
+
717
+ </td>
718
+ </tr>
719
+ <tr class="form-field">
720
+ <th>
721
  <label for="pwb_brand_banner_link"><?php _e( 'Brand banner link', 'perfect-woocommerce-brands' ); ?></label>
722
+ </th>
723
+ <td>
724
+ <input type="text" name="pwb_brand_banner_link" id="pwb_brand_banner_link" value="<?php echo $term_value_banner_link;?>" >
725
+ <p class="description"><?php _e( 'This link should be relative to site url. Example: product/product-name', 'perfect-woocommerce-brands' ); ?></p>
726
+ <div id="pwb_brand_banner_link_result"><?php echo wp_get_attachment_image ( $term_value_banner_link, array('90','90'), false );?></div>
727
+ </td>
728
+ </tr>
729
+ </table>
730
+
731
+ <?php echo wp_nonce_field( basename( __FILE__ ), 'pwb_nonce' );?>
732
+
733
+ <?php
734
+ echo ob_get_clean();
735
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
736
 
737
+ public function add_brands_metafields_save( $term_id ){
 
 
738
 
739
+ if ( ! isset( $_POST['pwb_nonce'] ) || ! wp_verify_nonce( $_POST['pwb_nonce'], basename( __FILE__ ) ) )
740
+ return;
 
741
 
742
+ /* ·············· Brand image ·············· */
743
+ $old_img = get_term_meta( $term_id, 'pwb_brand_image', true );
744
+ $new_img = isset( $_POST['pwb_brand_image'] ) ? $_POST['pwb_brand_image'] : '';
745
 
746
+ if ( $old_img && '' === $new_img )
747
+ delete_term_meta( $term_id, 'pwb_brand_image' );
 
748
 
749
+ else if ( $old_img !== $new_img )
750
+ update_term_meta( $term_id, 'pwb_brand_image', $new_img );
751
+ /* ·············· /Brand image ·············· */
752
 
753
+ /* ·············· Brand banner ·············· */
754
+ $old_img = get_term_meta( $term_id, 'pwb_brand_banner', true );
755
+ $new_img = isset( $_POST['pwb_brand_banner'] ) ? $_POST['pwb_brand_banner'] : '';
756
 
757
+ if ( $old_img && '' === $new_img )
758
+ delete_term_meta( $term_id, 'pwb_brand_banner' );
 
 
759
 
760
+ else if ( $old_img !== $new_img )
761
+ update_term_meta( $term_id, 'pwb_brand_banner', $new_img );
762
+ /* ·············· /Brand banner ·············· */
763
 
764
+ /* ·············· Brand banner link ·············· */
765
+ $old_img = get_term_meta( $term_id, 'pwb_brand_banner_link', true );
766
+ $new_img = isset( $_POST['pwb_brand_banner_link'] ) ? $_POST['pwb_brand_banner_link'] : '';
767
 
768
+ if ( $old_img && '' === $new_img )
769
+ delete_term_meta( $term_id, 'pwb_brand_banner_link' );
 
 
 
770
 
771
+ else if ( $old_img !== $new_img )
772
+ update_term_meta( $term_id, 'pwb_brand_banner_link', $new_img );
773
+ /* ·············· /Brand banner link ·············· */
774
+ }
775
 
776
+ public static function get_brands( $hide_empty = false, $order_by = 'name', $order = 'ASC', $only_featured = false ){
777
+ $result = array();
 
778
 
779
+ $brands_args = array( 'hide_empty' => $hide_empty, 'order_by' => $order_by, 'order' => $order );
780
+ if( $only_featured ) $brands_args['meta_query'] = array( array( 'key' => 'pwb_featured_brand', 'value' => true ) );
781
 
782
+ $brands = get_terms('pwb-brand', $brands_args);
 
 
 
 
 
 
 
783
 
784
+ if( is_array($brands) && count($brands)>0 ) $result = $brands;
 
785
 
786
+ return $result;
787
+ }
 
 
 
788
 
789
+ public static function get_brands_array( $is_select = false ){
790
+ $result = array();
 
791
 
792
+ //if is for select input adds default value
793
+ if( $is_select )
794
+ $result[0] = __( 'All', 'perfect-woocommerce-brands' );
795
 
796
+ $brands = get_terms('pwb-brand',array(
797
+ 'hide_empty' => false
798
+ ));
799
 
800
+ foreach ($brands as $brand) {
801
+ $result[$brand->term_id] = $brand->slug;
802
+ }
803
 
804
+ return $result;
 
 
805
 
806
+ }
 
 
807
 
808
+ public function archive_page_banner(){
809
+ $queried_object = get_queried_object();
 
810
 
811
+ if( is_tax('pwb-brand') ){
812
 
813
+ $brand_banner = get_term_meta( $queried_object->term_id, 'pwb_brand_banner', true );
814
+ $brand_banner_link = get_term_meta( $queried_object->term_id, 'pwb_brand_banner_link', true );
815
+ $show_desc = get_option('wc_pwb_admin_tab_brand_desc');
816
 
817
+ if( $brand_banner!='' || $queried_object->description != '' && $show_desc !== 'no' ){
818
+ echo '<div class="pwb-brand-banner-cont">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
819
  }
820
 
821
+ //pwb-brand archive
822
+ if( $brand_banner!='' ){
823
+ echo '<div class="pwb-brand-banner pwb-clearfix">';
824
+ if($brand_banner_link!=''){
825
+ echo '<a href="'.site_url($brand_banner_link).'">'.wp_get_attachment_image ( $brand_banner, 'full', false ).'</a>';
826
+ }else{
827
+ echo wp_get_attachment_image ( $brand_banner, 'full', false );
828
+ }
 
 
 
 
 
 
829
  echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
830
  }
831
 
832
+ //show brand description
833
+ if( $queried_object->description != '' && $show_desc !== 'no' ){
834
+ echo '<div class="pwb-brand-description">';
835
+ echo $queried_object->description;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
836
  echo '</div>';
837
  }
838
 
839
+ if( $brand_banner!='' || $queried_object->description != '' && $show_desc !== 'no' ){
840
+ echo '</div>';
841
  }
842
 
843
  }
844
 
845
  }
846
+
847
+ public static function render_template( $name, $folder = '', $data ){
848
+ ob_start();
849
+ if( $folder ) $folder = $folder . '/';
850
+ $template_file = dirname( __DIR__ ) . '/templates/' . $folder . $name . '.php';
851
+ include $template_file;
852
+ echo ob_get_clean();
853
+ }
854
+
855
+ public function product_duplicate_save( $duplicate, $product ){
856
+ $product_brands = wp_get_object_terms( $product->get_id(), 'pwb-brand', array( 'fields' => 'ids' ) );
857
+ wp_set_object_terms( $duplicate->get_id(), $product_brands, 'pwb-brand' );
858
+ }
859
+
860
+ }
classes/class-pwb-importer-support.php CHANGED
@@ -25,38 +25,27 @@ class PWB_Importer_Support{
25
 
26
  /**
27
  * Add automatic mapping support for 'Custom Column'.
28
- * This will automatically select the correct mapping for columns named 'Custom Column' or 'custom column'.
29
  *
30
  * @param array $columns
31
  * @return array $columns
32
  */
33
  public function add_column_to_mapping_screen( $columns ) {
34
- $columns['pwb-brand'] = __('Brand', 'perfect-woocommerce-brands');
35
  return $columns;
36
  }
37
 
38
  /**
39
  * Process the data read from the CSV file.
40
- * This just saves the value in meta data, but you can do anything you want here with the data.
41
  *
42
  * @param WC_Product $object - Product being imported or updated.
43
  * @param array $data - CSV data read for the product.
44
  * @return WC_Product $object
45
  */
46
  public function process_import( $object, $data ) {
 
47
  $brands = explode( ',', $data['pwb-brand'] );
48
- foreach( $brands as $brand ){
49
- $brand_id = term_exists( $brand, 'pwb-brand' );
50
- if( $brand_id !== 0 && $brand_id !== null ) {
51
- //brand exists
52
- wp_set_object_terms( $object->get_id(), $brand, 'pwb-brand' );
53
- }else{
54
- //insert new brand and assign it to the product
55
- $new_brand = wp_insert_term( $brand, 'pwb-brand' );
56
- if( !is_wp_error( $new_brand ) ) wp_set_object_terms( $object->get_id(), $new_brand->term_id, 'pwb-brand' );
57
- }
58
- }
59
  return $object;
60
  }
61
-
62
  }
25
 
26
  /**
27
  * Add automatic mapping support for 'Custom Column'.
 
28
  *
29
  * @param array $columns
30
  * @return array $columns
31
  */
32
  public function add_column_to_mapping_screen( $columns ) {
33
+ $columns[__('Brand', 'perfect-woocommerce-brands')] = 'pwb-brand';
34
  return $columns;
35
  }
36
 
37
  /**
38
  * Process the data read from the CSV file.
 
39
  *
40
  * @param WC_Product $object - Product being imported or updated.
41
  * @param array $data - CSV data read for the product.
42
  * @return WC_Product $object
43
  */
44
  public function process_import( $object, $data ) {
45
+ wp_delete_object_term_relationships( $object->get_id(), 'pwb-brand' );
46
  $brands = explode( ',', $data['pwb-brand'] );
47
+ foreach( $brands as $brand ) wp_set_object_terms( $object->get_id(), $brand, 'pwb-brand', true );
 
 
 
 
 
 
 
 
 
 
48
  return $object;
49
  }
50
+
51
  }
classes/shortcodes/class-pwb-carousel.php CHANGED
@@ -1,60 +1,68 @@
1
  <?php
2
- namespace Perfect_Woocommerce_Brands\Shortcodes;
3
 
4
- defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
5
 
6
- class PWB_Carousel_Shortcode{
7
 
8
- public static function carousel_shortcode( $atts ) {
9
- $atts = shortcode_atts( array(
10
- 'items' => "10",
11
- 'items_to_show' => "5",
12
- 'items_to_scroll' => "1",
13
- 'image_size' => "thumbnail",
14
- 'autoplay' => "false",
15
- 'arrows' => "false"
16
- ), $atts, 'pwb-carousel' );
17
 
18
- $foreach_iterator = 0;
19
 
20
- $atts['autoplay'] = ( $atts['autoplay'] === 'true' ) ? true: false;
21
- $atts['arrows'] = ( $atts['arrows'] === 'true' ) ? true: false;
 
 
 
 
 
 
22
 
23
- $slick_settings = array(
24
- 'slidesToShow' => (int)$atts['items_to_show'],
25
- 'slidesToScroll' => (int)$atts['items_to_scroll'],
26
- 'autoplay' => (bool)$atts['autoplay'],
27
- 'arrows' => (bool)$atts['arrows']
28
- );
29
 
30
- ob_start();
31
- ?>
32
 
33
- <div class="pwb-carousel" data-slick='<?php echo json_encode($slick_settings); ?>'>
34
- <?php
35
- foreach(\Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::get_brands() as $brand){
36
- if($foreach_iterator>=(int)$atts['items']){
37
- break;
38
- }
39
 
40
- $brand_id = $brand->term_id;
41
- $brand_link = get_term_link($brand_id);
 
 
 
 
 
42
 
43
- $attachment_id = get_term_meta( $brand_id, 'pwb_brand_image', 1 );
44
- $attachment_html = $brand->name;
45
- if($attachment_id!=''){
46
- $attachment_html = wp_get_attachment_image($attachment_id,$atts['image_size']);
47
- }
48
 
49
- echo '<div>';
50
- echo '<a href="'.$brand_link.'" title="'.__( 'View brand', 'perfect-woocommerce-brands' ).'">'.$attachment_html.'</a>';
51
- echo '</div>';
52
 
53
- $foreach_iterator++;
54
- }
55
- echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
- return ob_get_clean();
58
- }
59
 
 
60
  }
 
 
 
 
 
 
1
  <?php
2
+ namespace Perfect_Woocommerce_Brands\Shortcodes;
3
 
4
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
5
 
6
+ class PWB_Carousel_Shortcode{
7
 
8
+ private static $atts;
 
 
 
 
 
 
 
 
9
 
10
+ public static function carousel_shortcode( $atts ) {
11
 
12
+ self::$atts = shortcode_atts( array(
13
+ 'items' => "10",
14
+ 'items_to_show' => "5",
15
+ 'items_to_scroll' => "1",
16
+ 'image_size' => "thumbnail",
17
+ 'autoplay' => "false",
18
+ 'arrows' => "false"
19
+ ), $atts, 'pwb-carousel' );
20
 
21
+ \Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::render_template(
22
+ 'carousel',
23
+ 'shortcodes',
24
+ array( 'slick_settings' => self::slick_settings(), 'brands' => self::brands_data() )
25
+ );
 
26
 
27
+ }
 
28
 
29
+ private static function slick_settings(){
 
 
 
 
 
30
 
31
+ $slick_settings = array(
32
+ 'slidesToShow' => (int)self::$atts['items_to_show'],
33
+ 'slidesToScroll' => (int)self::$atts['items_to_scroll'],
34
+ 'autoplay' => ( self::$atts['autoplay'] === 'true' ) ? true: false,
35
+ 'arrows' => ( self::$atts['arrows'] === 'true' ) ? true: false
36
+ );
37
+ return htmlspecialchars( json_encode( $slick_settings ), ENT_QUOTES, 'UTF-8' );
38
 
39
+ }
 
 
 
 
40
 
41
+ private static function brands_data(){
 
 
42
 
43
+ $brands = array();
44
+ $foreach_i = 0;
45
+ if( self::$atts['items'] == 'featured' ){
46
+ $brands_array = \Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::get_brands( false, 'name', 'ASC', true );
47
+ }else{
48
+ $brands_array = \Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::get_brands();
49
+ }
50
+ foreach( $brands_array as $brand ){
51
+ if( self::$atts['items'] != 'featured' && $foreach_i >= (int)self::$atts['items'] ) break;
52
+
53
+ $brand_id = $brand->term_id;
54
+ $brand_link = get_term_link($brand_id);
55
+ $attachment_id = get_term_meta( $brand_id, 'pwb_brand_image', 1 );
56
+ $attachment_html = $brand->name;
57
+ if($attachment_id!='') $attachment_html = wp_get_attachment_image( $attachment_id, self::$atts['image_size'] );
58
 
59
+ $brands[] = array( 'link' => $brand_link, 'attachment_html' => $attachment_html );
 
60
 
61
+ $foreach_i++;
62
  }
63
+
64
+ return $brands;
65
+
66
+ }
67
+
68
+ }
classes/shortcodes/class-pwb-product-carousel.php CHANGED
@@ -1,39 +1,80 @@
1
  <?php
2
- namespace Perfect_Woocommerce_Brands\Shortcodes;
3
 
4
- defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
5
 
6
- class PWB_Product_Carousel_Shortcode{
7
 
8
- public static function product_carousel_shortcode( $atts ) {
9
- $atts = shortcode_atts( array(
10
- 'brand' => "all",
11
- 'products' => "10",
12
- 'products_to_show' => "5",
13
- 'products_to_scroll' => "1",
14
- 'autoplay' => "false",
15
- 'arrows' => "false"
16
- ), $atts, 'pwb-product-carousel' );
17
 
18
- $atts['autoplay'] = ( $atts['autoplay'] === 'true' ) ? true: false;
19
- $atts['arrows'] = ( $atts['arrows'] === 'true' ) ? true: false;
20
 
21
- $slick_settings = array(
22
- 'slidesToShow' => (int)$atts['products_to_show'],
23
- 'slidesToScroll' => (int)$atts['products_to_scroll'],
24
- 'autoplay' => (bool)$atts['autoplay'],
25
- 'arrows' => (bool)$atts['arrows']
26
- );
 
 
27
 
28
- ob_start();
29
- ?>
 
 
 
30
 
31
- <div class="pwb-product-carousel" data-slick='<?php echo json_encode($slick_settings); ?>'>
32
- <?php echo \Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::get_products_by_brand($atts['brand'], (int)$atts['products']); ?>
33
- </div>
34
 
35
- <?php
36
- return ob_get_clean();
37
- }
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ namespace Perfect_Woocommerce_Brands\Shortcodes;
3
 
4
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
5
 
6
+ class PWB_Product_Carousel_Shortcode{
7
 
8
+ private static $atts;
 
 
 
 
 
 
 
 
9
 
10
+ public static function product_carousel_shortcode( $atts ) {
 
11
 
12
+ self::$atts = shortcode_atts( array(
13
+ 'brand' => "all",
14
+ 'products' => "10",
15
+ 'products_to_show' => "5",
16
+ 'products_to_scroll' => "1",
17
+ 'autoplay' => "false",
18
+ 'arrows' => "false"
19
+ ), $atts, 'pwb-product-carousel' );
20
 
21
+ \Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::render_template(
22
+ 'product-carousel',
23
+ 'shortcodes',
24
+ array( 'slick_settings' => self::slick_settings(), 'products' => self::products_data() )
25
+ );
26
 
27
+ }
 
 
28
 
29
+ private static function slick_settings(){
 
 
30
 
31
+ $slick_settings = array(
32
+ 'slidesToShow' => (int)self::$atts['products_to_show'],
33
+ 'slidesToScroll' => (int)self::$atts['products_to_scroll'],
34
+ 'autoplay' => ( self::$atts['autoplay'] === 'true' ) ? true: false,
35
+ 'arrows' => ( self::$atts['arrows'] === 'true' ) ? true: false
36
+ );
37
+ return htmlspecialchars( json_encode( $slick_settings ), ENT_QUOTES, 'UTF-8' );
38
+
39
+ }
40
+
41
+ private static function products_data(){
42
+
43
+ $products = array();
44
+
45
+ $args = array(
46
+ 'post_type' => 'product',
47
+ 'posts_per_page' => (int)self::$atts['products'],
48
+ 'paged' => false
49
+ );
50
+
51
+ if( self::$atts['brand'] != 'all' ){
52
+ $args['tax_query'] = array(
53
+ array(
54
+ 'taxonomy' => 'pwb-brand',
55
+ 'field' => 'slug',
56
+ 'terms' => self::$atts['brand']
57
+ )
58
+ );
59
  }
60
+
61
+ $loop = new \WP_Query( $args );
62
+ if( $loop->have_posts() ) {
63
+ while ( $loop->have_posts() ) : $loop->the_post();
64
+ $product = wc_get_product( get_the_ID() );
65
+
66
+ $products[] = array(
67
+ 'id' => get_the_ID(),
68
+ 'permalink' => get_the_permalink(),
69
+ 'thumbnail' => woocommerce_get_product_thumbnail(),
70
+ 'title' => $product->get_title()
71
+ );
72
+ endwhile;
73
+ }
74
+ wp_reset_postdata();
75
+
76
+ return $products;
77
+
78
+ }
79
+
80
+ }
classes/widgets/class-pwb-filter-by-brand.php CHANGED
@@ -25,14 +25,15 @@
25
 
26
  public function widget( $args, $instance ) {
27
 
28
- $title = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : __('Brands', 'perfect-woocommerce-brands');
29
- $title = apply_filters( 'widget_title', $title );
 
30
 
31
- echo $args['before_widget'];
32
- if ( ! empty( $title ) )
33
- echo $args['before_title'] . $title . $args['after_title'];
34
- $this->render_widget();
35
- echo $args['after_widget'];
36
 
37
  }
38
 
@@ -105,15 +106,23 @@
105
  $current_url = home_url(add_query_arg(array(),$wp->request));
106
 
107
  if( !empty( $result_brands ) ){
108
- echo '<div class="pwb-filter-products" data-cat-url="'.$cate_url.'">';
109
- echo '<ul>';
110
- foreach( array_unique($result_brands) as $brand ) {
111
- $term = get_term($brand);
112
- echo '<li><label><input type="checkbox" data-brand="'.$brand.'" value="'.$term->slug.'">' . $term->name . '</label></li>';
113
- }
114
- echo '</ul>';
115
- echo '<button>'.__('Apply filter','perfect-woocommerce-brands').'</button>';
116
- echo '</div>';
 
 
 
 
 
 
 
 
117
  }
118
 
119
  }
25
 
26
  public function widget( $args, $instance ) {
27
 
28
+ if( !is_tax('pwb-brand') && !is_product() ){
29
+ $title = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : __('Brands', 'perfect-woocommerce-brands');
30
+ $title = apply_filters( 'widget_title', $title );
31
 
32
+ echo $args['before_widget'];
33
+ if ( ! empty( $title ) ) echo $args['before_title'] . $title . $args['after_title'];
34
+ $this->render_widget();
35
+ echo $args['after_widget'];
36
+ }
37
 
38
  }
39
 
106
  $current_url = home_url(add_query_arg(array(),$wp->request));
107
 
108
  if( !empty( $result_brands ) ){
109
+
110
+ $result_brands = array_unique($result_brands);
111
+ $result_brands_ordered = array();
112
+ foreach( $result_brands as $brand ){
113
+ $brand = get_term($brand);
114
+ $result_brands_ordered[$brand->name] = $brand;
115
+ }
116
+ ksort($result_brands_ordered);
117
+
118
+ $result_brands_ordered = apply_filters( 'pwb_widget_brand_filter', $result_brands_ordered );
119
+
120
+ \Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::render_template(
121
+ 'filter-by-brand',
122
+ 'widgets',
123
+ array( 'cate_url' => $cate_url, 'brands' => $result_brands_ordered )
124
+ );
125
+
126
  }
127
 
128
  }
lang/perfect-woocommerce-brands-es_ES.mo CHANGED
Binary file
lang/perfect-woocommerce-brands-es_ES.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Perfect WooCommerce Brands\n"
4
- "POT-Creation-Date: 2017-10-09 19:47+0200\n"
5
- "PO-Revision-Date: 2017-10-09 19:48+0200\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: es_ES\n"
@@ -10,7 +10,7 @@ msgstr ""
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
13
- "X-Generator: Poedit 2.0.4\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "X-Poedit-WPHeader: main.php\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
@@ -20,130 +20,151 @@ msgstr ""
20
  "X-Poedit-SearchPath-0: .\n"
21
  "X-Poedit-SearchPathExcluded-0: *.js\n"
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  #: classes/admin/class-pwb-admin-tab.php:21
24
- #: classes/class-perfect-woocommerce-brands.php:584
25
- #: classes/class-perfect-woocommerce-brands.php:586
26
- #: classes/widgets/class-pwb-dropdown.php:58
27
  #: classes/widgets/class-pwb-filter-by-brand.php:17
28
- #: classes/widgets/class-pwb-filter-by-brand.php:28
29
  msgid "Brands"
30
  msgstr "Marcas"
31
 
32
- #: classes/admin/class-pwb-admin-tab.php:72
 
 
 
 
33
  msgid "Brands settings"
34
  msgstr "Ajustes de las marcas"
35
 
36
- #: classes/admin/class-pwb-admin-tab.php:78
37
  msgid "Slug"
38
  msgstr "Slug"
39
 
40
- #: classes/admin/class-pwb-admin-tab.php:81
41
  msgid "Brands taxonomy slug"
42
  msgstr "Slug de la taxonomía marcas"
43
 
44
- #: classes/admin/class-pwb-admin-tab.php:86
45
  msgid "Show brand description"
46
  msgstr "Mostrar descripción de la marca"
47
 
48
- #: classes/admin/class-pwb-admin-tab.php:89
49
  msgid "Show brand description (if is set) on brand archive page"
50
  msgstr "Mostrar descripción de la marca en la página de archivo"
51
 
52
- #: classes/admin/class-pwb-admin-tab.php:93
53
  msgid "Single product tab"
54
  msgstr "Tab en la página del producto"
55
 
56
- #: classes/admin/class-pwb-admin-tab.php:96
57
  msgid "Show brand tab in single product page"
58
  msgstr "Mostrar pestaña con información de la marca en la página del producto"
59
 
60
- #: classes/admin/class-pwb-admin-tab.php:100
61
  msgid "Show brands in loop"
62
  msgstr "Mostrar marcas en el loop"
63
 
64
- #: classes/admin/class-pwb-admin-tab.php:103
65
  msgid "Show brand logo (or name) in product loop"
66
  msgstr "Mostrar el logo de la marca (o el nombre) en el loop"
67
 
68
- #: classes/admin/class-pwb-admin-tab.php:106
69
- #: classes/admin/class-pwb-admin-tab.php:119
70
  msgid "No"
71
  msgstr "No"
72
 
73
- #: classes/admin/class-pwb-admin-tab.php:107
74
- #: classes/admin/class-pwb-admin-tab.php:120
75
  msgid "Show brand link"
76
  msgstr "Mostrar el link de la marca"
77
 
78
- #: classes/admin/class-pwb-admin-tab.php:108
79
- #: classes/admin/class-pwb-admin-tab.php:121
80
  msgid "Show brand image (if is set)"
81
  msgstr "Mostrar el logo de la marca (si tiene uno asignado)"
82
 
83
- #: classes/admin/class-pwb-admin-tab.php:112
84
  msgid "Show brands in single product"
85
  msgstr "Mostrar marcas en la página del producto"
86
 
87
- #: classes/admin/class-pwb-admin-tab.php:115
88
  msgid "Show brand logo (or name) in single product"
89
  msgstr "Mostrar el logo de la marca (o el nombre) en la página del producto"
90
 
91
- #: classes/admin/class-pwb-admin-tab.php:125
92
- #: classes/class-perfect-woocommerce-brands.php:364
93
- #: classes/class-perfect-woocommerce-brands.php:392
94
- #: classes/class-perfect-woocommerce-brands.php:462
95
  msgid "Brand logo size"
96
  msgstr "Tamaño del logo de la marca"
97
 
98
- #: classes/admin/class-pwb-admin-tab.php:128
99
  msgid "Brand logo size for single product view"
100
  msgstr "Tamaño del logo para la vista individual de producto"
101
 
102
- #: classes/admin/class-pwb-admin-tab.php:133
103
  msgid "Brand position"
104
  msgstr "Posición de la marca"
105
 
106
- #: classes/admin/class-pwb-admin-tab.php:136
107
  msgid "For single product"
108
  msgstr "En la página individual de cada producto"
109
 
110
- #: classes/admin/class-pwb-admin-tab.php:139
111
  msgid "Before title"
112
  msgstr "Antes del título"
113
 
114
- #: classes/admin/class-pwb-admin-tab.php:140
115
  msgid "After title"
116
  msgstr "Después del título"
117
 
118
- #: classes/admin/class-pwb-admin-tab.php:141
119
  msgid "After price"
120
  msgstr "Después del precio"
121
 
122
- #: classes/admin/class-pwb-admin-tab.php:142
123
  msgid "After excerpt"
124
  msgstr "Después de la descripción corta"
125
 
126
- #: classes/admin/class-pwb-admin-tab.php:143
127
  msgid "After add to cart"
128
  msgstr "Después del botón de comprar"
129
 
130
- #: classes/admin/class-pwb-admin-tab.php:144
131
  msgid "After meta"
132
  msgstr "Después del meta"
133
 
134
- #: classes/admin/class-pwb-admin-tab.php:145
135
  msgid "After sharing"
136
  msgstr "Después de compartir"
137
 
138
- #: classes/admin/class-pwb-admin-tab.php:162
139
  msgid "Tools"
140
  msgstr "Herramientas"
141
 
142
- #: classes/admin/class-pwb-admin-tab.php:168
143
  msgid "Import brands"
144
  msgstr "Importar marcas"
145
 
146
- #: classes/admin/class-pwb-admin-tab.php:172
147
  #, php-format
148
  msgid ""
149
  "Import brands from other brand plugin. <a href=\"%s\" target=\"_blank"
@@ -152,54 +173,54 @@ msgstr ""
152
  "Importar marcas de producto de otro plugin de marcas. <a href=\"%s\" target="
153
  "\"_blank\">Pulsa aquí para ver la documentación</a>"
154
 
155
- #: classes/admin/class-pwb-admin-tab.php:177
156
- #: classes/admin/class-pwb-admin-tab.php:190
157
  msgid "-"
158
  msgstr "-"
159
 
160
- #: classes/admin/class-pwb-admin-tab.php:178
161
  msgid "YITH WooCommerce Brands Add-On"
162
  msgstr "YITH WooCommerce Brands Add-On"
163
 
164
- #: classes/admin/class-pwb-admin-tab.php:179
165
  msgid "Ultimate WooCommerce Brands"
166
  msgstr "Ultimate WooCommerce Brands"
167
 
168
- #: classes/admin/class-pwb-admin-tab.php:180
169
  msgid "Offical WooCommerce Brands"
170
  msgstr "Offical WooCommerce Brands"
171
 
172
- #: classes/admin/class-pwb-admin-tab.php:184
173
  msgid "Dummy data"
174
  msgstr "Datos ficticios"
175
 
176
- #: classes/admin/class-pwb-admin-tab.php:187
177
  msgid "Import generic brands and assign it to products randomly"
178
  msgstr ""
179
  "Importar marcas genéricas y asignarlas a los productos existentes de forma "
180
  "aleatoria"
181
 
182
- #: classes/admin/class-pwb-admin-tab.php:191
183
  msgid "Start import"
184
  msgstr "Comenzar importación"
185
 
186
- #: classes/admin/class-pwb-admin-tab.php:195
187
  msgid "System status"
188
  msgstr "Estado del sistema"
189
 
190
- #: classes/admin/class-pwb-admin-tab.php:197
191
  msgid "Show system status"
192
  msgstr "Ver estado del sistema"
193
 
194
- #: classes/admin/class-pwb-coupon.php:22
195
  msgid "Brands restriction"
196
  msgstr "Restricciones de marca"
197
 
198
- #: classes/admin/class-pwb-coupon.php:23
199
  msgid "Any brand"
200
  msgstr "Cualquier marca"
201
 
202
- #: classes/admin/class-pwb-coupon.php:32
203
  msgid ""
204
  "Coupon will be valid if there are at least one product of this brands in the "
205
  "cart"
@@ -207,7 +228,7 @@ msgstr ""
207
  "El cupón será válido si existe al menos un producto de la marca señalada en "
208
  "el carrito"
209
 
210
- #: classes/class-perfect-woocommerce-brands.php:51
211
  msgid ""
212
  "We know that you´re in love with Perfect WooCommerce Brands, you can help us "
213
  "making it a bit better. Thanks a lot!"
@@ -215,7 +236,7 @@ msgstr ""
215
  "Sabemos que Perfect WooCommerce Brands te encanta, puedes ayudarnos a "
216
  "hacerlo un poco mejor. ¡Muchas gracias!"
217
 
218
- #: classes/class-perfect-woocommerce-brands.php:53
219
  msgid ""
220
  "<a href=\"https://wordpress.org/support/plugin/perfect-woocommerce-brands/"
221
  "reviews/?rate=5#new-post\" target=\"_blank\">Leave a review</a>"
@@ -223,7 +244,7 @@ msgstr ""
223
  "<a href=\"https://wordpress.org/support/plugin/perfect-woocommerce-brands/"
224
  "reviews/?rate=5#new-post\" target=\"_blank\">Dejar una review</a>"
225
 
226
- #: classes/class-perfect-woocommerce-brands.php:54
227
  msgid ""
228
  "<a href=\"https://translate.wordpress.org/projects/wp-plugins/perfect-"
229
  "woocommerce-brands\" target=\"_blank\">Translate the plugin</a>"
@@ -231,7 +252,7 @@ msgstr ""
231
  "<a href=\"https://translate.wordpress.org/projects/wp-plugins/perfect-"
232
  "woocommerce-brands\" target=\"_blank\">Traducir el plugin</a>"
233
 
234
- #: classes/class-perfect-woocommerce-brands.php:55
235
  msgid ""
236
  "<a href=\"https://github.com/titodevera/perfect-woocommerce-brands\" target="
237
  "\"_blank\">View on GitHub</a>"
@@ -239,177 +260,181 @@ msgstr ""
239
  "<a href=\"https://github.com/titodevera/perfect-woocommerce-brands\" target="
240
  "\"_blank\">Ver en GitHub</a>"
241
 
242
- #: classes/class-perfect-woocommerce-brands.php:78
243
  msgid "Settings"
244
  msgstr "Ajustes"
245
 
246
- #: classes/class-perfect-woocommerce-brands.php:261
247
  msgid "PWB Product carousel"
248
  msgstr "PWB Carrusel de productos"
249
 
250
- #: classes/class-perfect-woocommerce-brands.php:262
251
  msgid "Product carousel by brand or by category"
252
  msgstr "Carrusel de productos por marca o categoría"
253
 
254
- #: classes/class-perfect-woocommerce-brands.php:270
255
- #: classes/class-perfect-woocommerce-brands.php:585
256
  #: classes/class-pwb-exporter-support.php:22
257
  #: classes/class-pwb-importer-support.php:22
258
- #: classes/class-pwb-importer-support.php:34
259
  #: classes/class-pwb-product-tab.php:18 classes/class-pwb-product-tab.php:35
260
  msgid "Brand"
261
  msgstr "Marca"
262
 
263
- #: classes/class-perfect-woocommerce-brands.php:278
264
  msgid "Products"
265
  msgstr "Productos"
266
 
267
- #: classes/class-perfect-woocommerce-brands.php:281
268
  msgid "Number of products to load"
269
  msgstr "Número de productos que cargar"
270
 
271
- #: classes/class-perfect-woocommerce-brands.php:286
272
  msgid "Products to show"
273
  msgstr "Productos a mostrar"
274
 
275
- #: classes/class-perfect-woocommerce-brands.php:289
276
  msgid "Number of products to show"
277
  msgstr "Número de productos que mostrar"
278
 
279
- #: classes/class-perfect-woocommerce-brands.php:294
280
  msgid "Products to scroll"
281
  msgstr "Número de productos por scroll"
282
 
283
- #: classes/class-perfect-woocommerce-brands.php:297
284
  msgid "Number of products to scroll"
285
  msgstr "Número de productos por cada scroll"
286
 
287
- #: classes/class-perfect-woocommerce-brands.php:302
288
- #: classes/class-perfect-woocommerce-brands.php:351
289
  msgid "Autoplay"
290
  msgstr "Modo automático"
291
 
292
- #: classes/class-perfect-woocommerce-brands.php:304
293
- #: classes/class-perfect-woocommerce-brands.php:353
294
  msgid "Autoplay carousel"
295
  msgstr "Modo automático para el carrusel"
296
 
297
- #: classes/class-perfect-woocommerce-brands.php:309
298
- #: classes/class-perfect-woocommerce-brands.php:358
299
  msgid "Arrows"
300
  msgstr "Flechas de navegación"
301
 
302
- #: classes/class-perfect-woocommerce-brands.php:311
303
- #: classes/class-perfect-woocommerce-brands.php:360
304
  msgid "Display prev and next arrows"
305
  msgstr "Mostrar flechas de navegación"
306
 
307
- #: classes/class-perfect-woocommerce-brands.php:317
308
  msgid "PWB Brands carousel"
309
  msgstr "PWB Carrusel de marcas"
310
 
311
- #: classes/class-perfect-woocommerce-brands.php:318
312
  msgid "Brands carousel"
313
  msgstr "Carrusel de marcas"
314
 
315
- #: classes/class-perfect-woocommerce-brands.php:327
316
  msgid "Items"
317
  msgstr "Elementos"
318
 
319
- #: classes/class-perfect-woocommerce-brands.php:330
320
- msgid "Number of items to load"
321
- msgstr "Número de elementos que cargar"
322
 
323
- #: classes/class-perfect-woocommerce-brands.php:335
324
  msgid "Items to show"
325
  msgstr "Elementos a mostrar"
326
 
327
- #: classes/class-perfect-woocommerce-brands.php:338
328
  msgid "Number of items to show"
329
  msgstr "Número de elementos a mostrar"
330
 
331
- #: classes/class-perfect-woocommerce-brands.php:343
332
  msgid "Items to scroll"
333
  msgstr "Número de elementos por scroll"
334
 
335
- #: classes/class-perfect-woocommerce-brands.php:346
336
  msgid "Number of items to scroll"
337
  msgstr "Número de elementos por cada scroll"
338
 
339
- #: classes/class-perfect-woocommerce-brands.php:375
340
  msgid "PWB All brands"
341
  msgstr "PWB Todas las marcas"
342
 
343
- #: classes/class-perfect-woocommerce-brands.php:376
344
  msgid "Show all brands"
345
  msgstr "Mostrar todas las marcas"
346
 
347
- #: classes/class-perfect-woocommerce-brands.php:385
348
  msgid "Brands per page"
349
  msgstr "Marcas por página"
350
 
351
- #: classes/class-perfect-woocommerce-brands.php:388
352
  msgid "Show x brands per page"
353
  msgstr "Mostrar x marcas por página"
354
 
355
- #: classes/class-perfect-woocommerce-brands.php:399
356
  msgid "Order by"
357
  msgstr "Ordenar por"
358
 
359
- #: classes/class-perfect-woocommerce-brands.php:413
360
  msgid "Order"
361
  msgstr "Orden"
362
 
363
- #: classes/class-perfect-woocommerce-brands.php:423
364
  msgid "Title position"
365
  msgstr "Posición del título"
366
 
367
- #: classes/class-perfect-woocommerce-brands.php:427
368
  msgid "Before image"
369
  msgstr "Antes de la imagen"
370
 
371
- #: classes/class-perfect-woocommerce-brands.php:428
372
  msgid "After image"
373
  msgstr "Después de la imagen"
374
 
375
- #: classes/class-perfect-woocommerce-brands.php:434
 
 
 
 
376
  msgid "Hide empty"
377
  msgstr "Ocultar vacías"
378
 
379
- #: classes/class-perfect-woocommerce-brands.php:436
380
  msgid "Hide brands that have not been assigned to any product"
381
  msgstr "Ocultar marcas que no han sido asignadas a ningún producto"
382
 
383
- #: classes/class-perfect-woocommerce-brands.php:444
384
  msgid "PWB brand"
385
  msgstr "PWB Marca"
386
 
387
- #: classes/class-perfect-woocommerce-brands.php:445
388
  msgid "Show brand for a specific product"
389
  msgstr "Ver marcas de un producto específico"
390
 
391
- #: classes/class-perfect-woocommerce-brands.php:455
392
  msgid "Product id"
393
  msgstr "Id del producto"
394
 
395
- #: classes/class-perfect-woocommerce-brands.php:458
396
  msgid "Product id (post id)"
397
  msgstr "Id del producto (id del post)"
398
 
399
- #: classes/class-perfect-woocommerce-brands.php:501
400
- #: classes/class-perfect-woocommerce-brands.php:503
401
  #: classes/shortcodes/class-pwb-all-brands.php:90
402
  #: classes/shortcodes/class-pwb-brand.php:29
403
  #: classes/shortcodes/class-pwb-brand.php:31
404
- #: classes/shortcodes/class-pwb-carousel.php:50
405
  msgid "View brand"
406
  msgstr "Ver marca"
407
 
408
- #: classes/class-perfect-woocommerce-brands.php:573
409
  msgid "¿Start migration?"
410
  msgstr "¿Comenzar la migración?"
411
 
412
- #: classes/class-perfect-woocommerce-brands.php:574
413
  msgid ""
414
  "We are migrating the product brands. ¡Don´t close this window until the "
415
  "process is finished!"
@@ -417,11 +442,11 @@ msgstr ""
417
  "Estamos migrando las marcas de producto. ¡No cierres esta ventana hasta que "
418
  "el proceso finalice!"
419
 
420
- #: classes/class-perfect-woocommerce-brands.php:575
421
  msgid "¿Start loading dummy data?"
422
  msgstr "¿Comenzar con la importación?"
423
 
424
- #: classes/class-perfect-woocommerce-brands.php:576
425
  msgid ""
426
  "We are importing the dummy data. ¡Don´t close this window until the process "
427
  "is finished!"
@@ -429,109 +454,101 @@ msgstr ""
429
  "En este momento estamos importando las marcas ficticias. ¡No cierre esta "
430
  "ventana hasta que termine el proceso!"
431
 
432
- #: classes/class-perfect-woocommerce-brands.php:587
433
  msgid "All Brands"
434
  msgstr "Todas las marcas"
435
 
436
- #: classes/class-perfect-woocommerce-brands.php:588
437
  msgid "Edit Brand"
438
  msgstr "Editar marca"
439
 
440
- #: classes/class-perfect-woocommerce-brands.php:589
441
  msgid "View Brand"
442
  msgstr "Ver marca"
443
 
444
- #: classes/class-perfect-woocommerce-brands.php:590
445
  msgid "Update Brand"
446
  msgstr "Actualizar marca"
447
 
448
- #: classes/class-perfect-woocommerce-brands.php:591
449
  msgid "Add New Brand"
450
  msgstr "Añadir nueva marca"
451
 
452
- #: classes/class-perfect-woocommerce-brands.php:592
453
  msgid "New Brand Name"
454
  msgstr "Nuevo nombre de marca"
455
 
456
- #: classes/class-perfect-woocommerce-brands.php:593
457
  msgid "Parent Brand"
458
  msgstr "Marca Padre"
459
 
460
- #: classes/class-perfect-woocommerce-brands.php:594
461
  msgid "Parent Brand:"
462
  msgstr "Marca Padre:"
463
 
464
- #: classes/class-perfect-woocommerce-brands.php:595
465
  msgid "Search Brands"
466
  msgstr "Buscar Marcas"
467
 
468
- #: classes/class-perfect-woocommerce-brands.php:596
469
  msgid "Popular Brands"
470
  msgstr "Marcas Populares"
471
 
472
- #: classes/class-perfect-woocommerce-brands.php:597
473
  msgid "Separate brands with commas"
474
  msgstr "Separar marcas con comas"
475
 
476
- #: classes/class-perfect-woocommerce-brands.php:598
477
  msgid "Add or remove brands"
478
  msgstr "Añadir o eliminar marcas"
479
 
480
- #: classes/class-perfect-woocommerce-brands.php:599
481
  msgid "Choose from the most used brands"
482
  msgstr "Seleccionar de las marcas más utilizadas"
483
 
484
- #: classes/class-perfect-woocommerce-brands.php:600
485
  msgid "No brands found"
486
  msgstr "No se han encontrado marcas"
487
 
488
- #: classes/class-perfect-woocommerce-brands.php:644
489
- #: classes/class-perfect-woocommerce-brands.php:677
490
  #: classes/widgets/class-pwb-list.php:39
491
  msgid "Brand logo"
492
  msgstr "Logo de la marca"
493
 
494
- #: classes/class-perfect-woocommerce-brands.php:646
495
- #: classes/class-perfect-woocommerce-brands.php:652
496
- #: classes/class-perfect-woocommerce-brands.php:681
497
- #: classes/class-perfect-woocommerce-brands.php:701
498
  msgid "Select image"
499
  msgstr "Seleccionar imagen"
500
 
501
- #: classes/class-perfect-woocommerce-brands.php:650
502
- #: classes/class-perfect-woocommerce-brands.php:697
503
  msgid "Brand banner"
504
  msgstr "Banner de la marca"
505
 
506
- #: classes/class-perfect-woocommerce-brands.php:653
507
  msgid "This image will be shown on brand page"
508
  msgstr "Esta imagen se mostrará en la página de la marca"
509
 
510
- #: classes/class-perfect-woocommerce-brands.php:657
511
- #: classes/class-perfect-woocommerce-brands.php:717
512
  msgid "Brand banner link"
513
  msgstr "Enlace para el banner de la marca"
514
 
515
- #: classes/class-perfect-woocommerce-brands.php:659
516
- #: classes/class-perfect-woocommerce-brands.php:721
517
  msgid "This link should be relative to site url. Example: product/product-name"
518
  msgstr ""
519
  "Este enlace ha de ser relativo a la url del sitio web. Ejemplo: producto/"
520
  "nombre-del-producto"
521
 
522
- #: classes/class-perfect-woocommerce-brands.php:775
523
- msgid "Logo"
524
- msgstr "Logo"
525
-
526
- #: classes/class-perfect-woocommerce-brands.php:815
527
  msgid "All"
528
  msgstr "Todas"
529
 
530
- #: classes/class-perfect-woocommerce-brands.php:870
531
- msgid "No products found"
532
- msgstr "No se han encontrado productos"
533
-
534
- #: classes/class-pwb-api-support.php:62
535
  msgid "Product brands"
536
  msgstr "Marcas del producto"
537
 
@@ -567,7 +584,7 @@ msgstr "Desplegable de marcas"
567
  msgid "Title"
568
  msgstr "Título"
569
 
570
- #: classes/widgets/class-pwb-dropdown.php:67
571
  #: classes/widgets/class-pwb-list.php:105
572
  msgid "There is not available brands"
573
  msgstr "No se encuentran marcas disponibles"
@@ -585,10 +602,6 @@ msgstr "Filtrar productos por marca"
585
  msgid "Title:"
586
  msgstr "Título:"
587
 
588
- #: classes/widgets/class-pwb-filter-by-brand.php:115
589
- msgid "Apply filter"
590
- msgstr "Filtrar"
591
-
592
  #: classes/widgets/class-pwb-list.php:10
593
  msgid "Adds a brands list to your site"
594
  msgstr "Añade una lista de marcas a tu sitio"
@@ -613,7 +626,7 @@ msgstr "Columnas:"
613
  msgid "Go to"
614
  msgstr "Ir a"
615
 
616
- #: main.php:102
617
  msgid ""
618
  "Perfect WooCommerce Brands needs WooCommerce to run. Please, install and "
619
  "active WooCommerce plugin."
@@ -621,6 +634,19 @@ msgstr ""
621
  "Perfect WooCommerce Brands necesita WooCommerce para funcionar. Por favor, "
622
  "instala y activa WooCommerce."
623
 
 
 
 
 
 
 
 
 
 
 
 
 
 
624
  #. Plugin Name of the plugin/theme
625
  msgid "Perfect WooCommerce Brands"
626
  msgstr "Perfect WooCommerce Brands"
@@ -645,6 +671,12 @@ msgstr "Alberto de Vera Sevilla"
645
  msgid "https://profiles.wordpress.org/titodevera/"
646
  msgstr "https://profiles.wordpress.org/titodevera/"
647
 
 
 
 
 
 
 
648
  #~ msgid ""
649
  #~ "We are offering you maybe the best WooCommerce brands plugin completely "
650
  #~ "free. You can help us making Perfect WooCommerce Brands a bit better. "
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Perfect WooCommerce Brands\n"
4
+ "POT-Creation-Date: 2018-02-04 14:46+0100\n"
5
+ "PO-Revision-Date: 2018-02-04 14:49+0100\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: es_ES\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
13
+ "X-Generator: Poedit 2.0.6\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "X-Poedit-WPHeader: main.php\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
20
  "X-Poedit-SearchPath-0: .\n"
21
  "X-Poedit-SearchPathExcluded-0: *.js\n"
22
 
23
+ #: classes/admin/class-edit-brands-page.php:39
24
+ msgid "featured"
25
+ msgstr "favorita"
26
+
27
+ #: classes/admin/class-edit-brands-page.php:74
28
+ msgid "Logo"
29
+ msgstr "Logo"
30
+
31
+ #: classes/admin/class-edit-brands-page.php:96
32
+ msgid "Set as featured"
33
+ msgstr "Marcar como favorita"
34
+
35
+ #: classes/admin/class-edit-brands-page.php:118
36
+ msgid "Error!"
37
+ msgstr "Error!"
38
+
39
+ #: classes/admin/class-edit-brands-page.php:128
40
  #: classes/admin/class-pwb-admin-tab.php:21
41
+ #: classes/class-perfect-woocommerce-brands.php:588
42
+ #: classes/class-perfect-woocommerce-brands.php:590
43
+ #: classes/widgets/class-pwb-dropdown.php:59
44
  #: classes/widgets/class-pwb-filter-by-brand.php:17
45
+ #: classes/widgets/class-pwb-filter-by-brand.php:29
46
  msgid "Brands"
47
  msgstr "Marcas"
48
 
49
+ #: classes/admin/class-edit-brands-page.php:131
50
+ msgid "Show featured brands first"
51
+ msgstr "Mostrar marcas favoritas primero"
52
+
53
+ #: classes/admin/class-pwb-admin-tab.php:73
54
  msgid "Brands settings"
55
  msgstr "Ajustes de las marcas"
56
 
57
+ #: classes/admin/class-pwb-admin-tab.php:79
58
  msgid "Slug"
59
  msgstr "Slug"
60
 
61
+ #: classes/admin/class-pwb-admin-tab.php:82
62
  msgid "Brands taxonomy slug"
63
  msgstr "Slug de la taxonomía marcas"
64
 
65
+ #: classes/admin/class-pwb-admin-tab.php:87
66
  msgid "Show brand description"
67
  msgstr "Mostrar descripción de la marca"
68
 
69
+ #: classes/admin/class-pwb-admin-tab.php:90
70
  msgid "Show brand description (if is set) on brand archive page"
71
  msgstr "Mostrar descripción de la marca en la página de archivo"
72
 
73
+ #: classes/admin/class-pwb-admin-tab.php:94
74
  msgid "Single product tab"
75
  msgstr "Tab en la página del producto"
76
 
77
+ #: classes/admin/class-pwb-admin-tab.php:97
78
  msgid "Show brand tab in single product page"
79
  msgstr "Mostrar pestaña con información de la marca en la página del producto"
80
 
81
+ #: classes/admin/class-pwb-admin-tab.php:101
82
  msgid "Show brands in loop"
83
  msgstr "Mostrar marcas en el loop"
84
 
85
+ #: classes/admin/class-pwb-admin-tab.php:104
86
  msgid "Show brand logo (or name) in product loop"
87
  msgstr "Mostrar el logo de la marca (o el nombre) en el loop"
88
 
89
+ #: classes/admin/class-pwb-admin-tab.php:107
90
+ #: classes/admin/class-pwb-admin-tab.php:120
91
  msgid "No"
92
  msgstr "No"
93
 
94
+ #: classes/admin/class-pwb-admin-tab.php:108
95
+ #: classes/admin/class-pwb-admin-tab.php:121
96
  msgid "Show brand link"
97
  msgstr "Mostrar el link de la marca"
98
 
99
+ #: classes/admin/class-pwb-admin-tab.php:109
100
+ #: classes/admin/class-pwb-admin-tab.php:122
101
  msgid "Show brand image (if is set)"
102
  msgstr "Mostrar el logo de la marca (si tiene uno asignado)"
103
 
104
+ #: classes/admin/class-pwb-admin-tab.php:113
105
  msgid "Show brands in single product"
106
  msgstr "Mostrar marcas en la página del producto"
107
 
108
+ #: classes/admin/class-pwb-admin-tab.php:116
109
  msgid "Show brand logo (or name) in single product"
110
  msgstr "Mostrar el logo de la marca (o el nombre) en la página del producto"
111
 
112
+ #: classes/admin/class-pwb-admin-tab.php:126
113
+ #: classes/class-perfect-woocommerce-brands.php:367
114
+ #: classes/class-perfect-woocommerce-brands.php:395
115
+ #: classes/class-perfect-woocommerce-brands.php:466
116
  msgid "Brand logo size"
117
  msgstr "Tamaño del logo de la marca"
118
 
119
+ #: classes/admin/class-pwb-admin-tab.php:129
120
  msgid "Brand logo size for single product view"
121
  msgstr "Tamaño del logo para la vista individual de producto"
122
 
123
+ #: classes/admin/class-pwb-admin-tab.php:134
124
  msgid "Brand position"
125
  msgstr "Posición de la marca"
126
 
127
+ #: classes/admin/class-pwb-admin-tab.php:137
128
  msgid "For single product"
129
  msgstr "En la página individual de cada producto"
130
 
131
+ #: classes/admin/class-pwb-admin-tab.php:140
132
  msgid "Before title"
133
  msgstr "Antes del título"
134
 
135
+ #: classes/admin/class-pwb-admin-tab.php:141
136
  msgid "After title"
137
  msgstr "Después del título"
138
 
139
+ #: classes/admin/class-pwb-admin-tab.php:142
140
  msgid "After price"
141
  msgstr "Después del precio"
142
 
143
+ #: classes/admin/class-pwb-admin-tab.php:143
144
  msgid "After excerpt"
145
  msgstr "Después de la descripción corta"
146
 
147
+ #: classes/admin/class-pwb-admin-tab.php:144
148
  msgid "After add to cart"
149
  msgstr "Después del botón de comprar"
150
 
151
+ #: classes/admin/class-pwb-admin-tab.php:145
152
  msgid "After meta"
153
  msgstr "Después del meta"
154
 
155
+ #: classes/admin/class-pwb-admin-tab.php:146
156
  msgid "After sharing"
157
  msgstr "Después de compartir"
158
 
159
+ #: classes/admin/class-pwb-admin-tab.php:163
160
  msgid "Tools"
161
  msgstr "Herramientas"
162
 
163
+ #: classes/admin/class-pwb-admin-tab.php:169
164
  msgid "Import brands"
165
  msgstr "Importar marcas"
166
 
167
+ #: classes/admin/class-pwb-admin-tab.php:173
168
  #, php-format
169
  msgid ""
170
  "Import brands from other brand plugin. <a href=\"%s\" target=\"_blank"
173
  "Importar marcas de producto de otro plugin de marcas. <a href=\"%s\" target="
174
  "\"_blank\">Pulsa aquí para ver la documentación</a>"
175
 
176
+ #: classes/admin/class-pwb-admin-tab.php:178
177
+ #: classes/admin/class-pwb-admin-tab.php:191
178
  msgid "-"
179
  msgstr "-"
180
 
181
+ #: classes/admin/class-pwb-admin-tab.php:179
182
  msgid "YITH WooCommerce Brands Add-On"
183
  msgstr "YITH WooCommerce Brands Add-On"
184
 
185
+ #: classes/admin/class-pwb-admin-tab.php:180
186
  msgid "Ultimate WooCommerce Brands"
187
  msgstr "Ultimate WooCommerce Brands"
188
 
189
+ #: classes/admin/class-pwb-admin-tab.php:181
190
  msgid "Offical WooCommerce Brands"
191
  msgstr "Offical WooCommerce Brands"
192
 
193
+ #: classes/admin/class-pwb-admin-tab.php:185
194
  msgid "Dummy data"
195
  msgstr "Datos ficticios"
196
 
197
+ #: classes/admin/class-pwb-admin-tab.php:188
198
  msgid "Import generic brands and assign it to products randomly"
199
  msgstr ""
200
  "Importar marcas genéricas y asignarlas a los productos existentes de forma "
201
  "aleatoria"
202
 
203
+ #: classes/admin/class-pwb-admin-tab.php:192
204
  msgid "Start import"
205
  msgstr "Comenzar importación"
206
 
207
+ #: classes/admin/class-pwb-admin-tab.php:196
208
  msgid "System status"
209
  msgstr "Estado del sistema"
210
 
211
+ #: classes/admin/class-pwb-admin-tab.php:198
212
  msgid "Show system status"
213
  msgstr "Ver estado del sistema"
214
 
215
+ #: classes/admin/class-pwb-coupon.php:24
216
  msgid "Brands restriction"
217
  msgstr "Restricciones de marca"
218
 
219
+ #: classes/admin/class-pwb-coupon.php:25
220
  msgid "Any brand"
221
  msgstr "Cualquier marca"
222
 
223
+ #: classes/admin/class-pwb-coupon.php:34
224
  msgid ""
225
  "Coupon will be valid if there are at least one product of this brands in the "
226
  "cart"
228
  "El cupón será válido si existe al menos un producto de la marca señalada en "
229
  "el carrito"
230
 
231
+ #: classes/class-perfect-woocommerce-brands.php:54
232
  msgid ""
233
  "We know that you´re in love with Perfect WooCommerce Brands, you can help us "
234
  "making it a bit better. Thanks a lot!"
236
  "Sabemos que Perfect WooCommerce Brands te encanta, puedes ayudarnos a "
237
  "hacerlo un poco mejor. ¡Muchas gracias!"
238
 
239
+ #: classes/class-perfect-woocommerce-brands.php:56
240
  msgid ""
241
  "<a href=\"https://wordpress.org/support/plugin/perfect-woocommerce-brands/"
242
  "reviews/?rate=5#new-post\" target=\"_blank\">Leave a review</a>"
244
  "<a href=\"https://wordpress.org/support/plugin/perfect-woocommerce-brands/"
245
  "reviews/?rate=5#new-post\" target=\"_blank\">Dejar una review</a>"
246
 
247
+ #: classes/class-perfect-woocommerce-brands.php:57
248
  msgid ""
249
  "<a href=\"https://translate.wordpress.org/projects/wp-plugins/perfect-"
250
  "woocommerce-brands\" target=\"_blank\">Translate the plugin</a>"
252
  "<a href=\"https://translate.wordpress.org/projects/wp-plugins/perfect-"
253
  "woocommerce-brands\" target=\"_blank\">Traducir el plugin</a>"
254
 
255
+ #: classes/class-perfect-woocommerce-brands.php:58
256
  msgid ""
257
  "<a href=\"https://github.com/titodevera/perfect-woocommerce-brands\" target="
258
  "\"_blank\">View on GitHub</a>"
260
  "<a href=\"https://github.com/titodevera/perfect-woocommerce-brands\" target="
261
  "\"_blank\">Ver en GitHub</a>"
262
 
263
+ #: classes/class-perfect-woocommerce-brands.php:81
264
  msgid "Settings"
265
  msgstr "Ajustes"
266
 
267
+ #: classes/class-perfect-woocommerce-brands.php:264
268
  msgid "PWB Product carousel"
269
  msgstr "PWB Carrusel de productos"
270
 
271
+ #: classes/class-perfect-woocommerce-brands.php:265
272
  msgid "Product carousel by brand or by category"
273
  msgstr "Carrusel de productos por marca o categoría"
274
 
275
+ #: classes/class-perfect-woocommerce-brands.php:273
276
+ #: classes/class-perfect-woocommerce-brands.php:589
277
  #: classes/class-pwb-exporter-support.php:22
278
  #: classes/class-pwb-importer-support.php:22
279
+ #: classes/class-pwb-importer-support.php:33
280
  #: classes/class-pwb-product-tab.php:18 classes/class-pwb-product-tab.php:35
281
  msgid "Brand"
282
  msgstr "Marca"
283
 
284
+ #: classes/class-perfect-woocommerce-brands.php:281
285
  msgid "Products"
286
  msgstr "Productos"
287
 
288
+ #: classes/class-perfect-woocommerce-brands.php:284
289
  msgid "Number of products to load"
290
  msgstr "Número de productos que cargar"
291
 
292
+ #: classes/class-perfect-woocommerce-brands.php:289
293
  msgid "Products to show"
294
  msgstr "Productos a mostrar"
295
 
296
+ #: classes/class-perfect-woocommerce-brands.php:292
297
  msgid "Number of products to show"
298
  msgstr "Número de productos que mostrar"
299
 
300
+ #: classes/class-perfect-woocommerce-brands.php:297
301
  msgid "Products to scroll"
302
  msgstr "Número de productos por scroll"
303
 
304
+ #: classes/class-perfect-woocommerce-brands.php:300
305
  msgid "Number of products to scroll"
306
  msgstr "Número de productos por cada scroll"
307
 
308
+ #: classes/class-perfect-woocommerce-brands.php:305
309
+ #: classes/class-perfect-woocommerce-brands.php:354
310
  msgid "Autoplay"
311
  msgstr "Modo automático"
312
 
313
+ #: classes/class-perfect-woocommerce-brands.php:307
314
+ #: classes/class-perfect-woocommerce-brands.php:356
315
  msgid "Autoplay carousel"
316
  msgstr "Modo automático para el carrusel"
317
 
318
+ #: classes/class-perfect-woocommerce-brands.php:312
319
+ #: classes/class-perfect-woocommerce-brands.php:361
320
  msgid "Arrows"
321
  msgstr "Flechas de navegación"
322
 
323
+ #: classes/class-perfect-woocommerce-brands.php:314
324
+ #: classes/class-perfect-woocommerce-brands.php:363
325
  msgid "Display prev and next arrows"
326
  msgstr "Mostrar flechas de navegación"
327
 
328
+ #: classes/class-perfect-woocommerce-brands.php:320
329
  msgid "PWB Brands carousel"
330
  msgstr "PWB Carrusel de marcas"
331
 
332
+ #: classes/class-perfect-woocommerce-brands.php:321
333
  msgid "Brands carousel"
334
  msgstr "Carrusel de marcas"
335
 
336
+ #: classes/class-perfect-woocommerce-brands.php:330
337
  msgid "Items"
338
  msgstr "Elementos"
339
 
340
+ #: classes/class-perfect-woocommerce-brands.php:333
341
+ msgid "Number of items to load (or 'featured')"
342
+ msgstr "Número de elementos a cargar (o 'featured')"
343
 
344
+ #: classes/class-perfect-woocommerce-brands.php:338
345
  msgid "Items to show"
346
  msgstr "Elementos a mostrar"
347
 
348
+ #: classes/class-perfect-woocommerce-brands.php:341
349
  msgid "Number of items to show"
350
  msgstr "Número de elementos a mostrar"
351
 
352
+ #: classes/class-perfect-woocommerce-brands.php:346
353
  msgid "Items to scroll"
354
  msgstr "Número de elementos por scroll"
355
 
356
+ #: classes/class-perfect-woocommerce-brands.php:349
357
  msgid "Number of items to scroll"
358
  msgstr "Número de elementos por cada scroll"
359
 
360
+ #: classes/class-perfect-woocommerce-brands.php:378
361
  msgid "PWB All brands"
362
  msgstr "PWB Todas las marcas"
363
 
364
+ #: classes/class-perfect-woocommerce-brands.php:379
365
  msgid "Show all brands"
366
  msgstr "Mostrar todas las marcas"
367
 
368
+ #: classes/class-perfect-woocommerce-brands.php:388
369
  msgid "Brands per page"
370
  msgstr "Marcas por página"
371
 
372
+ #: classes/class-perfect-woocommerce-brands.php:391
373
  msgid "Show x brands per page"
374
  msgstr "Mostrar x marcas por página"
375
 
376
+ #: classes/class-perfect-woocommerce-brands.php:402
377
  msgid "Order by"
378
  msgstr "Ordenar por"
379
 
380
+ #: classes/class-perfect-woocommerce-brands.php:416
381
  msgid "Order"
382
  msgstr "Orden"
383
 
384
+ #: classes/class-perfect-woocommerce-brands.php:426
385
  msgid "Title position"
386
  msgstr "Posición del título"
387
 
388
+ #: classes/class-perfect-woocommerce-brands.php:430
389
  msgid "Before image"
390
  msgstr "Antes de la imagen"
391
 
392
+ #: classes/class-perfect-woocommerce-brands.php:431
393
  msgid "After image"
394
  msgstr "Después de la imagen"
395
 
396
+ #: classes/class-perfect-woocommerce-brands.php:432
397
+ msgid "Hide"
398
+ msgstr "Ocultar"
399
+
400
+ #: classes/class-perfect-woocommerce-brands.php:438
401
  msgid "Hide empty"
402
  msgstr "Ocultar vacías"
403
 
404
+ #: classes/class-perfect-woocommerce-brands.php:440
405
  msgid "Hide brands that have not been assigned to any product"
406
  msgstr "Ocultar marcas que no han sido asignadas a ningún producto"
407
 
408
+ #: classes/class-perfect-woocommerce-brands.php:448
409
  msgid "PWB brand"
410
  msgstr "PWB Marca"
411
 
412
+ #: classes/class-perfect-woocommerce-brands.php:449
413
  msgid "Show brand for a specific product"
414
  msgstr "Ver marcas de un producto específico"
415
 
416
+ #: classes/class-perfect-woocommerce-brands.php:459
417
  msgid "Product id"
418
  msgstr "Id del producto"
419
 
420
+ #: classes/class-perfect-woocommerce-brands.php:462
421
  msgid "Product id (post id)"
422
  msgstr "Id del producto (id del post)"
423
 
424
+ #: classes/class-perfect-woocommerce-brands.php:505
425
+ #: classes/class-perfect-woocommerce-brands.php:507
426
  #: classes/shortcodes/class-pwb-all-brands.php:90
427
  #: classes/shortcodes/class-pwb-brand.php:29
428
  #: classes/shortcodes/class-pwb-brand.php:31
429
+ #: templates/shortcodes/carousel.php:18
430
  msgid "View brand"
431
  msgstr "Ver marca"
432
 
433
+ #: classes/class-perfect-woocommerce-brands.php:577
434
  msgid "¿Start migration?"
435
  msgstr "¿Comenzar la migración?"
436
 
437
+ #: classes/class-perfect-woocommerce-brands.php:578
438
  msgid ""
439
  "We are migrating the product brands. ¡Don´t close this window until the "
440
  "process is finished!"
442
  "Estamos migrando las marcas de producto. ¡No cierres esta ventana hasta que "
443
  "el proceso finalice!"
444
 
445
+ #: classes/class-perfect-woocommerce-brands.php:579
446
  msgid "¿Start loading dummy data?"
447
  msgstr "¿Comenzar con la importación?"
448
 
449
+ #: classes/class-perfect-woocommerce-brands.php:580
450
  msgid ""
451
  "We are importing the dummy data. ¡Don´t close this window until the process "
452
  "is finished!"
454
  "En este momento estamos importando las marcas ficticias. ¡No cierre esta "
455
  "ventana hasta que termine el proceso!"
456
 
457
+ #: classes/class-perfect-woocommerce-brands.php:591
458
  msgid "All Brands"
459
  msgstr "Todas las marcas"
460
 
461
+ #: classes/class-perfect-woocommerce-brands.php:592
462
  msgid "Edit Brand"
463
  msgstr "Editar marca"
464
 
465
+ #: classes/class-perfect-woocommerce-brands.php:593
466
  msgid "View Brand"
467
  msgstr "Ver marca"
468
 
469
+ #: classes/class-perfect-woocommerce-brands.php:594
470
  msgid "Update Brand"
471
  msgstr "Actualizar marca"
472
 
473
+ #: classes/class-perfect-woocommerce-brands.php:595
474
  msgid "Add New Brand"
475
  msgstr "Añadir nueva marca"
476
 
477
+ #: classes/class-perfect-woocommerce-brands.php:596
478
  msgid "New Brand Name"
479
  msgstr "Nuevo nombre de marca"
480
 
481
+ #: classes/class-perfect-woocommerce-brands.php:597
482
  msgid "Parent Brand"
483
  msgstr "Marca Padre"
484
 
485
+ #: classes/class-perfect-woocommerce-brands.php:598
486
  msgid "Parent Brand:"
487
  msgstr "Marca Padre:"
488
 
489
+ #: classes/class-perfect-woocommerce-brands.php:599
490
  msgid "Search Brands"
491
  msgstr "Buscar Marcas"
492
 
493
+ #: classes/class-perfect-woocommerce-brands.php:600
494
  msgid "Popular Brands"
495
  msgstr "Marcas Populares"
496
 
497
+ #: classes/class-perfect-woocommerce-brands.php:601
498
  msgid "Separate brands with commas"
499
  msgstr "Separar marcas con comas"
500
 
501
+ #: classes/class-perfect-woocommerce-brands.php:602
502
  msgid "Add or remove brands"
503
  msgstr "Añadir o eliminar marcas"
504
 
505
+ #: classes/class-perfect-woocommerce-brands.php:603
506
  msgid "Choose from the most used brands"
507
  msgstr "Seleccionar de las marcas más utilizadas"
508
 
509
+ #: classes/class-perfect-woocommerce-brands.php:604
510
  msgid "No brands found"
511
  msgstr "No se han encontrado marcas"
512
 
513
+ #: classes/class-perfect-woocommerce-brands.php:648
514
+ #: classes/class-perfect-woocommerce-brands.php:681
515
  #: classes/widgets/class-pwb-list.php:39
516
  msgid "Brand logo"
517
  msgstr "Logo de la marca"
518
 
519
+ #: classes/class-perfect-woocommerce-brands.php:650
520
+ #: classes/class-perfect-woocommerce-brands.php:656
521
+ #: classes/class-perfect-woocommerce-brands.php:685
522
+ #: classes/class-perfect-woocommerce-brands.php:705
523
  msgid "Select image"
524
  msgstr "Seleccionar imagen"
525
 
526
+ #: classes/class-perfect-woocommerce-brands.php:654
527
+ #: classes/class-perfect-woocommerce-brands.php:701
528
  msgid "Brand banner"
529
  msgstr "Banner de la marca"
530
 
531
+ #: classes/class-perfect-woocommerce-brands.php:657
532
  msgid "This image will be shown on brand page"
533
  msgstr "Esta imagen se mostrará en la página de la marca"
534
 
535
+ #: classes/class-perfect-woocommerce-brands.php:661
536
+ #: classes/class-perfect-woocommerce-brands.php:721
537
  msgid "Brand banner link"
538
  msgstr "Enlace para el banner de la marca"
539
 
540
+ #: classes/class-perfect-woocommerce-brands.php:663
541
+ #: classes/class-perfect-woocommerce-brands.php:725
542
  msgid "This link should be relative to site url. Example: product/product-name"
543
  msgstr ""
544
  "Este enlace ha de ser relativo a la url del sitio web. Ejemplo: producto/"
545
  "nombre-del-producto"
546
 
547
+ #: classes/class-perfect-woocommerce-brands.php:794
 
 
 
 
548
  msgid "All"
549
  msgstr "Todas"
550
 
551
+ #: classes/class-pwb-api-support.php:90
 
 
 
 
552
  msgid "Product brands"
553
  msgstr "Marcas del producto"
554
 
584
  msgid "Title"
585
  msgstr "Título"
586
 
587
+ #: classes/widgets/class-pwb-dropdown.php:68
588
  #: classes/widgets/class-pwb-list.php:105
589
  msgid "There is not available brands"
590
  msgstr "No se encuentran marcas disponibles"
602
  msgid "Title:"
603
  msgstr "Título:"
604
 
 
 
 
 
605
  #: classes/widgets/class-pwb-list.php:10
606
  msgid "Adds a brands list to your site"
607
  msgstr "Añade una lista de marcas a tu sitio"
626
  msgid "Go to"
627
  msgstr "Ir a"
628
 
629
+ #: main.php:103
630
  msgid ""
631
  "Perfect WooCommerce Brands needs WooCommerce to run. Please, install and "
632
  "active WooCommerce plugin."
634
  "Perfect WooCommerce Brands necesita WooCommerce para funcionar. Por favor, "
635
  "instala y activa WooCommerce."
636
 
637
+ #: templates/shortcodes/carousel.php:24
638
+ #: templates/shortcodes/product-carousel.php:28
639
+ msgid "Loading"
640
+ msgstr "Cargando"
641
+
642
+ #: templates/shortcodes/product-carousel.php:34
643
+ msgid "Nothing found"
644
+ msgstr "Aquí no hay nada"
645
+
646
+ #: templates/widgets/filter-by-brand.php:24
647
+ msgid "Apply filter"
648
+ msgstr "Filtrar"
649
+
650
  #. Plugin Name of the plugin/theme
651
  msgid "Perfect WooCommerce Brands"
652
  msgstr "Perfect WooCommerce Brands"
671
  msgid "https://profiles.wordpress.org/titodevera/"
672
  msgstr "https://profiles.wordpress.org/titodevera/"
673
 
674
+ #~ msgid "Number of items to load"
675
+ #~ msgstr "Número de elementos que cargar"
676
+
677
+ #~ msgid "No products found"
678
+ #~ msgstr "No se han encontrado productos"
679
+
680
  #~ msgid ""
681
  #~ "We are offering you maybe the best WooCommerce brands plugin completely "
682
  #~ "free. You can help us making Perfect WooCommerce Brands a bit better. "
main.php CHANGED
@@ -1,31 +1,30 @@
1
  <?php
2
- /*
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.6.0
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
-
13
- Perfect WooCommerce Brands version 1.6.0, Copyright (C) 2016 Alberto de Vera Sevilla
14
-
15
- Perfect WooCommerce Brands is free software: you can redistribute it and/or modify
16
- it under the terms of the GNU General Public License as published by
17
- the Free Software Foundation, either version 3 of the License, or
18
- (at your option) any later version.
19
-
20
- Perfect WooCommerce Brands is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with Perfect WooCommerce Brands. If not, see <http://www.gnu.org/licenses/>.
27
-
28
- */
29
 
30
  namespace Perfect_Woocommerce_Brands;
31
 
@@ -35,7 +34,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
35
  define( 'PWB_PLUGIN', plugins_url( '', __FILE__ ) );
36
  define( 'PWB_PLUGIN_PATH', plugin_basename( dirname( __FILE__ ) ) );
37
  define( 'PWB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
38
- define( 'PWB_PLUGIN_VERSION', '1.6.0' );
39
  define( 'PWB_WP_VERSION', get_bloginfo( 'version' ) );
40
  define( 'PWB_WC_VERSION', get_option( 'woocommerce_version' ) );
41
 
@@ -81,6 +80,8 @@ if( is_plugin_active( 'woocommerce/woocommerce.php' ) ){
81
  new Admin\PWB_Migrate();
82
  require 'classes/admin/class-pwb-dummy-data.php';
83
  new Admin\PWB_Dummy_Data();
 
 
84
 
85
  if( defined('PWB_WC_VERSION') && version_compare( PWB_WC_VERSION, '3.1.0', '>=' ) ){
86
  require 'classes/class-pwb-importer-support.php';
1
  <?php
2
+ /**
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.6.1
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.6.1, Copyright (C) 2016 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
16
+ * (at your option) any later version.
17
+ *
18
+ * Perfect WooCommerce Brands is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * GNU General Public License for more details.
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with Perfect WooCommerce Brands. If not, see <http://www.gnu.org/licenses/>.
24
+ *
25
+ * WC requires at least: 2.4
26
+ * WC tested up to: 3.3
27
+ */
 
28
 
29
  namespace Perfect_Woocommerce_Brands;
30
 
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.6.1' );
38
  define( 'PWB_WP_VERSION', get_bloginfo( 'version' ) );
39
  define( 'PWB_WC_VERSION', get_option( 'woocommerce_version' ) );
40
 
80
  new Admin\PWB_Migrate();
81
  require 'classes/admin/class-pwb-dummy-data.php';
82
  new Admin\PWB_Dummy_Data();
83
+ require 'classes/admin/class-edit-brands-page.php';
84
+ new Admin\Edit_Brands_Page();
85
 
86
  if( defined('PWB_WC_VERSION') && version_compare( PWB_WC_VERSION, '3.1.0', '>=' ) ){
87
  require 'classes/class-pwb-importer-support.php';
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.4
6
  Tested up to: 4.9
7
- Stable tag: 1.6.0
8
  License: GPL3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.en.html
10
 
@@ -43,6 +43,7 @@ With this extension you can add product brands to your WooCommerce site.
43
  > * WooCommerce REST API support
44
  > * WooCommerce built-in product importer/exporter support (WooCommerce 3.1.0+)
45
  > * Brand tab for single product page
 
46
  > * And much more!
47
 
48
 
@@ -77,6 +78,16 @@ Go to `WooCommerce/Settings/` and click on `Brands` tab
77
 
78
 
79
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
80
  = 1.6.0 =
81
  * Feature: Migrate brands from the official WooCommerce Brand's plugin (pull request, thanks Chunkford)
82
  * Feature: Support for the new WooCommerce product importer/exporter
4
  Tags: woocommerce, brands, brand taxonomy, product brands, woocommerce manufacturer, woocommerce supplier, e-commerce
5
  Requires at least: 4.4
6
  Tested up to: 4.9
7
+ Stable tag: 1.6.1
8
  License: GPL3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.en.html
10
 
43
  > * WooCommerce REST API support
44
  > * WooCommerce built-in product importer/exporter support (WooCommerce 3.1.0+)
45
  > * Brand tab for single product page
46
+ > * Favorite brands
47
  > * And much more!
48
 
49
 
78
 
79
 
80
  == Changelog ==
81
+ = 1.6.1 =
82
+ * Feature: Favorite brands
83
+ * Fix: Brand logo full size option for single product
84
+ * Fix: Coupons brands restriction (thanks @josk79)
85
+ * Fix: Import products fixes
86
+ * Fix: PHP7 warning on 'class-perfect-woocommerce-brands.php'
87
+ * Fix: Brand not added when Duplicating Product
88
+ * Enhancement: Filter by brand widget enhancements
89
+ * Enhancement: Carousels enhancements
90
+ * Enhancement: JS and CSS minified
91
  = 1.6.0 =
92
  * Feature: Migrate brands from the official WooCommerce Brand's plugin (pull request, thanks Chunkford)
93
  * Feature: Support for the new WooCommerce product importer/exporter
templates/admin/edit-brands-bottom.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template for displaying the edit-tags.php table footer
4
+ * @version 1.0.0
5
+ */
6
+
7
+ namespace Perfect_Woocommerce_Brands\Templates;
8
+
9
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
10
+
11
+ extract( $data );
12
+ ?>
13
+
14
+ <div class="pwb-edit-brands-bottom pwb-clearfix">
15
+ <span class="dashicons dashicons-admin-collapse"></span>
16
+ <p class="pwb-featured-count">
17
+ <span><?php echo $data['featured_count'];?></span> <?php echo $data['text_featured'];?>
18
+ </p>
19
+ </div>
templates/shortcodes/carousel.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template for displaying the carousels
4
+ * @version 1.0.0
5
+ */
6
+
7
+ namespace Perfect_Woocommerce_Brands\Templates;
8
+
9
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
10
+
11
+ extract( $data );
12
+ ?>
13
+
14
+ <div class="pwb-carousel" data-slick="<?php echo $slick_settings; ?>">
15
+
16
+ <?php foreach( $brands as $brand ): ?>
17
+ <div class="slick-slide">
18
+ <a href="<?php echo $brand['link'];?>" title="<?php _e( 'View brand', 'perfect-woocommerce-brands' ); ?>">
19
+ <?php echo $brand['attachment_html'];?>
20
+ </a>
21
+ </div>
22
+ <?php endforeach; ?>
23
+
24
+ <div class="pwb-carousel-loader"><?php _e('Loading','perfect-woocommerce-brands');?>...</div>
25
+
26
+ </div>
templates/shortcodes/product-carousel.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template for displaying the product carousels
4
+ * @version 1.0.0
5
+ */
6
+
7
+ namespace Perfect_Woocommerce_Brands\Templates;
8
+
9
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
10
+
11
+ extract( $data );
12
+ ?>
13
+
14
+ <?php if( !empty( $products ) ): ?>
15
+
16
+ <div class="pwb-product-carousel" data-slick="<?php echo $slick_settings; ?>">
17
+
18
+ <?php foreach( $products as $product ): ?>
19
+ <div class="slick-slide">
20
+ <a href="<?php echo $product['permalink']; ?>">
21
+ <?php echo $product['thumbnail']; ?>
22
+ <h3><?php echo $product['title']; ?></h3>
23
+ <?php echo do_shortcode('[add_to_cart id="'.$product['id'].'" style=""]'); ?>
24
+ </a>
25
+ </div>
26
+ <?php endforeach; ?>
27
+
28
+ <div class="pwb-carousel-loader"><?php _e('Loading','perfect-woocommerce-brands');?>...</div>
29
+
30
+ </div>
31
+
32
+ <?php else: ?>
33
+
34
+ <div><?php _e('Nothing found');?></div>
35
+
36
+ <?php endif; ?>
templates/widgets/filter-by-brand.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template for displaying filter by brand widget
4
+ * @version 1.0.0
5
+ */
6
+
7
+ namespace Perfect_Woocommerce_Brands\Templates;
8
+
9
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
10
+
11
+ extract( $data );
12
+ ?>
13
+
14
+ <div class="pwb-filter-products" data-cat-url="<?php echo $cate_url;?>">
15
+ <ul>
16
+ <?php foreach( $brands as $brand ): ?>
17
+ <li>
18
+ <label>
19
+ <input type="checkbox" data-brand="<?php echo $brand->term_id;?>" value="<?php echo $brand->slug;?>"><?php echo $brand->name; ?>
20
+ </label>
21
+ </li>
22
+ <?php endforeach; ?>
23
+ </ul>
24
+ <button><?php _e('Apply filter','perfect-woocommerce-brands') ?></button>
25
+ </div>