Version Description
Download this release
Release Info
Code changes from version 1.7.3 to 1.7.4
- assets/css/woolentor-widgets.css +200 -0
- classes/class.product_query.php +111 -0
- classes/class.widgets_control.php +1 -0
- includes/addons/wl_product_filter.php +1032 -0
- includes/admin/include/admin-setting.php +8 -0
- includes/base.php +1 -0
- includes/helper-function.php +38 -0
- readme.txt +4 -1
- woolentor_addons_elementor.php +3 -3
assets/css/woolentor-widgets.css
CHANGED
@@ -3121,6 +3121,205 @@ span.wlvideo-button {
|
|
3121 |
display: none;
|
3122 |
}
|
3123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3124 |
|
3125 |
/* Normal :1366px. */
|
3126 |
@media (min-width: 1200px) and (max-width: 1400px) {
|
@@ -3332,6 +3531,7 @@ span.wlvideo-button {
|
|
3332 |
@media only screen and (min-width: 480px) and (max-width: 767px) {
|
3333 |
|
3334 |
}
|
|
|
3335 |
.woolentor-qrcode img{
|
3336 |
display:inline-block;
|
3337 |
}
|
3121 |
display: none;
|
3122 |
}
|
3123 |
|
3124 |
+
/* Product Filter Start */
|
3125 |
+
.woolentor-filter-wrap{
|
3126 |
+
overflow: hidden;
|
3127 |
+
}
|
3128 |
+
|
3129 |
+
h2.wl_filter_title {
|
3130 |
+
margin: 0 0 10px 0;
|
3131 |
+
color: #2d2a2a;
|
3132 |
+
font-weight: 600;
|
3133 |
+
font-size: 20px;
|
3134 |
+
padding: 0 0 15px 0;
|
3135 |
+
border-bottom: 1px solid #eee;
|
3136 |
+
}
|
3137 |
+
|
3138 |
+
.woolentor-filter-wrap form.wl_product_search_form {
|
3139 |
+
border: 2px solid rgba(129, 129, 129, 0.2);
|
3140 |
+
display: -webkit-box;
|
3141 |
+
display: -webkit-flex;
|
3142 |
+
display: -ms-flexbox;
|
3143 |
+
display: flex;
|
3144 |
+
}
|
3145 |
+
|
3146 |
+
.woolentor-filter-wrap form.wl_product_search_form input[type="search"]{
|
3147 |
+
box-sizing:inherit;
|
3148 |
+
padding: 0 15px;
|
3149 |
+
height: 42px;
|
3150 |
+
border-radius: 0;
|
3151 |
+
background-color: transparent;
|
3152 |
+
-webkit-box-shadow: none;
|
3153 |
+
box-shadow: none;
|
3154 |
+
vertical-align: middle;
|
3155 |
+
font-size: 14px;
|
3156 |
+
-webkit-transition: border-color .5s ease;
|
3157 |
+
transition: border-color .5s ease;
|
3158 |
+
border:0;
|
3159 |
+
width: calc( 100% - 50px );
|
3160 |
+
}
|
3161 |
+
|
3162 |
+
.woolentor-filter-wrap form.wl_product_search_form button {
|
3163 |
+
width: 50px;
|
3164 |
+
padding: 0;
|
3165 |
+
height: 42px;
|
3166 |
+
text-align: center;
|
3167 |
+
background: transparent;
|
3168 |
+
transition: 0.4s;
|
3169 |
+
color: #222;
|
3170 |
+
border: none;
|
3171 |
+
}
|
3172 |
+
|
3173 |
+
.woolentor-filter-wrap ul{
|
3174 |
+
margin: 0;
|
3175 |
+
padding: 0;
|
3176 |
+
list-style: none;
|
3177 |
+
}
|
3178 |
+
.woolentor-filter-wrap ul li {
|
3179 |
+
border-bottom: 1px solid #eee;
|
3180 |
+
margin: 0;
|
3181 |
+
}
|
3182 |
+
.woolentor-filter-wrap ul li:last-child{
|
3183 |
+
border-bottom: 0;
|
3184 |
+
}
|
3185 |
+
.woolentor-filter-wrap ul li a{
|
3186 |
+
padding: 12px 0;
|
3187 |
+
display: inline-block;
|
3188 |
+
color: #464646;
|
3189 |
+
font-weight: 400;
|
3190 |
+
font-size: 14px;
|
3191 |
+
transition: 0.4s;
|
3192 |
+
}
|
3193 |
+
.woolentor-filter-wrap ul > li:hover > i,.woolentor-filter-wrap ul li a:hover{
|
3194 |
+
color: #f05b64;
|
3195 |
+
}
|
3196 |
+
.woolentor-filter-wrap ul li i{
|
3197 |
+
margin-right: 10px;
|
3198 |
+
}
|
3199 |
+
.woolentor-filter-wrap ul li ul{
|
3200 |
+
padding-left: 20px;
|
3201 |
+
border-top: 1px solid #eee;
|
3202 |
+
}
|
3203 |
+
|
3204 |
+
.woolentor-filter-wrap ul li.wlchosen i{
|
3205 |
+
display: none;
|
3206 |
+
}
|
3207 |
+
|
3208 |
+
.woolentor-filter-wrap ul li.wlchosen a{
|
3209 |
+
position: relative;
|
3210 |
+
padding-left: 15px;
|
3211 |
+
}
|
3212 |
+
|
3213 |
+
.woolentor-filter-wrap ul li.wlchosen > a::before, .woolentor-filter-wrap ul li.wlchosen > a::after {
|
3214 |
+
position: absolute;
|
3215 |
+
top: calc(50% - 1px);
|
3216 |
+
left: 0;
|
3217 |
+
width: 12px;
|
3218 |
+
height: 2px;
|
3219 |
+
content: "";
|
3220 |
+
-webkit-transition: all .5s ease 0s;
|
3221 |
+
-o-transition: all .5s ease 0s;
|
3222 |
+
transition: all .5s ease 0s;
|
3223 |
+
-webkit-transform: rotate(45deg);
|
3224 |
+
-ms-transform: rotate(45deg);
|
3225 |
+
transform: rotate(45deg);
|
3226 |
+
background-color: #f05b64;
|
3227 |
+
}
|
3228 |
+
|
3229 |
+
.woolentor-filter-wrap ul li.wlchosen a:after{
|
3230 |
+
-webkit-transform: rotate(-45deg);
|
3231 |
+
-ms-transform: rotate(-45deg);
|
3232 |
+
transform: rotate(-45deg);
|
3233 |
+
}
|
3234 |
+
|
3235 |
+
.woolentor-filter-wrap select {
|
3236 |
+
padding-right: 30px;
|
3237 |
+
background-position: right 10px top 50%;
|
3238 |
+
background-size: auto 18px;
|
3239 |
+
background-repeat: no-repeat;
|
3240 |
+
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNSIgaGVpZ2h0PSIyNSIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2U9IiNiYmIiPjxwYXRoIGQ9Ik02IDlsNiA2IDYtNiIvPjwvc3ZnPg==");
|
3241 |
+
padding: 0 15px;
|
3242 |
+
max-width: 100%;
|
3243 |
+
width: 100%;
|
3244 |
+
height: 42px;
|
3245 |
+
border: 2px solid rgba(129, 129, 129, 0.2);
|
3246 |
+
border-radius: 0;
|
3247 |
+
background-color: transparent;
|
3248 |
+
-webkit-box-shadow: none;
|
3249 |
+
box-shadow: none;
|
3250 |
+
vertical-align: middle;
|
3251 |
+
font-size: 14px;
|
3252 |
+
-webkit-transition: border-color .5s ease;
|
3253 |
+
transition: border-color .5s ease;
|
3254 |
+
-webkit-appearance: none;
|
3255 |
+
appearance: none;
|
3256 |
+
}
|
3257 |
+
|
3258 |
+
.woolentor_slider_range.ui-slider {
|
3259 |
+
position: relative;
|
3260 |
+
background: #dbdbdb none repeat scroll 0 0;
|
3261 |
+
border: medium none;
|
3262 |
+
border-radius: 50px;
|
3263 |
+
height: 5px;
|
3264 |
+
margin-bottom: 12px;
|
3265 |
+
margin-left: auto;
|
3266 |
+
margin-right: 0;
|
3267 |
+
}
|
3268 |
+
.woolentor_slider_range .ui-slider-range.ui-widget-header.ui-corner-all {
|
3269 |
+
height: 100%;
|
3270 |
+
position: absolute;
|
3271 |
+
display: block;
|
3272 |
+
border: 0;
|
3273 |
+
background: #fa6bff none repeat scroll 0 0;
|
3274 |
+
border: none;
|
3275 |
+
-webkit-transition: all 0s ease 0s;
|
3276 |
+
-o-transition: all 0s ease 0s;
|
3277 |
+
transition: all 0s ease 0s;
|
3278 |
+
}
|
3279 |
+
|
3280 |
+
.woolentor_slider_range .ui-slider-handle.ui-state-default.ui-corner-all {
|
3281 |
+
position: absolute;
|
3282 |
+
background: #fff none repeat scroll 0 0;
|
3283 |
+
border: medium none;
|
3284 |
+
border-radius: 50%;
|
3285 |
+
height: 15px;
|
3286 |
+
margin-left: 0;
|
3287 |
+
width: 15px;
|
3288 |
+
border: 4px solid #fa6bff;
|
3289 |
+
z-index: 2;
|
3290 |
+
width: 1em;
|
3291 |
+
height: 1em;
|
3292 |
+
cursor: ew-resize;
|
3293 |
+
outline: 0;
|
3294 |
+
top: -.3em;
|
3295 |
+
margin-left: -.5em;
|
3296 |
+
}
|
3297 |
+
|
3298 |
+
.wl_button_price{
|
3299 |
+
margin-top: 10px;
|
3300 |
+
display: -webkit-box;
|
3301 |
+
display: -webkit-flex;
|
3302 |
+
display: -ms-flexbox;
|
3303 |
+
display: flex;
|
3304 |
+
-webkit-box-align:center;
|
3305 |
+
-ms-flex-align:center;
|
3306 |
+
align-items:center;
|
3307 |
+
-webkit-box-pack: justify;
|
3308 |
+
-ms-flex-pack: justify;
|
3309 |
+
justify-content: space-between;
|
3310 |
+
}
|
3311 |
+
.wl_button_price button {
|
3312 |
+
background: #29d8db;
|
3313 |
+
padding: 5px 12px;
|
3314 |
+
border-radius: 3px;
|
3315 |
+
border: none;
|
3316 |
+
}
|
3317 |
+
|
3318 |
+
.wl_button_price button:hover{
|
3319 |
+
background: #fa6bff;
|
3320 |
+
text-decoration: none;
|
3321 |
+
}
|
3322 |
+
|
3323 |
|
3324 |
/* Normal :1366px. */
|
3325 |
@media (min-width: 1200px) and (max-width: 1400px) {
|
3531 |
@media only screen and (min-width: 480px) and (max-width: 767px) {
|
3532 |
|
3533 |
}
|
3534 |
+
|
3535 |
.woolentor-qrcode img{
|
3536 |
display:inline-block;
|
3537 |
}
|
classes/class.product_query.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Exit if accessed directly
|
4 |
+
if( ! defined( 'ABSPATH' ) ) exit();
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Third party
|
8 |
+
*/
|
9 |
+
class WooLentorProductQuery{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* [$_instance]
|
13 |
+
* @var null
|
14 |
+
*/
|
15 |
+
private static $_instance = null;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* [instance] Initializes a singleton instance
|
19 |
+
* @return [Base]
|
20 |
+
*/
|
21 |
+
public static function instance() {
|
22 |
+
if ( is_null( self::$_instance ) ) {
|
23 |
+
self::$_instance = new self();
|
24 |
+
}
|
25 |
+
return self::$_instance;
|
26 |
+
}
|
27 |
+
|
28 |
+
function __construct(){
|
29 |
+
|
30 |
+
if( class_exists('WooCommerce') ){
|
31 |
+
add_action( 'woocommerce_product_query', [ $this, 'parse_query' ] );
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
/**
|
38 |
+
* [parse_query]
|
39 |
+
* @param [object] $wp_query WooCommerce Default Widget
|
40 |
+
* @return [void]
|
41 |
+
*/
|
42 |
+
public function parse_query( $wp_query ){
|
43 |
+
|
44 |
+
if ( isset( $_GET['wlfilter'] ) ) {
|
45 |
+
|
46 |
+
$queries =[];
|
47 |
+
$new_queries = [];
|
48 |
+
parse_str( $_SERVER['QUERY_STRING' ], $queries );
|
49 |
+
foreach ( $queries as $key => $querie ) {
|
50 |
+
$new_queries[] = $key;
|
51 |
+
}
|
52 |
+
|
53 |
+
if( isset( $_GET['wlorder_by'] ) ){
|
54 |
+
if( in_array( $_GET['wlorder_by'], [ '_price', 'total_sales', '_wc_average_rating' ] ) ) {
|
55 |
+
|
56 |
+
$wp_query->set( 'meta_key', $_GET['wlorder_by'] );
|
57 |
+
$wp_query->set( 'orderby', 'meta_value_num' );
|
58 |
+
|
59 |
+
}else if( $_GET['wlorder_by'] === 'featured' ){
|
60 |
+
$tax_query[] = [
|
61 |
+
'taxonomy' => 'product_visibility',
|
62 |
+
'field' => 'name',
|
63 |
+
'terms' => explode( ',', $_GET['wlorder_by'] ),
|
64 |
+
'operator' => ( $_GET['wlorder_by'] === 'exclude-from-catalog' ? 'NOT IN' : 'IN' ),
|
65 |
+
];
|
66 |
+
$wp_query->set( 'tax_query', $tax_query );
|
67 |
+
}else{
|
68 |
+
$wp_query->set( 'orderby', $_GET['wlorder_by'] );
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
if( isset( $_GET['wlsort'] ) ){
|
73 |
+
$wp_query->set( 'order', $_GET['wlsort'] );
|
74 |
+
}
|
75 |
+
|
76 |
+
if( isset( $_GET['min_price'] ) || isset( $_GET['max_price'] ) ){
|
77 |
+
$meta_query[] = array(
|
78 |
+
[
|
79 |
+
'key' => '_price',
|
80 |
+
'value' => array( $_GET['min_price'], $_GET['max_price'] ),
|
81 |
+
'compare' => 'BETWEEN',
|
82 |
+
'type' => 'NUMERIC'
|
83 |
+
],
|
84 |
+
);
|
85 |
+
$wp_query->set( 'meta_query', $meta_query );
|
86 |
+
}
|
87 |
+
|
88 |
+
if(isset($new_queries[1])){
|
89 |
+
$attr_pre_str = substr( $new_queries[1], 0, 6 );
|
90 |
+
if( 'filter' === $attr_pre_str ){
|
91 |
+
$taxonomy = str_replace('filter', 'pa', $new_queries[1] );
|
92 |
+
if( isset( $_GET[$new_queries[1] ] ) ){
|
93 |
+
$tax_query[] = array(
|
94 |
+
'taxonomy' => $taxonomy,
|
95 |
+
'field' => 'name',
|
96 |
+
'terms' => explode( ',', $_GET[$new_queries[1]] ),
|
97 |
+
);
|
98 |
+
}
|
99 |
+
$wp_query->set( 'tax_query', $tax_query );
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
+
}
|
110 |
+
|
111 |
+
WooLentorProductQuery::instance();
|
classes/class.widgets_control.php
CHANGED
@@ -62,6 +62,7 @@ class Widgets_Control{
|
|
62 |
if( woolentor_get_option( 'enablecustomlayout', 'woolentor_woo_template_tabs', 'on' ) == 'on' ){
|
63 |
$wlb_element = array(
|
64 |
'wb_archive_product',
|
|
|
65 |
'wb_product_title',
|
66 |
'wb_product_related',
|
67 |
'wb_product_add_to_cart',
|
62 |
if( woolentor_get_option( 'enablecustomlayout', 'woolentor_woo_template_tabs', 'on' ) == 'on' ){
|
63 |
$wlb_element = array(
|
64 |
'wb_archive_product',
|
65 |
+
'wl_product_filter',
|
66 |
'wb_product_title',
|
67 |
'wb_product_related',
|
68 |
'wb_product_add_to_cart',
|
includes/addons/wl_product_filter.php
ADDED
@@ -0,0 +1,1032 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Elementor;
|
3 |
+
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
5 |
+
|
6 |
+
class WL_Product_Filter_Element extends Widget_Base {
|
7 |
+
|
8 |
+
public function get_name() {
|
9 |
+
return 'wl-product-filter';
|
10 |
+
}
|
11 |
+
|
12 |
+
public function get_title() {
|
13 |
+
return __( 'WL: Product Filter', 'woolentor' );
|
14 |
+
}
|
15 |
+
|
16 |
+
public function get_icon() {
|
17 |
+
return 'eicon-filter';
|
18 |
+
}
|
19 |
+
|
20 |
+
public function get_categories() {
|
21 |
+
return ['woolentor-addons'];
|
22 |
+
}
|
23 |
+
|
24 |
+
public function get_style_depends(){
|
25 |
+
return ['elementor-icons-shared-0-css','elementor-icons-fa-brands','elementor-icons-fa-regular','elementor-icons-fa-solid','woolentor-widgets'];
|
26 |
+
}
|
27 |
+
|
28 |
+
public function get_script_depends() {
|
29 |
+
return ['jquery-ui-slider'];
|
30 |
+
}
|
31 |
+
|
32 |
+
public function get_keywords(){
|
33 |
+
return ['woolentor','shop','filter','product filter'];
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function _register_controls() {
|
37 |
+
|
38 |
+
$filter_by = [
|
39 |
+
'search_form' => esc_html__( 'Search Form', 'woolentor' ),
|
40 |
+
'price_by' => esc_html__( 'Price', 'woolentor' ),
|
41 |
+
'sort_by' => esc_html__( 'Sort By', 'woolentor' ),
|
42 |
+
'order_by' => esc_html__( 'Order By', 'woolentor' )
|
43 |
+
];
|
44 |
+
|
45 |
+
$this->start_controls_section(
|
46 |
+
'section_content',
|
47 |
+
[
|
48 |
+
'label' => esc_html__( 'Filter', 'woolentor' ),
|
49 |
+
]
|
50 |
+
);
|
51 |
+
|
52 |
+
$this->add_control(
|
53 |
+
'wl_filter_type',
|
54 |
+
[
|
55 |
+
'label' => esc_html__( 'Filter Type', 'woolentor' ),
|
56 |
+
'type' => Controls_Manager::SELECT2,
|
57 |
+
'options' => $filter_by + woolentor_get_taxonomies(),
|
58 |
+
'separator' => 'before',
|
59 |
+
'label_block' => true,
|
60 |
+
]
|
61 |
+
);
|
62 |
+
|
63 |
+
$this->end_controls_section();
|
64 |
+
|
65 |
+
// Additional Option
|
66 |
+
$this->start_controls_section(
|
67 |
+
'section_additional_option',
|
68 |
+
[
|
69 |
+
'label' => esc_html__( 'Additional Options', 'woolentor' ),
|
70 |
+
]
|
71 |
+
);
|
72 |
+
|
73 |
+
$this->add_control(
|
74 |
+
'wl_filter_area_title',
|
75 |
+
[
|
76 |
+
'label' => esc_html__( 'Title', 'woolentor' ),
|
77 |
+
'type' => Controls_Manager::TEXT,
|
78 |
+
'label_block' => true,
|
79 |
+
]
|
80 |
+
);
|
81 |
+
|
82 |
+
$this->add_control(
|
83 |
+
'show_hierarchical',
|
84 |
+
[
|
85 |
+
'label' => esc_html__( 'Hierarchical', 'woolentor' ),
|
86 |
+
'type' => Controls_Manager::SWITCHER,
|
87 |
+
'condition'=>[
|
88 |
+
'wl_filter_type!'=>['search_form','price_by','sort_by','order_by']
|
89 |
+
]
|
90 |
+
]
|
91 |
+
);
|
92 |
+
|
93 |
+
$this->add_control(
|
94 |
+
'list_icon',
|
95 |
+
[
|
96 |
+
'label' => esc_html__( 'Icon', 'woolentor' ),
|
97 |
+
'type' => Controls_Manager::ICONS,
|
98 |
+
'condition'=>[
|
99 |
+
'wl_filter_type!'=>['search_form','price_by','sort_by','order_by']
|
100 |
+
]
|
101 |
+
]
|
102 |
+
);
|
103 |
+
|
104 |
+
$this->add_responsive_control(
|
105 |
+
'list_icon_space',
|
106 |
+
[
|
107 |
+
'label' => esc_html__( 'Icon Spacing', 'woolentor' ),
|
108 |
+
'type' => Controls_Manager::SLIDER,
|
109 |
+
'selectors' => [
|
110 |
+
'{{WRAPPER}} .woolentor-filter-wrap ul li i' => 'margin-right: {{SIZE}}{{UNIT}};',
|
111 |
+
],
|
112 |
+
'condition'=>[
|
113 |
+
'list_icon[value]!'=>'',
|
114 |
+
'wl_filter_type!'=>['search_form','price_by','sort_by','order_by'],
|
115 |
+
]
|
116 |
+
]
|
117 |
+
);
|
118 |
+
|
119 |
+
$this->end_controls_section();
|
120 |
+
|
121 |
+
// Title Style Section
|
122 |
+
$this->start_controls_section(
|
123 |
+
'wlproduct_filter_title_style',
|
124 |
+
[
|
125 |
+
'label' => esc_html__( 'Title', 'woolentor' ),
|
126 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
127 |
+
'condition'=>[
|
128 |
+
'wl_filter_area_title!'=>''
|
129 |
+
]
|
130 |
+
]
|
131 |
+
);
|
132 |
+
|
133 |
+
$this->add_control(
|
134 |
+
'title_color',
|
135 |
+
[
|
136 |
+
'label' => esc_html__( 'Color', 'woolentor' ),
|
137 |
+
'type' => Controls_Manager::COLOR,
|
138 |
+
'selectors' => [
|
139 |
+
'{{WRAPPER}} h2.wl_filter_title' => 'color: {{VALUE}}',
|
140 |
+
],
|
141 |
+
]
|
142 |
+
);
|
143 |
+
|
144 |
+
$this->add_group_control(
|
145 |
+
\Elementor\Group_Control_Typography::get_type(),
|
146 |
+
[
|
147 |
+
'name' => 'title_typography',
|
148 |
+
'label' => esc_html__( 'Typography', 'woolentor' ),
|
149 |
+
'selector' => '{{WRAPPER}} h2.wl_filter_title',
|
150 |
+
]
|
151 |
+
);
|
152 |
+
|
153 |
+
$this->add_group_control(
|
154 |
+
\Elementor\Group_Control_Border::get_type(),
|
155 |
+
[
|
156 |
+
'name' => 'title_border',
|
157 |
+
'label' => esc_html__( 'Border', 'woolentor' ),
|
158 |
+
'selector' => '{{WRAPPER}} h2.wl_filter_title',
|
159 |
+
]
|
160 |
+
);
|
161 |
+
|
162 |
+
$this->add_responsive_control(
|
163 |
+
'title_padding',
|
164 |
+
[
|
165 |
+
'label' => esc_html__( 'Padding', 'woolentor' ),
|
166 |
+
'type' => Controls_Manager::DIMENSIONS,
|
167 |
+
'size_units' => [ 'px', '%', 'em' ],
|
168 |
+
'selectors' => [
|
169 |
+
'{{WRAPPER}} h2.wl_filter_title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
170 |
+
],
|
171 |
+
]
|
172 |
+
);
|
173 |
+
|
174 |
+
$this->add_responsive_control(
|
175 |
+
'title_margin',
|
176 |
+
[
|
177 |
+
'label' => esc_html__( 'Margin', 'woolentor' ),
|
178 |
+
'type' => Controls_Manager::DIMENSIONS,
|
179 |
+
'size_units' => [ 'px', '%', 'em' ],
|
180 |
+
'selectors' => [
|
181 |
+
'{{WRAPPER}} h2.wl_filter_title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
182 |
+
],
|
183 |
+
]
|
184 |
+
);
|
185 |
+
|
186 |
+
$this->end_controls_section();
|
187 |
+
|
188 |
+
// Search Form Style Section
|
189 |
+
$this->start_controls_section(
|
190 |
+
'wlproduct_filter_search_form_style',
|
191 |
+
[
|
192 |
+
'label' => esc_html__( 'Form Style', 'woolentor' ),
|
193 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
194 |
+
'condition'=>[
|
195 |
+
'wl_filter_type'=>['search_form']
|
196 |
+
]
|
197 |
+
]
|
198 |
+
);
|
199 |
+
|
200 |
+
$this->add_control(
|
201 |
+
'form_inputbox',
|
202 |
+
[
|
203 |
+
'label' => esc_html__( 'Input Box', 'woolentor' ),
|
204 |
+
'type' => Controls_Manager::HEADING,
|
205 |
+
'separator' => 'after',
|
206 |
+
]
|
207 |
+
);
|
208 |
+
|
209 |
+
$this->add_control(
|
210 |
+
'inputbox_color',
|
211 |
+
[
|
212 |
+
'label' => esc_html__( 'Color', 'woolentor' ),
|
213 |
+
'type' => Controls_Manager::COLOR,
|
214 |
+
'selectors' => [
|
215 |
+
'{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form input[type="search"]' => 'color: {{VALUE}}',
|
216 |
+
],
|
217 |
+
]
|
218 |
+
);
|
219 |
+
|
220 |
+
$this->add_group_control(
|
221 |
+
\Elementor\Group_Control_Background::get_type(),
|
222 |
+
[
|
223 |
+
'name' => 'inputbox_background',
|
224 |
+
'label' => esc_html__( 'Background', 'woolentor' ),
|
225 |
+
'types' => [ 'classic', 'gradient' ],
|
226 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form,{{WRAPPER}} .woolentor-filter-wrap input[type="search"]',
|
227 |
+
]
|
228 |
+
);
|
229 |
+
|
230 |
+
$this->add_group_control(
|
231 |
+
\Elementor\Group_Control_Typography::get_type(),
|
232 |
+
[
|
233 |
+
'name' => 'inputbox_typography',
|
234 |
+
'label' => esc_html__( 'Typography', 'woolentor' ),
|
235 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form input[type="search"]',
|
236 |
+
]
|
237 |
+
);
|
238 |
+
|
239 |
+
$this->add_group_control(
|
240 |
+
\Elementor\Group_Control_Border::get_type(),
|
241 |
+
[
|
242 |
+
'name' => 'inputbox_border',
|
243 |
+
'label' => esc_html__( 'Border', 'woolentor' ),
|
244 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form',
|
245 |
+
]
|
246 |
+
);
|
247 |
+
|
248 |
+
$this->add_responsive_control(
|
249 |
+
'inputbox_padding',
|
250 |
+
[
|
251 |
+
'label' => esc_html__( 'Padding', 'woolentor' ),
|
252 |
+
'type' => Controls_Manager::DIMENSIONS,
|
253 |
+
'size_units' => [ 'px', '%', 'em' ],
|
254 |
+
'selectors' => [
|
255 |
+
'{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form input[type="search"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
256 |
+
],
|
257 |
+
]
|
258 |
+
);
|
259 |
+
|
260 |
+
$this->add_control(
|
261 |
+
'form_submit_button',
|
262 |
+
[
|
263 |
+
'label' => esc_html__( 'Submit Button', 'woolentor' ),
|
264 |
+
'type' => Controls_Manager::HEADING,
|
265 |
+
'separator' => 'before',
|
266 |
+
]
|
267 |
+
);
|
268 |
+
|
269 |
+
$this->start_controls_tabs('submit_button_style_tabs');
|
270 |
+
|
271 |
+
// Button Normal Style
|
272 |
+
$this->start_controls_tab(
|
273 |
+
'submit_button_style_normal_tab',
|
274 |
+
[
|
275 |
+
'label' => esc_html__( 'Normal', 'woolentor' ),
|
276 |
+
]
|
277 |
+
);
|
278 |
+
|
279 |
+
$this->add_control(
|
280 |
+
'submit_button_color',
|
281 |
+
[
|
282 |
+
'label' => esc_html__( 'Color', 'woolentor' ),
|
283 |
+
'type' => Controls_Manager::COLOR,
|
284 |
+
'selectors' => [
|
285 |
+
'{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form button' => 'color: {{VALUE}}',
|
286 |
+
],
|
287 |
+
]
|
288 |
+
);
|
289 |
+
|
290 |
+
$this->add_group_control(
|
291 |
+
\Elementor\Group_Control_Background::get_type(),
|
292 |
+
[
|
293 |
+
'name' => 'submit_button_background',
|
294 |
+
'label' => esc_html__( 'Background', 'woolentor' ),
|
295 |
+
'types' => [ 'classic', 'gradient' ],
|
296 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form button',
|
297 |
+
]
|
298 |
+
);
|
299 |
+
|
300 |
+
$this->add_responsive_control(
|
301 |
+
'submit_button_icon_size',
|
302 |
+
[
|
303 |
+
'label' => esc_html__( 'Icon Size', 'woolentor' ),
|
304 |
+
'type' => Controls_Manager::SLIDER,
|
305 |
+
'selectors' => [
|
306 |
+
'{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form button i' => 'font-size: {{SIZE}}{{UNIT}};',
|
307 |
+
],
|
308 |
+
]
|
309 |
+
);
|
310 |
+
|
311 |
+
$this->add_group_control(
|
312 |
+
\Elementor\Group_Control_Border::get_type(),
|
313 |
+
[
|
314 |
+
'name' => 'submit_button_border',
|
315 |
+
'label' => esc_html__( 'Border', 'woolentor' ),
|
316 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form button',
|
317 |
+
]
|
318 |
+
);
|
319 |
+
|
320 |
+
$this->end_controls_tab();
|
321 |
+
|
322 |
+
// Button Hover Style
|
323 |
+
$this->start_controls_tab(
|
324 |
+
'submit_button_style_hover_tab',
|
325 |
+
[
|
326 |
+
'label' => esc_html__( 'Hover', 'woolentor' ),
|
327 |
+
]
|
328 |
+
);
|
329 |
+
$this->add_control(
|
330 |
+
'submit_button_hover_color',
|
331 |
+
[
|
332 |
+
'label' => esc_html__( 'Color', 'woolentor' ),
|
333 |
+
'type' => Controls_Manager::COLOR,
|
334 |
+
'selectors' => [
|
335 |
+
'{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form button:hover' => 'color: {{VALUE}}',
|
336 |
+
],
|
337 |
+
]
|
338 |
+
);
|
339 |
+
|
340 |
+
$this->add_group_control(
|
341 |
+
\Elementor\Group_Control_Background::get_type(),
|
342 |
+
[
|
343 |
+
'name' => 'submit_button_hover_background',
|
344 |
+
'label' => esc_html__( 'Background', 'woolentor' ),
|
345 |
+
'types' => [ 'classic', 'gradient' ],
|
346 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form button:hover',
|
347 |
+
]
|
348 |
+
);
|
349 |
+
|
350 |
+
$this->add_group_control(
|
351 |
+
\Elementor\Group_Control_Border::get_type(),
|
352 |
+
[
|
353 |
+
'name' => 'submit_button_hover_border',
|
354 |
+
'label' => esc_html__( 'Border', 'woolentor' ),
|
355 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap form.wl_product_search_form button:hover',
|
356 |
+
]
|
357 |
+
);
|
358 |
+
|
359 |
+
$this->end_controls_tab();
|
360 |
+
|
361 |
+
$this->end_controls_tabs();
|
362 |
+
|
363 |
+
$this->end_controls_section();
|
364 |
+
|
365 |
+
// List Item Style Section
|
366 |
+
$this->start_controls_section(
|
367 |
+
'wlproduct_filter_list_style',
|
368 |
+
[
|
369 |
+
'label' => esc_html__( 'List Item', 'woolentor' ),
|
370 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
371 |
+
'condition'=>[
|
372 |
+
'wl_filter_type!'=>['search_form','price_by','sort_by','order_by']
|
373 |
+
]
|
374 |
+
]
|
375 |
+
);
|
376 |
+
|
377 |
+
$this->start_controls_tabs('list_item_style_tabs');
|
378 |
+
|
379 |
+
$this->start_controls_tab(
|
380 |
+
'list_item_style_normal_tab',
|
381 |
+
[
|
382 |
+
'label' => esc_html__( 'Normal', 'woolentor' ),
|
383 |
+
]
|
384 |
+
);
|
385 |
+
$this->add_control(
|
386 |
+
'list_item_color',
|
387 |
+
[
|
388 |
+
'label' => esc_html__( 'Color', 'woolentor' ),
|
389 |
+
'type' => Controls_Manager::COLOR,
|
390 |
+
'selectors' => [
|
391 |
+
'{{WRAPPER}} .woolentor-filter-wrap ul li' => 'color: {{VALUE}}',
|
392 |
+
'{{WRAPPER}} .woolentor-filter-wrap ul li a' => 'color: {{VALUE}}',
|
393 |
+
],
|
394 |
+
]
|
395 |
+
);
|
396 |
+
|
397 |
+
$this->add_group_control(
|
398 |
+
\Elementor\Group_Control_Typography::get_type(),
|
399 |
+
[
|
400 |
+
'name' => 'list_item_typography',
|
401 |
+
'label' => esc_html__( 'Typography', 'woolentor' ),
|
402 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap ul li,{{WRAPPER}} .woolentor-filter-wrap ul li a',
|
403 |
+
]
|
404 |
+
);
|
405 |
+
|
406 |
+
$this->add_responsive_control(
|
407 |
+
'list_icon_size',
|
408 |
+
[
|
409 |
+
'label' => esc_html__( 'Icon Size', 'woolentor' ),
|
410 |
+
'type' => Controls_Manager::SLIDER,
|
411 |
+
'selectors' => [
|
412 |
+
'{{WRAPPER}} .woolentor-filter-wrap ul li i' => 'font-size: {{SIZE}}{{UNIT}};',
|
413 |
+
'{{WRAPPER}} .woolentor-filter-wrap ul li svg' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
|
414 |
+
],
|
415 |
+
'condition'=>[
|
416 |
+
'list_icon[value]!'=>'',
|
417 |
+
]
|
418 |
+
]
|
419 |
+
);
|
420 |
+
|
421 |
+
$this->add_responsive_control(
|
422 |
+
'list_item_padding',
|
423 |
+
[
|
424 |
+
'label' => esc_html__( 'Padding', 'woolentor' ),
|
425 |
+
'type' => Controls_Manager::DIMENSIONS,
|
426 |
+
'size_units' => [ 'px', '%', 'em' ],
|
427 |
+
'selectors' => [
|
428 |
+
'{{WRAPPER}} .woolentor-filter-wrap ul li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
429 |
+
],
|
430 |
+
]
|
431 |
+
);
|
432 |
+
|
433 |
+
$this->add_group_control(
|
434 |
+
\Elementor\Group_Control_Border::get_type(),
|
435 |
+
[
|
436 |
+
'name' => 'list_item_border',
|
437 |
+
'label' => esc_html__( 'Border', 'woolentor' ),
|
438 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap ul li',
|
439 |
+
]
|
440 |
+
);
|
441 |
+
|
442 |
+
$this->end_controls_tab();
|
443 |
+
|
444 |
+
$this->start_controls_tab(
|
445 |
+
'list_item_style_hover_tab',
|
446 |
+
[
|
447 |
+
'label' => esc_html__( 'Hover', 'woolentor' ),
|
448 |
+
]
|
449 |
+
);
|
450 |
+
|
451 |
+
$this->add_control(
|
452 |
+
'list_item_hover_color',
|
453 |
+
[
|
454 |
+
'label' => esc_html__( 'Color', 'woolentor' ),
|
455 |
+
'type' => Controls_Manager::COLOR,
|
456 |
+
'selectors' => [
|
457 |
+
'{{WRAPPER}} .woolentor-filter-wrap ul > li:hover > i' => 'color: {{VALUE}}',
|
458 |
+
'{{WRAPPER}} .woolentor-filter-wrap ul li a:hover' => 'color: {{VALUE}}',
|
459 |
+
],
|
460 |
+
]
|
461 |
+
);
|
462 |
+
|
463 |
+
$this->end_controls_tab();
|
464 |
+
|
465 |
+
$this->end_controls_tabs();
|
466 |
+
|
467 |
+
$this->end_controls_section();
|
468 |
+
|
469 |
+
// Price Filter Style Section
|
470 |
+
$this->start_controls_section(
|
471 |
+
'wlproduct_filter_price_filter_style',
|
472 |
+
[
|
473 |
+
'label' => esc_html__( 'Range Slider', 'woolentor' ),
|
474 |
+
'tab' => Controls_Manager::TAB_STYLE,
|
475 |
+
'condition'=>[
|
476 |
+
'wl_filter_type'=>['price_by']
|
477 |
+
]
|
478 |
+
]
|
479 |
+
);
|
480 |
+
|
481 |
+
$this->add_group_control(
|
482 |
+
\Elementor\Group_Control_Background::get_type(),
|
483 |
+
[
|
484 |
+
'name' => 'slider_background',
|
485 |
+
'label' => esc_html__( 'Background', 'woolentor' ),
|
486 |
+
'types' => [ 'classic', 'gradient' ],
|
487 |
+
'selector' => '{{WRAPPER}} .woolentor_slider_range.ui-slider',
|
488 |
+
'exclude'=>['image'],
|
489 |
+
]
|
490 |
+
);
|
491 |
+
|
492 |
+
$this->add_group_control(
|
493 |
+
\Elementor\Group_Control_Background::get_type(),
|
494 |
+
[
|
495 |
+
'name' => 'slider_active_background',
|
496 |
+
'label' => esc_html__( 'Background', 'woolentor' ),
|
497 |
+
'types' => [ 'classic', 'gradient' ],
|
498 |
+
'selector' => '{{WRAPPER}} .woolentor_slider_range .ui-slider-range.ui-widget-header.ui-corner-all',
|
499 |
+
'fields_options' => [
|
500 |
+
'background' => [
|
501 |
+
'label' => esc_html__( 'Active Slider Background', 'woolentor' ),
|
502 |
+
]
|
503 |
+
],
|
504 |
+
'exclude'=>['image'],
|
505 |
+
]
|
506 |
+
);
|
507 |
+
|
508 |
+
$this->add_control(
|
509 |
+
'slider_height',
|
510 |
+
[
|
511 |
+
'label' => esc_html__( 'Height', 'woolentor' ),
|
512 |
+
'type' => Controls_Manager::SLIDER,
|
513 |
+
'size_units' => [ 'px', '%' ],
|
514 |
+
'selectors' => [
|
515 |
+
'{{WRAPPER}} .woolentor_slider_range.ui-slider' => 'height: {{SIZE}}{{UNIT}};',
|
516 |
+
],
|
517 |
+
]
|
518 |
+
);
|
519 |
+
|
520 |
+
$this->add_control(
|
521 |
+
'slider_handler_options',
|
522 |
+
[
|
523 |
+
'label' => esc_html__( 'Slider Handler', 'woolentor' ),
|
524 |
+
'type' => Controls_Manager::HEADING,
|
525 |
+
'separator' => 'before',
|
526 |
+
]
|
527 |
+
);
|
528 |
+
|
529 |
+
$this->add_control(
|
530 |
+
'slider_handler_size',
|
531 |
+
[
|
532 |
+
'label' => esc_html__( 'Size', 'woolentor' ),
|
533 |
+
'type' => Controls_Manager::SLIDER,
|
534 |
+
'size_units' => [ 'px', '%' ],
|
535 |
+
'selectors' => [
|
536 |
+
'{{WRAPPER}} .woolentor_slider_range .ui-slider-handle.ui-state-default.ui-corner-all' => 'height: {{SIZE}}{{UNIT}};width: {{SIZE}}{{UNIT}};',
|
537 |
+
],
|
538 |
+
]
|
539 |
+
);
|
540 |
+
|
541 |
+
$this->add_group_control(
|
542 |
+
\Elementor\Group_Control_Background::get_type(),
|
543 |
+
[
|
544 |
+
'name' => 'slider_handler_background',
|
545 |
+
'label' => esc_html__( 'Background', 'woolentor' ),
|
546 |
+
'types' => [ 'classic', 'gradient' ],
|
547 |
+
'selector' => '{{WRAPPER}} .woolentor_slider_range .ui-slider-handle.ui-state-default.ui-corner-all',
|
548 |
+
'exclude'=>['image'],
|
549 |
+
]
|
550 |
+
);
|
551 |
+
|
552 |
+
$this->add_group_control(
|
553 |
+
\Elementor\Group_Control_Border::get_type(),
|
554 |
+
[
|
555 |
+
'name' => 'slider_handler_button_border',
|
556 |
+
'label' => esc_html__( 'Border', 'woolentor' ),
|
557 |
+
'selector' => '{{WRAPPER}} .woolentor_slider_range .ui-slider-handle.ui-state-default.ui-corner-all',
|
558 |
+
]
|
559 |
+
);
|
560 |
+
|
561 |
+
$this->add_responsive_control(
|
562 |
+
'slider_handler_border_radius',
|
563 |
+
[
|
564 |
+
'label' => esc_html__( 'Border Radius', 'woolentor' ),
|
565 |
+
'type' => Controls_Manager::DIMENSIONS,
|
566 |
+
'size_units' => [ 'px', '%', 'em' ],
|
567 |
+
'selectors' => [
|
568 |
+
'{{WRAPPER}} .woolentor_slider_range .ui-slider-handle.ui-state-default.ui-corner-all' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
569 |
+
],
|
570 |
+
]
|
571 |
+
);
|
572 |
+
|
573 |
+
$this->add_control(
|
574 |
+
'slider_lavel_options',
|
575 |
+
[
|
576 |
+
'label' => esc_html__( 'Price Lavel', 'woolentor' ),
|
577 |
+
'type' => Controls_Manager::HEADING,
|
578 |
+
'separator' => 'before',
|
579 |
+
]
|
580 |
+
);
|
581 |
+
|
582 |
+
$this->add_control(
|
583 |
+
'price_lavel_color',
|
584 |
+
[
|
585 |
+
'label' => esc_html__( 'Lavel Color', 'woolentor' ),
|
586 |
+
'type' => Controls_Manager::COLOR,
|
587 |
+
'selectors' => [
|
588 |
+
'{{WRAPPER}} .woolentor_price_label' => 'color: {{VALUE}}',
|
589 |
+
],
|
590 |
+
]
|
591 |
+
);
|
592 |
+
|
593 |
+
$this->add_control(
|
594 |
+
'price_color',
|
595 |
+
[
|
596 |
+
'label' => esc_html__( 'Price Color', 'woolentor' ),
|
597 |
+
'type' => Controls_Manager::COLOR,
|
598 |
+
'selectors' => [
|
599 |
+
'{{WRAPPER}} .woolentor_price_label span' => 'color: {{VALUE}}',
|
600 |
+
],
|
601 |
+
]
|
602 |
+
);
|
603 |
+
|
604 |
+
$this->add_control(
|
605 |
+
'slider_price_button_options',
|
606 |
+
[
|
607 |
+
'label' => esc_html__( 'Button', 'woolentor' ),
|
608 |
+
'type' => Controls_Manager::HEADING,
|
609 |
+
'separator' => 'before',
|
610 |
+
]
|
611 |
+
);
|
612 |
+
|
613 |
+
$this->start_controls_tabs('slider_button_style_tabs');
|
614 |
+
|
615 |
+
// Button Normal Style
|
616 |
+
$this->start_controls_tab(
|
617 |
+
'slider_button_style_normal_tab',
|
618 |
+
[
|
619 |
+
'label' => esc_html__( 'Normal', 'woolentor' ),
|
620 |
+
]
|
621 |
+
);
|
622 |
+
|
623 |
+
$this->add_control(
|
624 |
+
'slider_button_color',
|
625 |
+
[
|
626 |
+
'label' => esc_html__( 'Color', 'woolentor' ),
|
627 |
+
'type' => Controls_Manager::COLOR,
|
628 |
+
'selectors' => [
|
629 |
+
'{{WRAPPER}} .woolentor-filter-wrap .wl_price_filter form button' => 'color: {{VALUE}}',
|
630 |
+
],
|
631 |
+
]
|
632 |
+
);
|
633 |
+
|
634 |
+
$this->add_group_control(
|
635 |
+
\Elementor\Group_Control_Background::get_type(),
|
636 |
+
[
|
637 |
+
'name' => 'slider_button_background',
|
638 |
+
'label' => esc_html__( 'Background', 'woolentor' ),
|
639 |
+
'types' => [ 'classic', 'gradient' ],
|
640 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap .wl_price_filter form button',
|
641 |
+
'exclude'=>['image'],
|
642 |
+
]
|
643 |
+
);
|
644 |
+
|
645 |
+
$this->add_group_control(
|
646 |
+
\Elementor\Group_Control_Border::get_type(),
|
647 |
+
[
|
648 |
+
'name' => 'slider_button_border',
|
649 |
+
'label' => esc_html__( 'Border', 'woolentor' ),
|
650 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap .wl_price_filter form button',
|
651 |
+
]
|
652 |
+
);
|
653 |
+
|
654 |
+
$this->add_responsive_control(
|
655 |
+
'slider_button_border_radius',
|
656 |
+
[
|
657 |
+
'label' => esc_html__( 'Border Radius', 'woolentor' ),
|
658 |
+
'type' => Controls_Manager::DIMENSIONS,
|
659 |
+
'size_units' => [ 'px', '%', 'em' ],
|
660 |
+
'selectors' => [
|
661 |
+
'{{WRAPPER}} .woolentor-filter-wrap .wl_price_filter form button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
|
662 |
+
],
|
663 |
+
]
|
664 |
+
);
|
665 |
+
|
666 |
+
$this->add_responsive_control(
|
667 |
+
'slider_button_padding',
|
668 |
+
[
|
669 |
+
'label' => esc_html__( 'Padding', 'woolentor' ),
|
670 |
+
'type' => Controls_Manager::DIMENSIONS,
|
671 |
+
'size_units' => [ 'px', '%', 'em' ],
|
672 |
+
'selectors' => [
|
673 |
+
'{{WRAPPER}} .woolentor-filter-wrap .wl_price_filter form button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
|
674 |
+
],
|
675 |
+
]
|
676 |
+
);
|
677 |
+
|
678 |
+
$this->end_controls_tab();
|
679 |
+
|
680 |
+
// Button Hover Style
|
681 |
+
$this->start_controls_tab(
|
682 |
+
'slider_button_style_hover_tab',
|
683 |
+
[
|
684 |
+
'label' => esc_html__( 'Hover', 'woolentor' ),
|
685 |
+
]
|
686 |
+
);
|
687 |
+
$this->add_control(
|
688 |
+
'slider_button_hover_color',
|
689 |
+
[
|
690 |
+
'label' => esc_html__( 'Color', 'woolentor' ),
|
691 |
+
'type' => Controls_Manager::COLOR,
|
692 |
+
'selectors' => [
|
693 |
+
'{{WRAPPER}} .woolentor-filter-wrap .wl_price_filter form button:hover' => 'color: {{VALUE}}',
|
694 |
+
],
|
695 |
+
]
|
696 |
+
);
|
697 |
+
|
698 |
+
$this->add_group_control(
|
699 |
+
\Elementor\Group_Control_Background::get_type(),
|
700 |
+
[
|
701 |
+
'name' => 'slider_button_hover_background',
|
702 |
+
'label' => esc_html__( 'Background', 'woolentor' ),
|
703 |
+
'types' => [ 'classic', 'gradient' ],
|
704 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap .wl_price_filter form button:hover',
|
705 |
+
'exclude'=>['image'],
|
706 |
+
]
|
707 |
+
);
|
708 |
+
|
709 |
+
$this->add_group_control(
|
710 |
+
\Elementor\Group_Control_Border::get_type(),
|
711 |
+
[
|
712 |
+
'name' => 'slider_button_hover_border',
|
713 |
+
'label' => esc_html__( 'Border', 'woolentor' ),
|
714 |
+
'selector' => '{{WRAPPER}} .woolentor-filter-wrap .wl_price_filter form button:hover',
|
715 |
+
]
|
716 |
+
);
|
717 |
+
|
718 |
+
$this->end_controls_tab();
|
719 |
+
|
720 |
+
$this->end_controls_tabs();
|
721 |
+
|
722 |
+
$this->end_controls_section();
|
723 |
+
|
724 |
+
}
|
725 |
+
|
726 |
+
|
727 |
+
protected function render( $instance = [] ) {
|
728 |
+
$settings = $this->get_settings_for_display();
|
729 |
+
$id = $this->get_id();
|
730 |
+
$currency_symbol = get_woocommerce_currency_symbol();
|
731 |
+
|
732 |
+
$filter_type = $settings['wl_filter_type'];
|
733 |
+
|
734 |
+
$list_icon = !empty( $settings['list_icon']['value'] ) ? WooLentor_Icon_manager::render_icon( $settings['list_icon'], [ 'aria-hidden' => 'true' ] ) : '';
|
735 |
+
|
736 |
+
|
737 |
+
global $wp;
|
738 |
+
if ( '' == get_option('permalink_structure' ) ) {
|
739 |
+
$current_url = remove_query_arg(array('page', 'paged'), add_query_arg($wp->query_string, '', home_url($wp->request)));
|
740 |
+
} else {
|
741 |
+
$current_url = preg_replace('%\/page/[0-9]+%', '', home_url(trailingslashit($wp->request)));
|
742 |
+
}
|
743 |
+
|
744 |
+
?>
|
745 |
+
<div class="woolentor-filter-wrap" style="<?php if( 'price_by' === $filter_type ){ echo 'overflow: visible;'; } ?>">
|
746 |
+
|
747 |
+
<?php
|
748 |
+
|
749 |
+
if( !empty( $filter_type ) ):
|
750 |
+
|
751 |
+
echo !empty( $settings['wl_filter_area_title'] ) ? '<h2 class="wl_filter_title">'.$settings['wl_filter_area_title'].'</h2>' : '';
|
752 |
+
|
753 |
+
if( 'search_form' === $filter_type ):
|
754 |
+
?>
|
755 |
+
<form class="wl_product_search_form" role="search" method="get" action="<?php echo esc_url( $current_url ); ?>">
|
756 |
+
<input type="search" placeholder="<?php echo esc_attr_x( 'Search Products…', 'placeholder', 'woolentor' ); ?>" value="<?php echo get_search_query(); ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label', 'woolentor' ); ?>" />
|
757 |
+
<button type="submit"><i class="fa fa-search"></i></button>
|
758 |
+
<input type="hidden" name="post_type" value="product" />
|
759 |
+
</form>
|
760 |
+
|
761 |
+
<?php elseif( 'price_by' === $filter_type ):
|
762 |
+
$step = 10;
|
763 |
+
// Find min and max price in current result set.
|
764 |
+
$prices = $this->get_filtered_price();
|
765 |
+
$min_price = $prices['min'];
|
766 |
+
$max_price = $prices['max'];
|
767 |
+
|
768 |
+
// Check to see if we should add taxes to the prices if store are excl tax but display incl.
|
769 |
+
$tax_display_mode = get_option( 'woocommerce_tax_display_shop' );
|
770 |
+
|
771 |
+
if ( wc_tax_enabled() && ! wc_prices_include_tax() && 'incl' === $tax_display_mode ) {
|
772 |
+
$tax_class = apply_filters( 'woolentor_price_filter_tax_class', '' ); // Uses standard tax class.
|
773 |
+
$tax_rates = \WC_Tax::get_rates( $tax_class );
|
774 |
+
|
775 |
+
if ( $tax_rates ) {
|
776 |
+
$min_price += \WC_Tax::get_tax_total( \WC_Tax::calc_exclusive_tax( $min_price, $tax_rates ) );
|
777 |
+
$max_price += \WC_Tax::get_tax_total( \WC_Tax::calc_exclusive_tax( $max_price, $tax_rates ) );
|
778 |
+
}
|
779 |
+
}
|
780 |
+
|
781 |
+
if ( $min_price === $max_price ){
|
782 |
+
$max_price = 100;
|
783 |
+
}
|
784 |
+
|
785 |
+
$min_price = apply_filters( 'woolentor_price_filter_min_amount', floor( $min_price / $step ) * $step );
|
786 |
+
$max_price = apply_filters( 'woolentor_price_filter_max_amount', ceil( $max_price / $step ) * $step );
|
787 |
+
|
788 |
+
$current_min_price = isset( $_GET['min_price'] ) ? floor( floatval( wp_unslash( $_GET['min_price'] ) ) / $step ) * $step : $min_price; // WPCS: input var ok, CSRF ok.
|
789 |
+
$current_max_price = isset( $_GET['max_price'] ) ? ceil( floatval( wp_unslash( $_GET['max_price'] ) ) / $step ) * $step : $max_price; // WPCS: input var ok, CSRF ok.
|
790 |
+
|
791 |
+
?>
|
792 |
+
|
793 |
+
<div class="wl_price_filter">
|
794 |
+
<form method="get" action="<?php echo esc_url( $current_url ); ?>">
|
795 |
+
<div class="woolentor_slider_range" style="display: none;"></div>
|
796 |
+
<input type="hidden" name="wlfilter" value="1">
|
797 |
+
<input type="text" id="min_price-<?php echo $id; ?>" name="min_price" value="<?php echo esc_attr( $current_min_price ); ?>" data-min="<?php echo esc_attr( $min_price ); ?>" placeholder="<?php echo esc_attr__( 'Min price', 'woolentor' ); ?>" />
|
798 |
+
<input type="text" id="max_price-<?php echo $id; ?>" name="max_price" value="<?php echo esc_attr( $current_max_price ); ?>" data-max="<?php echo esc_attr( $max_price ); ?>" placeholder="<?php echo esc_attr__( 'Max price', 'woolentor' ); ?>" />
|
799 |
+
<div class="wl_button_price">
|
800 |
+
<button type="submit"><?php echo esc_html__( 'Filter', 'woolentor' ); ?></button>
|
801 |
+
<div class="woolentor_price_label" style="display: none;">
|
802 |
+
<?php echo esc_html__( 'Price:', 'woolentor' ); ?>
|
803 |
+
<span id="from-<?php echo $id; ?>"></span> — <span id="to-<?php echo $id; ?>"></span>
|
804 |
+
</div>
|
805 |
+
</div>
|
806 |
+
<?php echo wc_query_string_form_fields( null, array( 'min_price', 'max_price', 'paged' ), '', true ); ?>
|
807 |
+
</form>
|
808 |
+
</div>
|
809 |
+
<script type="text/javascript">
|
810 |
+
;jQuery(document).ready(function($) {
|
811 |
+
'use strict';
|
812 |
+
|
813 |
+
var id = '<?php echo $id; ?>';
|
814 |
+
|
815 |
+
$( 'input#min_price-'+id+', input#max_price-'+id ).hide();
|
816 |
+
$( '.woolentor_slider_range, .woolentor_price_label' ).show();
|
817 |
+
|
818 |
+
var min_price = parseInt( '<?php echo $min_price; ?>' ),
|
819 |
+
max_price = parseInt( '<?php echo $max_price; ?>' ),
|
820 |
+
current_min_price = parseInt( '<?php echo $current_min_price; ?>' ),
|
821 |
+
current_max_price = parseInt( '<?php echo $current_max_price; ?>' ),
|
822 |
+
currency_symbol = '<?php echo $currency_symbol; ?>';
|
823 |
+
|
824 |
+
$( ".woolentor_slider_range" ).slider({
|
825 |
+
range: true,
|
826 |
+
min: min_price,
|
827 |
+
max: max_price,
|
828 |
+
values: [ current_min_price, current_max_price ],
|
829 |
+
slide: function( event, ui ) {
|
830 |
+
$( 'input#min_price-'+id ).val( ui.values[0] );
|
831 |
+
$( 'input#max_price-'+id ).val( ui.values[1] );
|
832 |
+
$( ".woolentor_price_label span#from-"+id ).html( currency_symbol + ui.values[0] );
|
833 |
+
$( ".woolentor_price_label span#to-"+id ).html( currency_symbol + ui.values[1] );
|
834 |
+
},
|
835 |
+
|
836 |
+
});
|
837 |
+
|
838 |
+
$( "#min_price-"+id ).val( $( ".woolentor_slider_range" ).slider( "values", 0 ) );
|
839 |
+
$( "#max_price-"+id ).val( $( ".woolentor_slider_range" ).slider( "values", 1 ) );
|
840 |
+
|
841 |
+
$( ".woolentor_price_label span#from-"+id ).html( currency_symbol + $( ".woolentor_slider_range" ).slider( "values", 0 ) );
|
842 |
+
$( ".woolentor_price_label span#to-"+id ).html( currency_symbol + $( ".woolentor_slider_range" ).slider( "values", 1 ) );
|
843 |
+
|
844 |
+
});
|
845 |
+
</script>
|
846 |
+
|
847 |
+
<?php elseif( 'sort_by' === $filter_type ):
|
848 |
+
$wlsort = ( isset( $_GET['wlsort'] ) && !empty( $_GET['wlsort'] ) ) ? $_GET['wlsort'] : '';
|
849 |
+
?>
|
850 |
+
<div class="wl_sort_by_filter">
|
851 |
+
<select name="wl_sort">
|
852 |
+
<option value="&wlsort=none"><?php echo esc_html__( 'None', 'woolentor' ); ?></option>
|
853 |
+
<option value="&wlsort=ASC" <?php selected( 'ASC', $wlsort, true ); ?> ><?php echo esc_html__( 'ASC', 'woolentor' ); ?></option>
|
854 |
+
<option value="&wlsort=DESC" <?php selected( 'DESC', $wlsort, true ); ?> ><?php echo esc_html__( 'DESC', 'woolentor' ); ?></option>
|
855 |
+
</select>
|
856 |
+
</div>
|
857 |
+
<?php elseif( 'order_by' === $filter_type ):
|
858 |
+
$wlorder_by = ( isset( $_GET['wlorder_by'] ) && !empty( $_GET['wlorder_by'] ) ) ? $_GET['wlorder_by'] : '';
|
859 |
+
?>
|
860 |
+
<div class="wl_order_by_filter">
|
861 |
+
<select name="wl_order_by_sort">
|
862 |
+
<?php
|
863 |
+
foreach ( woolentor_order_by_opts() as $key => $opt_data ) {
|
864 |
+
echo '<option value="&wlorder_by='.esc_attr( $key ).'" '.selected( $key, $wlorder_by, false ).'>'.esc_html__( $opt_data, 'woolentor' ).'</option>';
|
865 |
+
}
|
866 |
+
?>
|
867 |
+
</select>
|
868 |
+
</div>
|
869 |
+
|
870 |
+
<?php else:
|
871 |
+
|
872 |
+
if( 'yes' === $settings['show_hierarchical'] ){
|
873 |
+
$terms = get_terms( $filter_type, [ 'parent' => 0, 'child_of' => 0 ] );
|
874 |
+
|
875 |
+
if ( !empty( $terms ) ){
|
876 |
+
echo '<ul>';
|
877 |
+
foreach ( $terms as $term ){
|
878 |
+
$link = $this->generate_term_link( $filter_type, $term, $current_url );
|
879 |
+
echo '<li class="'.$link['class'].'">';
|
880 |
+
echo sprintf('%1$s<a href="%2$s">%3$s <span>(%4$s)</span></a>', $list_icon, $link['link'], $term->name, $term->count );
|
881 |
+
|
882 |
+
$loterms = get_terms( $filter_type, [ 'parent' => $term->term_id ] );
|
883 |
+
if( !empty( $loterms ) ){
|
884 |
+
echo '<ul class="wlchildren">';
|
885 |
+
foreach( $loterms as $key => $loterm ){
|
886 |
+
$clink = $this->generate_term_link( $filter_type, $loterm, $current_url );
|
887 |
+
echo sprintf('<li class="%5$s">%1$s<a href="%2$s">%3$s <span>(%4$s)</span></a></li>', $list_icon, $clink['link'], $loterm->name, $loterm->count, $clink['class'] );
|
888 |
+
}
|
889 |
+
echo '</ul>';
|
890 |
+
}
|
891 |
+
echo '</li>';
|
892 |
+
}
|
893 |
+
echo '</ul>';
|
894 |
+
}
|
895 |
+
}else{
|
896 |
+
$terms = get_terms( $filter_type );
|
897 |
+
if ( !empty( $terms ) ){
|
898 |
+
echo '<ul>';
|
899 |
+
foreach ( $terms as $term ){
|
900 |
+
$link = $this->generate_term_link( $filter_type, $term, $current_url );
|
901 |
+
echo sprintf('<li class="%5$s">%4$s<a href="%1$s">%2$s <span>(%3$s)</span></a></li>', $link['link'], $term->name, $term->count, $list_icon, $link['class'] );
|
902 |
+
}
|
903 |
+
echo '</ul>';
|
904 |
+
}
|
905 |
+
}
|
906 |
+
|
907 |
+
?>
|
908 |
+
<?php endif;?>
|
909 |
+
|
910 |
+
<?php else: echo '<p>'.esc_html__( 'Please Select Filter Type', 'woolentor' ).'</p>'; ?>
|
911 |
+
|
912 |
+
<?php endif; ?>
|
913 |
+
|
914 |
+
<?php if( 'sort_by' === $filter_type || 'order_by' === $filter_type ):?>
|
915 |
+
<script type="text/javascript">
|
916 |
+
;jQuery(document).ready(function($) {
|
917 |
+
'use strict';
|
918 |
+
var current_url = '<?php echo $current_url.'?wlfilter=1'; ?>';
|
919 |
+
$('.wl_order_by_filter select,.wl_sort_by_filter select').on('change', function () {
|
920 |
+
var sort_key = $(this).val();
|
921 |
+
if ( sort_key ) {
|
922 |
+
window.location = current_url + sort_key;
|
923 |
+
}
|
924 |
+
return false;
|
925 |
+
});
|
926 |
+
});
|
927 |
+
</script>
|
928 |
+
<?php endif; ?>
|
929 |
+
|
930 |
+
</div>
|
931 |
+
<?php
|
932 |
+
}
|
933 |
+
|
934 |
+
protected function generate_term_link( $filter_type, $term, $current_url ) {
|
935 |
+
|
936 |
+
$filter_name = $filter_type;
|
937 |
+
$str = substr( $filter_type, 0, 3 );
|
938 |
+
if( 'pa_' === $str ){
|
939 |
+
$filter_name = 'filter_' . wc_attribute_taxonomy_slug( $filter_type );
|
940 |
+
}
|
941 |
+
|
942 |
+
$current_filter = isset( $_GET[ $filter_name ] ) ? explode( ',', wc_clean( wp_unslash( $_GET[ $filter_name ] ) ) ) : array();
|
943 |
+
$option_is_set = in_array( $term->slug, $current_filter, true );
|
944 |
+
|
945 |
+
// Generate choosen Class
|
946 |
+
if( in_array( $term->slug, $current_filter ) ){
|
947 |
+
$active_class = 'wlchosen';
|
948 |
+
}else{
|
949 |
+
$active_class = '';
|
950 |
+
}
|
951 |
+
|
952 |
+
// Term Link
|
953 |
+
$current_filter = array_map( 'sanitize_title', $current_filter );
|
954 |
+
if ( ! in_array( $term->slug, $current_filter, true ) ) {
|
955 |
+
$current_filter[] = $term->slug;
|
956 |
+
}
|
957 |
+
$link = remove_query_arg( $filter_name, $current_url );
|
958 |
+
|
959 |
+
foreach ( $current_filter as $key => $value ) {
|
960 |
+
if ( $option_is_set && $value === $term->slug ) {
|
961 |
+
unset( $current_filter[ $key ] );
|
962 |
+
}
|
963 |
+
}
|
964 |
+
|
965 |
+
if ( ! empty( $current_filter ) ) {
|
966 |
+
asort( $current_filter );
|
967 |
+
$link = add_query_arg( 'wlfilter', '1', $link );
|
968 |
+
$link = add_query_arg( $filter_name, implode( ',', $current_filter ), $link );
|
969 |
+
$link = str_replace( '%2C', ',', $link );
|
970 |
+
}
|
971 |
+
return [
|
972 |
+
'link' => $link,
|
973 |
+
'class' => $active_class,
|
974 |
+
];
|
975 |
+
|
976 |
+
}
|
977 |
+
|
978 |
+
protected function get_filtered_price() {
|
979 |
+
global $wpdb;
|
980 |
+
|
981 |
+
if( is_shop() ){
|
982 |
+
|
983 |
+
$args = wc()->query->get_main_query();
|
984 |
+
|
985 |
+
$tax_query = isset( $args->tax_query->queries ) ? $args->tax_query->queries : array();
|
986 |
+
$meta_query = isset( $args->query_vars['meta_query'] ) ? $args->query_vars['meta_query'] : array();
|
987 |
+
|
988 |
+
foreach ( $meta_query + $tax_query as $key => $query ) {
|
989 |
+
if ( ! empty( $query['price_filter'] ) || ! empty( $query['rating_filter'] ) ) {
|
990 |
+
unset( $meta_query[ $key ] );
|
991 |
+
}
|
992 |
+
}
|
993 |
+
|
994 |
+
$meta_query = new \WP_Meta_Query( $meta_query );
|
995 |
+
$tax_query = new \WP_Tax_Query( $tax_query );
|
996 |
+
|
997 |
+
$meta_query_sql = $meta_query->get_sql( 'post', $wpdb->posts, 'ID' );
|
998 |
+
$tax_query_sql = $tax_query->get_sql( $wpdb->posts, 'ID' );
|
999 |
+
|
1000 |
+
$sql = "SELECT min( FLOOR( price_meta.meta_value ) ) as min_price, max( CEILING( price_meta.meta_value ) ) as max_price FROM {$wpdb->posts} ";
|
1001 |
+
$sql .= " LEFT JOIN {$wpdb->postmeta} as price_meta ON {$wpdb->posts}.ID = price_meta.post_id " . $tax_query_sql['join'] . $meta_query_sql['join'];
|
1002 |
+
$sql .= " WHERE {$wpdb->posts}.post_type IN ('product')
|
1003 |
+
AND {$wpdb->posts}.post_status = 'publish'
|
1004 |
+
AND price_meta.meta_key IN ('_price')
|
1005 |
+
AND price_meta.meta_value > '' ";
|
1006 |
+
$sql .= $tax_query_sql['where'] . $meta_query_sql['where'];
|
1007 |
+
|
1008 |
+
if ( !Plugin::instance()->editor->is_edit_mode() ) {
|
1009 |
+
$search = !empty( \WC_Query::get_main_search_query_sql() ) ? \WC_Query::get_main_search_query_sql() : '';
|
1010 |
+
if ( $search ) {
|
1011 |
+
$sql .= ' AND ' . $search;
|
1012 |
+
}
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
$prices = $wpdb->get_row( $sql ); // WPCS: unprepared SQL ok.
|
1016 |
+
|
1017 |
+
return [
|
1018 |
+
'min' => floor( $prices->min_price ),
|
1019 |
+
'max' => ceil( $prices->max_price )
|
1020 |
+
];
|
1021 |
+
}else{
|
1022 |
+
return [
|
1023 |
+
'min' => 10,
|
1024 |
+
'max' => 20
|
1025 |
+
];
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
|
1031 |
+
}
|
1032 |
+
Plugin::instance()->widgets_manager->register_widget_type( new WL_Product_Filter_Element() );
|
includes/admin/include/admin-setting.php
CHANGED
@@ -329,6 +329,14 @@ class Woolentor_Admin_Settings {
|
|
329 |
'class'=>'woolentor_table_row',
|
330 |
),
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
array(
|
333 |
'name' => 'wb_product_title',
|
334 |
'label' => __( 'Product Title', 'woolentor' ),
|
329 |
'class'=>'woolentor_table_row',
|
330 |
),
|
331 |
|
332 |
+
array(
|
333 |
+
'name' => 'wl_product_filter',
|
334 |
+
'label' => __( 'Product Filter', 'woolentor' ),
|
335 |
+
'type' => 'checkbox',
|
336 |
+
'default' => 'on',
|
337 |
+
'class'=>'woolentor_table_row',
|
338 |
+
),
|
339 |
+
|
340 |
array(
|
341 |
'name' => 'wb_product_title',
|
342 |
'label' => __( 'Product Title', 'woolentor' ),
|
includes/base.php
CHANGED
@@ -348,6 +348,7 @@ final class Base {
|
|
348 |
if( !is_admin() && !is_plugin_active('woolentor-addons-pro/woolentor_addons_pro.php') && woolentor_get_option( 'enablerenamelabel', 'woolentor_rename_label_tabs', 'off' ) == 'on' ){
|
349 |
require( WOOLENTOR_ADDONS_PL_PATH.'includes/rename_label.php' );
|
350 |
}
|
|
|
351 |
}
|
352 |
|
353 |
// Search
|
348 |
if( !is_admin() && !is_plugin_active('woolentor-addons-pro/woolentor_addons_pro.php') && woolentor_get_option( 'enablerenamelabel', 'woolentor_rename_label_tabs', 'off' ) == 'on' ){
|
349 |
require( WOOLENTOR_ADDONS_PL_PATH.'includes/rename_label.php' );
|
350 |
}
|
351 |
+
require( WOOLENTOR_ADDONS_PL_PATH.'classes/class.product_query.php' );
|
352 |
}
|
353 |
|
354 |
// Search
|
includes/helper-function.php
CHANGED
@@ -430,6 +430,44 @@ if( class_exists('WooCommerce') ){
|
|
430 |
|
431 |
}
|
432 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
/**
|
434 |
* Usages: Compare button shortcode [yith_compare_button] From "YITH WooCommerce Compare" plugins.
|
435 |
* Plugins URL: https://wordpress.org/plugins/yith-woocommerce-compare/
|
430 |
|
431 |
}
|
432 |
|
433 |
+
/**
|
434 |
+
* [woolentor_pro_get_taxonomies]
|
435 |
+
* @return [array] product texonomies
|
436 |
+
*/
|
437 |
+
function woolentor_get_taxonomies( $object = 'product' ) {
|
438 |
+
$all_taxonomies = get_object_taxonomies( $object );
|
439 |
+
$taxonomies_list = [];
|
440 |
+
foreach ( $all_taxonomies as $taxonomy_data ) {
|
441 |
+
$taxonomy = get_taxonomy( $taxonomy_data );
|
442 |
+
if( $taxonomy->show_ui ) {
|
443 |
+
$taxonomies_list[ $taxonomy_data ] = $taxonomy->label;
|
444 |
+
}
|
445 |
+
}
|
446 |
+
return $taxonomies_list;
|
447 |
+
}
|
448 |
+
|
449 |
+
/**
|
450 |
+
* [woolentor_order_by_opts]
|
451 |
+
* @return [array] [description]
|
452 |
+
*/
|
453 |
+
function woolentor_order_by_opts() {
|
454 |
+
$options = [
|
455 |
+
'none' => esc_html__( 'None', 'woolentor' ),
|
456 |
+
'ID' => esc_html__( 'ID', 'woolentor' ),
|
457 |
+
'date' => esc_html__( 'Date', 'woolentor' ),
|
458 |
+
'name' => esc_html__( 'Name', 'woolentor' ),
|
459 |
+
'title' => esc_html__( 'Title', 'woolentor' ),
|
460 |
+
'comment_count' => esc_html__( 'Comment count', 'woolentor' ),
|
461 |
+
'rand' => esc_html__( 'Random', 'woolentor' ),
|
462 |
+
'featured' => esc_html__( 'Featured', 'woolentor' ),
|
463 |
+
'_price' => esc_html__( 'Product Price', 'woolentor' ),
|
464 |
+
'total_sales' => esc_html__( 'Top Seller', 'woolentor' ),
|
465 |
+
'_wc_average_rating' => esc_html__( 'Top Rated', 'woolentor' ),
|
466 |
+
];
|
467 |
+
return apply_filters( 'woolentor_order_by_opts', $options );
|
468 |
+
|
469 |
+
}
|
470 |
+
|
471 |
/**
|
472 |
* Usages: Compare button shortcode [yith_compare_button] From "YITH WooCommerce Compare" plugins.
|
473 |
* Plugins URL: https://wordpress.org/plugins/yith-woocommerce-compare/
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: hasthemes, htplugins, devitemsllc, tarekht
|
3 |
Tags: Elementor, WooCommerce, WooCommerce Elementor, WooCommerce Builder, WooCommerce Product
|
4 |
Requires at least: 4.7
|
5 |
-
Tested up to: 5.5.
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -154,6 +154,9 @@ Feel free to [Contact us](https://hasthemes.com/contact-us/)
|
|
154 |
Elementor Pro is not required. But you can use wooLentor with Elementor free & Pro.
|
155 |
|
156 |
== Changelog ==
|
|
|
|
|
|
|
157 |
= Version: 1.7.3 - Date: 2020-11-11 =
|
158 |
* Template Library Improve
|
159 |
* Rating improve
|
2 |
Contributors: hasthemes, htplugins, devitemsllc, tarekht
|
3 |
Tags: Elementor, WooCommerce, WooCommerce Elementor, WooCommerce Builder, WooCommerce Product
|
4 |
Requires at least: 4.7
|
5 |
+
Tested up to: 5.5.3
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
154 |
Elementor Pro is not required. But you can use wooLentor with Elementor free & Pro.
|
155 |
|
156 |
== Changelog ==
|
157 |
+
= Version: 1.7.4 - Date: 2020-11-25 =
|
158 |
+
* Product Filter Addon added.
|
159 |
+
|
160 |
= Version: 1.7.3 - Date: 2020-11-11 =
|
161 |
* Template Library Improve
|
162 |
* Rating improve
|
woolentor_addons_elementor.php
CHANGED
@@ -3,19 +3,19 @@
|
|
3 |
* Plugin Name: WooLentor - WooCommerce Elementor Addons + Builder
|
4 |
* Description: The WooCommerce elements library for Elementor page builder plugin for WordPress.
|
5 |
* Plugin URI: https://woolentor.com/
|
6 |
-
* Version: 1.7.
|
7 |
* Author: HasThemes
|
8 |
* Author URI: https://hasthemes.com/plugins/woolentor-pro/
|
9 |
* License: GPL-2.0+
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
11 |
* Text Domain: woolentor
|
12 |
* Domain Path: /languages
|
13 |
-
* WC tested up to: 4.7.
|
14 |
*/
|
15 |
|
16 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
17 |
|
18 |
-
define( 'WOOLENTOR_VERSION', '1.7.
|
19 |
define( 'WOOLENTOR_ADDONS_PL_ROOT', __FILE__ );
|
20 |
define( 'WOOLENTOR_ADDONS_PL_URL', plugins_url( '/', WOOLENTOR_ADDONS_PL_ROOT ) );
|
21 |
define( 'WOOLENTOR_ADDONS_PL_PATH', plugin_dir_path( WOOLENTOR_ADDONS_PL_ROOT ) );
|
3 |
* Plugin Name: WooLentor - WooCommerce Elementor Addons + Builder
|
4 |
* Description: The WooCommerce elements library for Elementor page builder plugin for WordPress.
|
5 |
* Plugin URI: https://woolentor.com/
|
6 |
+
* Version: 1.7.4
|
7 |
* Author: HasThemes
|
8 |
* Author URI: https://hasthemes.com/plugins/woolentor-pro/
|
9 |
* License: GPL-2.0+
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
11 |
* Text Domain: woolentor
|
12 |
* Domain Path: /languages
|
13 |
+
* WC tested up to: 4.7.1
|
14 |
*/
|
15 |
|
16 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
17 |
|
18 |
+
define( 'WOOLENTOR_VERSION', '1.7.4' );
|
19 |
define( 'WOOLENTOR_ADDONS_PL_ROOT', __FILE__ );
|
20 |
define( 'WOOLENTOR_ADDONS_PL_URL', plugins_url( '/', WOOLENTOR_ADDONS_PL_ROOT ) );
|
21 |
define( 'WOOLENTOR_ADDONS_PL_PATH', plugin_dir_path( WOOLENTOR_ADDONS_PL_ROOT ) );
|