Version Description
- Fix: Hidden products contribute towards product count for "pwb-all-brands" shortcode
- Enhancement: Replace hardcoded thumbnail size for product loops with selected size (thanks @orjhor)
- Feature: Redirect if the search matches with a brand name. Better product search experience.
- Feature: Add the possibility to filter by product category on product carousel shortcode (thanks @lasdou)
- Dev: New filter hook "pwb_html_before_brands_links"
- Tested on WooCommerce 3.9
Download this release
Release Info
Developer | titodevera |
Plugin | Perfect Brands for WooCommerce |
Version | 1.7.8 |
Comparing to | |
See all releases |
Code changes from version 1.7.7 to 1.7.8
- assets/css/styles-frontend.css +72 -75
- assets/css/styles-frontend.min.css +1 -1
- classes/admin/class-pwb-admin-tab.php +0 -1
- classes/class-perfect-woocommerce-brands.php +30 -6
- classes/class-pwb-product-tab.php +2 -1
- classes/shortcodes/class-pwb-all-brands.php +48 -5
- classes/shortcodes/class-pwb-product-carousel.php +13 -0
- lang/perfect-woocommerce-brands-ca.po +0 -4
- lang/perfect-woocommerce-brands-es_ES.po +0 -4
- lang/perfect-woocommerce-brands.pot +0 -4
- main.php +4 -4
- readme.txt +9 -2
assets/css/styles-frontend.css
CHANGED
@@ -19,46 +19,43 @@
|
|
19 |
.pwb-carousel .pwb-slick-slide a > img{
|
20 |
margin: 0 auto;
|
21 |
}
|
22 |
-
.pwb-carousel .slick-loading .slick-list, .pwb-product-carousel .slick-loading .slick-list{
|
23 |
-
background: #fff url('./ajax-loader.gif') center center no-repeat;
|
24 |
-
}
|
25 |
.pwb-carousel .pwb-slick-slide, .pwb-product-carousel .pwb-slick-slide{
|
26 |
-
|
27 |
}
|
28 |
.pwb-carousel .slick-prev, .pwb-carousel .slick-next,
|
29 |
.pwb-product-carousel .slick-prev, .pwb-product-carousel .slick-next{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
}
|
51 |
.pwb-carousel .slick-prev > span, .pwb-carousel .slick-next > span,
|
52 |
.pwb-product-carousel .slick-prev > span, .pwb-product-carousel .slick-next > span{
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
}
|
63 |
.pwb-carousel .slick-prev:hover,
|
64 |
.pwb-carousel .slick-prev:focus,
|
@@ -68,17 +65,17 @@
|
|
68 |
.pwb-product-carousel .slick-prev:focus,
|
69 |
.pwb-product-carousel .slick-next:hover,
|
70 |
.pwb-product-carousel .slick-next:focus{
|
71 |
-
|
72 |
}
|
73 |
.pwb-carousel .slick-prev, .pwb-product-carousel .slick-prev{
|
74 |
-
|
75 |
}
|
76 |
.pwb-carousel .slick-next, .pwb-product-carousel .slick-next{
|
77 |
-
|
78 |
}
|
79 |
.pwb-carousel:hover .slick-next,.pwb-carousel:hover .slick-prev,
|
80 |
.pwb-product-carousel:hover .slick-next,.pwb-product-carousel:hover .slick-prev{
|
81 |
-
|
82 |
}
|
83 |
.pwb-product-carousel .pwb-amount{
|
84 |
display: block;
|
@@ -190,33 +187,33 @@
|
|
190 |
margin-right: -15px;
|
191 |
}
|
192 |
.pwb-all-brands .pwb-pagination-wrapper{
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
}
|
198 |
.pwb-all-brands .pwb-pagination{
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
}
|
206 |
.pwb-all-brands .pwb-brands-cols-outer:after{
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
}
|
211 |
.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3{
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
}
|
216 |
.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3 > p:first-child{
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
}
|
221 |
/* ----------------------- /PWB All Brands ----------------------- */
|
222 |
|
@@ -314,29 +311,29 @@
|
|
314 |
|
315 |
/* ----------------------- Responsive ----------------------- */
|
316 |
@media screen and (max-width: 1000px) {
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
}
|
321 |
@media screen and (max-width: 700px) {
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
}
|
329 |
@media screen and (max-width: 480px) {
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
}
|
341 |
|
342 |
@media (min-width: 576px) {
|
19 |
.pwb-carousel .pwb-slick-slide a > img{
|
20 |
margin: 0 auto;
|
21 |
}
|
|
|
|
|
|
|
22 |
.pwb-carousel .pwb-slick-slide, .pwb-product-carousel .pwb-slick-slide{
|
23 |
+
margin: 0 10px;
|
24 |
}
|
25 |
.pwb-carousel .slick-prev, .pwb-carousel .slick-next,
|
26 |
.pwb-product-carousel .slick-prev, .pwb-product-carousel .slick-next{
|
27 |
+
font-size: 0;
|
28 |
+
position: absolute;
|
29 |
+
top: 0;
|
30 |
+
bottom: 0;
|
31 |
+
display: block;
|
32 |
+
cursor: pointer;
|
33 |
+
font-size: 22px;
|
34 |
+
width: 30px;
|
35 |
+
overflow: hidden;
|
36 |
+
text-align: center;
|
37 |
+
color: #aeaeae;
|
38 |
+
border: none;
|
39 |
+
outline: none;
|
40 |
+
z-index: 999;
|
41 |
+
background: #eee;
|
42 |
+
opacity: 0;
|
43 |
+
transition: opacity 0.3s ease-in-out;
|
44 |
+
-webkit-transition: opacity 0.3s ease-in-out;
|
45 |
+
-moz-transition: opacity 0.3s ease-in-out;
|
46 |
+
-o-transition: opacity 0.3s ease-in-out;
|
47 |
}
|
48 |
.pwb-carousel .slick-prev > span, .pwb-carousel .slick-next > span,
|
49 |
.pwb-product-carousel .slick-prev > span, .pwb-product-carousel .slick-next > span{
|
50 |
+
display: inline-block;
|
51 |
+
height: 20px;
|
52 |
+
width: 20px;
|
53 |
+
padding: 10px;
|
54 |
+
position: absolute;
|
55 |
+
top: 50%;
|
56 |
+
margin-top: -20px;
|
57 |
+
left: 0;
|
58 |
+
right: 0;
|
59 |
}
|
60 |
.pwb-carousel .slick-prev:hover,
|
61 |
.pwb-carousel .slick-prev:focus,
|
65 |
.pwb-product-carousel .slick-prev:focus,
|
66 |
.pwb-product-carousel .slick-next:hover,
|
67 |
.pwb-product-carousel .slick-next:focus{
|
68 |
+
outline: none;
|
69 |
}
|
70 |
.pwb-carousel .slick-prev, .pwb-product-carousel .slick-prev{
|
71 |
+
left: 0;
|
72 |
}
|
73 |
.pwb-carousel .slick-next, .pwb-product-carousel .slick-next{
|
74 |
+
right: 0;
|
75 |
}
|
76 |
.pwb-carousel:hover .slick-next,.pwb-carousel:hover .slick-prev,
|
77 |
.pwb-product-carousel:hover .slick-next,.pwb-product-carousel:hover .slick-prev{
|
78 |
+
opacity: 0.8;
|
79 |
}
|
80 |
.pwb-product-carousel .pwb-amount{
|
81 |
display: block;
|
187 |
margin-right: -15px;
|
188 |
}
|
189 |
.pwb-all-brands .pwb-pagination-wrapper{
|
190 |
+
margin-top: 20px;
|
191 |
+
padding-top: 10px;
|
192 |
+
border-top: 1px solid #ededed;
|
193 |
+
text-align: right;
|
194 |
}
|
195 |
.pwb-all-brands .pwb-pagination{
|
196 |
+
display: inline-block;
|
197 |
+
margin-right: 10px;
|
198 |
+
background-color: #ededed;
|
199 |
+
color: #333;
|
200 |
+
text-align: center;
|
201 |
+
padding: 10px;
|
202 |
}
|
203 |
.pwb-all-brands .pwb-brands-cols-outer:after{
|
204 |
+
content: "";
|
205 |
+
display: table;
|
206 |
+
clear: both;
|
207 |
}
|
208 |
.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3{
|
209 |
+
padding: 0 15px;
|
210 |
+
width: 20%;
|
211 |
+
float: left;
|
212 |
}
|
213 |
.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3 > p:first-child{
|
214 |
+
height: 25px;
|
215 |
+
overflow: hidden;
|
216 |
+
font-size: 14px;
|
217 |
}
|
218 |
/* ----------------------- /PWB All Brands ----------------------- */
|
219 |
|
311 |
|
312 |
/* ----------------------- Responsive ----------------------- */
|
313 |
@media screen and (max-width: 1000px) {
|
314 |
+
.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3{
|
315 |
+
width: 25%;
|
316 |
+
}
|
317 |
}
|
318 |
@media screen and (max-width: 700px) {
|
319 |
+
.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3{
|
320 |
+
width: 50%;
|
321 |
+
}
|
322 |
+
.pwb-columns-5, .pwb-columns-6{
|
323 |
+
width: 25%;
|
324 |
+
}
|
325 |
}
|
326 |
@media screen and (max-width: 480px) {
|
327 |
+
.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3{
|
328 |
+
width: 100%;
|
329 |
+
float: none;
|
330 |
+
}
|
331 |
+
.pwb-all-brands .pwb-brands-cols-outer .pwb-brands-col3 > p:first-child{
|
332 |
+
height: auto;
|
333 |
+
}
|
334 |
+
.pwb-columns-3, .pwb-columns-4, .pwb-columns-5, .pwb-columns-6{
|
335 |
+
width: 50%;
|
336 |
+
}
|
337 |
}
|
338 |
|
339 |
@media (min-width: 576px) {
|
assets/css/styles-frontend.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.pwb-clearfix:after{content:"";display:table;clear:both}.pwb-before-loop{margin-bottom:1em}.pwb-after-loop{margin-top:1em}.pwb-carousel .pwb-slick-slide a{display:block}.pwb-carousel .pwb-slick-slide a>img{margin:0 auto}.pwb-carousel .
|
1 |
+
.pwb-clearfix:after{content:"";display:table;clear:both}.pwb-before-loop{margin-bottom:1em}.pwb-after-loop{margin-top:1em}.pwb-carousel .pwb-slick-slide a{display:block}.pwb-carousel .pwb-slick-slide a>img{margin:0 auto}.pwb-carousel .pwb-slick-slide,.pwb-product-carousel .pwb-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 .pwb-slick-slide,.pwb-product-carousel .pwb-slick-slide{display:none}.pwb-carousel.slick-initialized .pwb-slick-slide,.pwb-product-carousel.slick-initialized .pwb-slick-slide{display:block}.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-az-listing-row{margin-bottom:20px}.pwb-az-listing-row-in{margin-left:-5px;margin-right:-5px}.pwb-az-listing-col{padding:5px}.pwb-az-listing-col>a{display:block;text-transform:uppercase;white-space:nowrap;overflow:hidden}.pwb-az-listing-title{border-bottom:1px solid #ddd;font-weight:bold;font-size:115%;text-transform:uppercase}.pwb-az-listing-header{margin-bottom:30px}.pwb-az-listing-header ul{margin:0;padding:0;list-style:none;margin-right:-2px;margin-left:-2px}.pwb-az-listing-header li{display:inline-block;float:left;width:25px;height:25px;margin:2px;line-height:25px;border:1px solid #ddd;text-align:center}.pwb-az-listing-header a{text-transform:uppercase}.pwb-filter-products input[type="checkbox"]{margin-right:10px}.pwb-filter-products li{margin-bottom:5px}.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-5{width:20%}.pwb-columns-6{width:16.66666%}.pwb-columns{float:left}.pwb-single-product-brands{padding-top:1em}.pwb-text-before-brands-links{margin-right:10px}@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%}.pwb-columns-5,.pwb-columns-6{width:25%}}@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,.pwb-columns-5,.pwb-columns-6{width:50%}}@media(min-width:576px){.pwb-az-listing-col{width:50%;float:left}}@media(min-width:992px){.pwb-az-listing-col{width:25%}}
|
classes/admin/class-pwb-admin-tab.php
CHANGED
@@ -146,7 +146,6 @@
|
|
146 |
'name' => __( 'Brand logo size', 'perfect-woocommerce-brands' ),
|
147 |
'type' => 'select',
|
148 |
'class' => 'pwb-admin-tab-field',
|
149 |
-
'desc' => __( 'Brand logo size for single product view', 'perfect-woocommerce-brands' ),
|
150 |
'id' => 'wc_pwb_admin_tab_brand_logo_size',
|
151 |
'options' => $available_image_sizes_adapted
|
152 |
),
|
146 |
'name' => __( 'Brand logo size', 'perfect-woocommerce-brands' ),
|
147 |
'type' => 'select',
|
148 |
'class' => 'pwb-admin-tab-field',
|
|
|
149 |
'id' => 'wc_pwb_admin_tab_brand_logo_size',
|
150 |
'options' => $available_image_sizes_adapted
|
151 |
),
|
classes/class-perfect-woocommerce-brands.php
CHANGED
@@ -39,6 +39,7 @@ class Perfect_Woocommerce_Brands{
|
|
39 |
add_filter( 'manage_edit-product_sortable_columns', array( $this, 'brands_column_sortable' ), 90 );
|
40 |
add_action( 'posts_clauses', array( $this, 'brands_column_sortable_posts' ), 10, 2 );
|
41 |
add_filter( 'post_type_link', array( $this, 'brand_name_in_url' ), 10, 2 );
|
|
|
42 |
}
|
43 |
|
44 |
/**
|
@@ -253,6 +254,7 @@ class Perfect_Woocommerce_Brands{
|
|
253 |
public function show_brands_in_loop(){
|
254 |
|
255 |
$brands_in_loop = get_option('wc_pwb_admin_tab_brands_in_loop');
|
|
|
256 |
|
257 |
if( $brands_in_loop == 'brand_link' || $brands_in_loop == 'brand_image' ){
|
258 |
|
@@ -267,7 +269,7 @@ class Perfect_Woocommerce_Brands{
|
|
267 |
$brand_link = get_term_link ( $brand->term_id, 'pwb-brand' );
|
268 |
$attachment_id = get_term_meta( $brand->term_id, 'pwb_brand_image', 1 );
|
269 |
|
270 |
-
$attachment_html = wp_get_attachment_image( $attachment_id,
|
271 |
if( !empty($attachment_html) && $brands_in_loop == 'brand_image' ){
|
272 |
echo '<a href="'.$brand_link.'">'.$attachment_html.'</a>';
|
273 |
}else{
|
@@ -617,10 +619,11 @@ class Perfect_Woocommerce_Brands{
|
|
617 |
|
618 |
echo '<div class="pwb-single-product-brands pwb-clearfix">';
|
619 |
|
620 |
-
if( $show_as == 'brand_link' ){
|
621 |
-
|
622 |
-
|
623 |
-
|
|
|
624 |
}
|
625 |
|
626 |
foreach( $brands as $brand ){
|
@@ -628,7 +631,7 @@ class Perfect_Woocommerce_Brands{
|
|
628 |
$attachment_id = get_term_meta( $brand->term_id, 'pwb_brand_image', 1 );
|
629 |
|
630 |
$image_size = 'thumbnail';
|
631 |
-
$image_size_selected = get_option('wc_pwb_admin_tab_brand_logo_size');
|
632 |
if($image_size_selected!=false){
|
633 |
$image_size = $image_size_selected;
|
634 |
}
|
@@ -913,4 +916,25 @@ class Perfect_Woocommerce_Brands{
|
|
913 |
return $crumbs;
|
914 |
}
|
915 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
916 |
}
|
39 |
add_filter( 'manage_edit-product_sortable_columns', array( $this, 'brands_column_sortable' ), 90 );
|
40 |
add_action( 'posts_clauses', array( $this, 'brands_column_sortable_posts' ), 10, 2 );
|
41 |
add_filter( 'post_type_link', array( $this, 'brand_name_in_url' ), 10, 2 );
|
42 |
+
add_action( 'pre_get_posts', array( $this, 'search_by_brand_name' ) );
|
43 |
}
|
44 |
|
45 |
/**
|
254 |
public function show_brands_in_loop(){
|
255 |
|
256 |
$brands_in_loop = get_option('wc_pwb_admin_tab_brands_in_loop');
|
257 |
+
$image_size_selected = get_option('wc_pwb_admin_tab_brand_logo_size', 'thumbnail');
|
258 |
|
259 |
if( $brands_in_loop == 'brand_link' || $brands_in_loop == 'brand_image' ){
|
260 |
|
269 |
$brand_link = get_term_link ( $brand->term_id, 'pwb-brand' );
|
270 |
$attachment_id = get_term_meta( $brand->term_id, 'pwb_brand_image', 1 );
|
271 |
|
272 |
+
$attachment_html = wp_get_attachment_image( $attachment_id, $image_size_selected );
|
273 |
if( !empty($attachment_html) && $brands_in_loop == 'brand_image' ){
|
274 |
echo '<a href="'.$brand_link.'">'.$attachment_html.'</a>';
|
275 |
}else{
|
619 |
|
620 |
echo '<div class="pwb-single-product-brands pwb-clearfix">';
|
621 |
|
622 |
+
if ( $show_as == 'brand_link' ) {
|
623 |
+
$before_brands_links = '<span class="pwb-text-before-brands-links">';
|
624 |
+
$before_brands_links.= apply_filters( 'pwb_text_before_brands_links', __('Brands', 'perfect-woocommerce-brands') );
|
625 |
+
$before_brands_links.= ':</span>';
|
626 |
+
echo apply_filters( 'pwb_html_before_brands_links', $before_brands_links );
|
627 |
}
|
628 |
|
629 |
foreach( $brands as $brand ){
|
631 |
$attachment_id = get_term_meta( $brand->term_id, 'pwb_brand_image', 1 );
|
632 |
|
633 |
$image_size = 'thumbnail';
|
634 |
+
$image_size_selected = get_option('wc_pwb_admin_tab_brand_logo_size', 'thumbnail');
|
635 |
if($image_size_selected!=false){
|
636 |
$image_size = $image_size_selected;
|
637 |
}
|
916 |
return $crumbs;
|
917 |
}
|
918 |
|
919 |
+
/**
|
920 |
+
* Redirect if the search matchs with a brands name
|
921 |
+
* Better search experience
|
922 |
+
*/
|
923 |
+
public function search_by_brand_name( $query ) {
|
924 |
+
|
925 |
+
if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) {
|
926 |
+
|
927 |
+
$brands = get_terms( array( 'taxonomy' => 'pwb-brand', 'fields' => 'id=>name' ) );
|
928 |
+
|
929 |
+
if ( $match = array_search( strtolower( trim( $query->get('s') ) ), array_map('strtolower', $brands ) ) ) {
|
930 |
+
|
931 |
+
wp_redirect( get_term_link( $match ) );
|
932 |
+
exit;
|
933 |
+
|
934 |
+
}
|
935 |
+
|
936 |
+
}
|
937 |
+
|
938 |
+
}
|
939 |
+
|
940 |
}
|
classes/class-pwb-product-tab.php
CHANGED
@@ -45,8 +45,9 @@ class PWB_Product_Tab{
|
|
45 |
<?php foreach( $brands as $brand ): ?>
|
46 |
|
47 |
<?php
|
|
|
48 |
$brand_logo = get_term_meta( $brand->term_id, 'pwb_brand_image', true );
|
49 |
-
$brand_logo = wp_get_attachment_image( $brand_logo, apply_filters( 'pwb_product_tab_brand_logo_size',
|
50 |
?>
|
51 |
|
52 |
<div id="tab-pwb_tab-content">
|
45 |
<?php foreach( $brands as $brand ): ?>
|
46 |
|
47 |
<?php
|
48 |
+
$image_size = get_option('wc_pwb_admin_tab_brand_logo_size', 'thumbnail');
|
49 |
$brand_logo = get_term_meta( $brand->term_id, 'pwb_brand_image', true );
|
50 |
+
$brand_logo = wp_get_attachment_image( $brand_logo, apply_filters( 'pwb_product_tab_brand_logo_size', $image_size ) );
|
51 |
?>
|
52 |
|
53 |
<div id="tab-pwb_tab-content">
|
classes/shortcodes/class-pwb-all-brands.php
CHANGED
@@ -28,6 +28,19 @@ class PWB_All_Brands_Shortcode{
|
|
28 |
$brands = \Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::get_brands( $hide_empty, $atts['order_by'], $atts['order'] );
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
?>
|
32 |
<div class="pwb-all-brands">
|
33 |
<?php static::pagination( $brands, $atts['per_page'], $atts['image_size'], $atts['title_position'] );?>
|
@@ -37,6 +50,35 @@ class PWB_All_Brands_Shortcode{
|
|
37 |
return ob_get_clean();
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
public static function pagination( $display_array, $show_per_page, $image_size, $title_position ) {
|
41 |
$page = 1;
|
42 |
|
@@ -62,15 +104,16 @@ class PWB_All_Brands_Shortcode{
|
|
62 |
?>
|
63 |
<div class="pwb-brands-cols-outer">
|
64 |
<?php
|
65 |
-
foreach($outArray as $brand){
|
66 |
-
|
|
|
67 |
$brand_name = $brand->name;
|
68 |
$brand_link = get_term_link($brand_id);
|
69 |
|
70 |
$attachment_id = get_term_meta( $brand_id, 'pwb_brand_image', 1 );
|
71 |
$attachment_html = $brand_name;
|
72 |
if($attachment_id!=''){
|
73 |
-
$attachment_html = wp_get_attachment_image($attachment_id
|
74 |
}
|
75 |
|
76 |
?>
|
@@ -79,7 +122,7 @@ class PWB_All_Brands_Shortcode{
|
|
79 |
<?php if( $title_position != 'none' && $title_position != 'after' ): ?>
|
80 |
<p>
|
81 |
<a href="<?php echo $brand_link;?>"><?php echo $brand_name;?></a>
|
82 |
-
<small>(<?php echo $brand->
|
83 |
</p>
|
84 |
<?php endif; ?>
|
85 |
|
@@ -90,7 +133,7 @@ class PWB_All_Brands_Shortcode{
|
|
90 |
<?php if( $title_position != 'none' && $title_position == 'after' ): ?>
|
91 |
<p>
|
92 |
<a href="<?php echo $brand_link;?>"><?php echo $brand_name;?></a>
|
93 |
-
<small>(<?php echo $brand->
|
94 |
</p>
|
95 |
<?php endif; ?>
|
96 |
|
28 |
$brands = \Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::get_brands( $hide_empty, $atts['order_by'], $atts['order'] );
|
29 |
}
|
30 |
|
31 |
+
//remove residual empty brands
|
32 |
+
foreach ( $brands as $key => $brand ) {
|
33 |
+
|
34 |
+
$count = self::count_visible_products( $brand->term_id );
|
35 |
+
|
36 |
+
if ( ! $count && $hide_empty ){
|
37 |
+
unset( $brands[$key] );
|
38 |
+
} else {
|
39 |
+
$brands[$key]->count_pwb = $count;
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
?>
|
45 |
<div class="pwb-all-brands">
|
46 |
<?php static::pagination( $brands, $atts['per_page'], $atts['image_size'], $atts['title_position'] );?>
|
50 |
return ob_get_clean();
|
51 |
}
|
52 |
|
53 |
+
/**
|
54 |
+
* WP_Term->count property don´t care about hidden products
|
55 |
+
* Counts the products in a specific brand
|
56 |
+
*/
|
57 |
+
public static function count_visible_products( $brand_id ) {
|
58 |
+
|
59 |
+
$args = array(
|
60 |
+
'posts_per_page' => -1,
|
61 |
+
'post_type' => 'product',
|
62 |
+
'tax_query' => array(
|
63 |
+
array(
|
64 |
+
'taxonomy' => 'pwb-brand',
|
65 |
+
'field' => 'ID',
|
66 |
+
'terms' => $brand_id
|
67 |
+
),
|
68 |
+
array(
|
69 |
+
'taxonomy' => 'product_visibility',
|
70 |
+
'field' => 'name',
|
71 |
+
'terms' => 'exclude-from-catalog',
|
72 |
+
'operator' => 'NOT IN',
|
73 |
+
)
|
74 |
+
)
|
75 |
+
);
|
76 |
+
$wc_query = new \WP_Query($args);
|
77 |
+
|
78 |
+
return $wc_query->found_posts;
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
public static function pagination( $display_array, $show_per_page, $image_size, $title_position ) {
|
83 |
$page = 1;
|
84 |
|
104 |
?>
|
105 |
<div class="pwb-brands-cols-outer">
|
106 |
<?php
|
107 |
+
foreach( $outArray as $brand ) {
|
108 |
+
|
109 |
+
$brand_id = $brand->term_id;
|
110 |
$brand_name = $brand->name;
|
111 |
$brand_link = get_term_link($brand_id);
|
112 |
|
113 |
$attachment_id = get_term_meta( $brand_id, 'pwb_brand_image', 1 );
|
114 |
$attachment_html = $brand_name;
|
115 |
if($attachment_id!=''){
|
116 |
+
$attachment_html = wp_get_attachment_image( $attachment_id, $image_size );
|
117 |
}
|
118 |
|
119 |
?>
|
122 |
<?php if( $title_position != 'none' && $title_position != 'after' ): ?>
|
123 |
<p>
|
124 |
<a href="<?php echo $brand_link;?>"><?php echo $brand_name;?></a>
|
125 |
+
<small>(<?php echo $brand->count_pwb;?>)</small>
|
126 |
</p>
|
127 |
<?php endif; ?>
|
128 |
|
133 |
<?php if( $title_position != 'none' && $title_position == 'after' ): ?>
|
134 |
<p>
|
135 |
<a href="<?php echo $brand_link;?>"><?php echo $brand_name;?></a>
|
136 |
+
<small>(<?php echo $brand->count_pwb;?>)</small>
|
137 |
</p>
|
138 |
<?php endif; ?>
|
139 |
|
classes/shortcodes/class-pwb-product-carousel.php
CHANGED
@@ -11,6 +11,7 @@ class PWB_Product_Carousel_Shortcode{
|
|
11 |
|
12 |
self::$atts = shortcode_atts( array(
|
13 |
'brand' => "all",
|
|
|
14 |
'products' => "10",
|
15 |
'products_to_show' => "5",
|
16 |
'products_to_scroll' => "1",
|
@@ -62,6 +63,18 @@ class PWB_Product_Carousel_Shortcode{
|
|
62 |
)
|
63 |
);
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
$loop = new \WP_Query( $args );
|
67 |
if( $loop->have_posts() ) {
|
11 |
|
12 |
self::$atts = shortcode_atts( array(
|
13 |
'brand' => "all",
|
14 |
+
'category' => "all",
|
15 |
'products' => "10",
|
16 |
'products_to_show' => "5",
|
17 |
'products_to_scroll' => "1",
|
63 |
)
|
64 |
);
|
65 |
}
|
66 |
+
if( self::$atts['category'] != 'all'){
|
67 |
+
$woo_category_query = array(
|
68 |
+
'taxonomy' => 'product_cat',
|
69 |
+
'field' => 'slug',
|
70 |
+
'terms' => self::$atts['category']
|
71 |
+
);
|
72 |
+
if(isset($args['tax_query']) && is_array($args['tax_query'])) {
|
73 |
+
$args['tax_query'][] = $woo_category_query;
|
74 |
+
} else {
|
75 |
+
$args['tax_query'] = array($woo_category_query);
|
76 |
+
}
|
77 |
+
}
|
78 |
|
79 |
$loop = new \WP_Query( $args );
|
80 |
if( $loop->have_posts() ) {
|
lang/perfect-woocommerce-brands-ca.po
CHANGED
@@ -484,10 +484,6 @@ msgstr "Mostrar marques a la pàgina del producte"
|
|
484 |
msgid "Show brand logo (or name) in single product"
|
485 |
msgstr "Mostrar el logo de la marca (o el nom) a la pàgina del producte"
|
486 |
|
487 |
-
#: classes/admin/class-pwb-admin-tab.php:132
|
488 |
-
msgid "Brand logo size for single product view"
|
489 |
-
msgstr "Mida del logo per a la vista individual de producte"
|
490 |
-
|
491 |
#: classes/admin/class-pwb-admin-tab.php:137
|
492 |
msgid "Brand position"
|
493 |
msgstr "Posició de la marca"
|
484 |
msgid "Show brand logo (or name) in single product"
|
485 |
msgstr "Mostrar el logo de la marca (o el nom) a la pàgina del producte"
|
486 |
|
|
|
|
|
|
|
|
|
487 |
#: classes/admin/class-pwb-admin-tab.php:137
|
488 |
msgid "Brand position"
|
489 |
msgstr "Posició de la marca"
|
lang/perfect-woocommerce-brands-es_ES.po
CHANGED
@@ -484,10 +484,6 @@ msgstr "Mostrar marcas en la página del producto"
|
|
484 |
msgid "Show brand logo (or name) in single product"
|
485 |
msgstr "Mostrar el logo de la marca (o el nombre) en la página del producto"
|
486 |
|
487 |
-
#: classes/admin/class-pwb-admin-tab.php:132
|
488 |
-
msgid "Brand logo size for single product view"
|
489 |
-
msgstr "Tamaño del logo para la vista individual de producto"
|
490 |
-
|
491 |
#: classes/admin/class-pwb-admin-tab.php:137
|
492 |
msgid "Brand position"
|
493 |
msgstr "Posición de la marca"
|
484 |
msgid "Show brand logo (or name) in single product"
|
485 |
msgstr "Mostrar el logo de la marca (o el nombre) en la página del producto"
|
486 |
|
|
|
|
|
|
|
|
|
487 |
#: classes/admin/class-pwb-admin-tab.php:137
|
488 |
msgid "Brand position"
|
489 |
msgstr "Posición de la marca"
|
lang/perfect-woocommerce-brands.pot
CHANGED
@@ -465,10 +465,6 @@ msgstr ""
|
|
465 |
msgid "Show brand logo (or name) in single product"
|
466 |
msgstr ""
|
467 |
|
468 |
-
#: classes/admin/class-pwb-admin-tab.php:132
|
469 |
-
msgid "Brand logo size for single product view"
|
470 |
-
msgstr ""
|
471 |
-
|
472 |
#: classes/admin/class-pwb-admin-tab.php:137
|
473 |
msgid "Brand position"
|
474 |
msgstr ""
|
465 |
msgid "Show brand logo (or name) in single product"
|
466 |
msgstr ""
|
467 |
|
|
|
|
|
|
|
|
|
468 |
#: classes/admin/class-pwb-admin-tab.php:137
|
469 |
msgid "Brand position"
|
470 |
msgstr ""
|
main.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
* Plugin Name: Perfect WooCommerce Brands
|
4 |
* Plugin URI: https://wordpress.org/plugins/perfect-woocommerce-brands/
|
5 |
* Description: Perfect WooCommerce Brands allows you to show product brands in your WooCommerce based store.
|
6 |
-
* Version: 1.7.
|
7 |
* Author: Alberto de Vera Sevilla
|
8 |
* Author URI: https://profiles.wordpress.org/titodevera/
|
9 |
* Text Domain: perfect-woocommerce-brands
|
10 |
* Domain Path: /lang
|
11 |
* License: GPL3
|
12 |
-
* Perfect WooCommerce Brands version 1.7.
|
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
|
@@ -23,7 +23,7 @@
|
|
23 |
* along with Perfect WooCommerce Brands. If not, see <http://www.gnu.org/licenses/>.
|
24 |
*
|
25 |
* WC requires at least: 3.1.0
|
26 |
-
* WC tested up to: 3.
|
27 |
*/
|
28 |
|
29 |
namespace Perfect_Woocommerce_Brands;
|
@@ -34,7 +34,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|
34 |
define( 'PWB_PLUGIN', plugins_url( '', __FILE__ ) );
|
35 |
define( 'PWB_PLUGIN_PATH', plugin_basename( dirname( __FILE__ ) ) );
|
36 |
define( 'PWB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
37 |
-
define( 'PWB_PLUGIN_VERSION', '1.7.
|
38 |
define( 'PWB_WP_VERSION', get_bloginfo( 'version' ) );
|
39 |
define( 'PWB_WC_VERSION', get_option( 'woocommerce_version' ) );
|
40 |
|
3 |
* Plugin Name: Perfect WooCommerce Brands
|
4 |
* Plugin URI: https://wordpress.org/plugins/perfect-woocommerce-brands/
|
5 |
* Description: Perfect WooCommerce Brands allows you to show product brands in your WooCommerce based store.
|
6 |
+
* Version: 1.7.8
|
7 |
* Author: Alberto de Vera Sevilla
|
8 |
* Author URI: https://profiles.wordpress.org/titodevera/
|
9 |
* Text Domain: perfect-woocommerce-brands
|
10 |
* Domain Path: /lang
|
11 |
* License: GPL3
|
12 |
+
* Perfect WooCommerce Brands version 1.7.8, Copyright (C) 2019 Alberto de Vera Sevilla
|
13 |
* Perfect WooCommerce Brands is free software: you can redistribute it and/or modify
|
14 |
* it under the terms of the GNU General Public License as published by
|
15 |
* the Free Software Foundation, either version 3 of the License, or
|
23 |
* along with Perfect WooCommerce Brands. If not, see <http://www.gnu.org/licenses/>.
|
24 |
*
|
25 |
* WC requires at least: 3.1.0
|
26 |
+
* WC tested up to: 3.9
|
27 |
*/
|
28 |
|
29 |
namespace Perfect_Woocommerce_Brands;
|
34 |
define( 'PWB_PLUGIN', plugins_url( '', __FILE__ ) );
|
35 |
define( 'PWB_PLUGIN_PATH', plugin_basename( dirname( __FILE__ ) ) );
|
36 |
define( 'PWB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
37 |
+
define( 'PWB_PLUGIN_VERSION', '1.7.8' );
|
38 |
define( 'PWB_WP_VERSION', get_bloginfo( 'version' ) );
|
39 |
define( 'PWB_WC_VERSION', get_option( 'woocommerce_version' ) );
|
40 |
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: titodevera
|
|
3 |
Donate link: mailto:hola@albertodevera.es
|
4 |
Tags: woocommerce, brands, brand taxonomy, product brands, woocommerce manufacturer, woocommerce supplier, e-commerce
|
5 |
Requires at least: 4.7
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 1.7.
|
9 |
License: GPL3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.en.html
|
11 |
|
@@ -81,6 +81,13 @@ You can also contribute [translating the plugin](https://translate.wordpress.org
|
|
81 |
|
82 |
|
83 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
= 1.7.7 =
|
85 |
* Enhancement: Better support for special characters in "AZ-Listing" shortcode
|
86 |
* Fix: Filter by brand widget shows incorrect brands under certain conditions
|
3 |
Donate link: mailto:hola@albertodevera.es
|
4 |
Tags: woocommerce, brands, brand taxonomy, product brands, woocommerce manufacturer, woocommerce supplier, e-commerce
|
5 |
Requires at least: 4.7
|
6 |
+
Tested up to: 5.3
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 1.7.8
|
9 |
License: GPL3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.en.html
|
11 |
|
81 |
|
82 |
|
83 |
== Changelog ==
|
84 |
+
= 1.7.8 =
|
85 |
+
* Fix: Hidden products contribute towards product count for "pwb-all-brands" shortcode
|
86 |
+
* Enhancement: Replace hardcoded thumbnail size for product loops with selected size (thanks @orjhor)
|
87 |
+
* Feature: Redirect if the search matches with a brand name. Better product search experience.
|
88 |
+
* Feature: Add the possibility to filter by product category on product carousel shortcode (thanks @lasdou)
|
89 |
+
* Dev: New filter hook "pwb_html_before_brands_links"
|
90 |
+
* Tested on WooCommerce 3.9
|
91 |
= 1.7.7 =
|
92 |
* Enhancement: Better support for special characters in "AZ-Listing" shortcode
|
93 |
* Fix: Filter by brand widget shows incorrect brands under certain conditions
|