Version Description
- Fix - Price for currency exchange
- Fix - Optimization for price widget
- Fix - Custom JavaScript errors
Download this release
Release Info
Developer | dholovnia |
Plugin | Advanced AJAX Product Filters |
Version | 1.1.6 |
Comparing to | |
See all releases |
Code changes from version 1.1.5 to 1.1.6
- README.md +7 -2
- css/widget.css +4 -2
- includes/widget.php +84 -39
- js/admin.js +1 -1
- js/widget.min.js +5 -1
- readme.txt +11 -3
- templates/admin-settings.php +38 -2
- templates/admin.php +2 -1
- templates/discount.php +197 -0
- templates/settings_footer.php +62 -0
- templates/settings_head.php +9 -0
- woocommerce-filters.php +33 -6
README.md
CHANGED
@@ -4,8 +4,8 @@ Contributors: dholovnia, berocket
|
|
4 |
Donate link: http://berocket.com
|
5 |
Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters, widget, plugin
|
6 |
Requires at least: 4.0
|
7 |
-
Tested up to: 4.
|
8 |
-
Stable tag: 1.1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -139,6 +139,11 @@ http://woocommerce-product-filter.berocket.com
|
|
139 |
|
140 |
== Changelog ==
|
141 |
|
|
|
|
|
|
|
|
|
|
|
142 |
= 1.1.5 =
|
143 |
* Fix - Shortcode doesn't work
|
144 |
* Fix - Optimization for price filters
|
4 |
Donate link: http://berocket.com
|
5 |
Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters, widget, plugin
|
6 |
Requires at least: 4.0
|
7 |
+
Tested up to: 4.6.1
|
8 |
+
Stable tag: 1.1.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
139 |
|
140 |
== Changelog ==
|
141 |
|
142 |
+
= 1.1.6 =
|
143 |
+
* Fix - Price for currency exchange
|
144 |
+
* Fix - Optimization for price widget
|
145 |
+
* Fix - Custom JavaScript errors
|
146 |
+
|
147 |
= 1.1.5 =
|
148 |
* Fix - Shortcode doesn't work
|
149 |
* Fix - Optimization for price filters
|
css/widget.css
CHANGED
@@ -178,6 +178,7 @@ span.product-size{
|
|
178 |
height: 4px;
|
179 |
padding: 0;
|
180 |
display: block;
|
|
|
181 |
}
|
182 |
|
183 |
.berocket_filter_slider.ui-widget-content .ui-slider-range, .berocket_filter_price_slider.ui-widget-content .ui-slider-range{
|
@@ -186,10 +187,11 @@ span.product-size{
|
|
186 |
|
187 |
.berocket_filter_slider.ui-widget-content .ui-slider-handle, .berocket_filter_price_slider.ui-widget-content .ui-slider-handle{
|
188 |
background: url("../images/handler.png") no-repeat scroll center center / cover transparent;
|
189 |
-
width:
|
190 |
-
height:
|
191 |
border: 0;
|
192 |
top: -4px;
|
|
|
193 |
}
|
194 |
|
195 |
.berocket_aapf_widget li.slider div.slide{
|
178 |
height: 4px;
|
179 |
padding: 0;
|
180 |
display: block;
|
181 |
+
font-size: 10px;
|
182 |
}
|
183 |
|
184 |
.berocket_filter_slider.ui-widget-content .ui-slider-range, .berocket_filter_price_slider.ui-widget-content .ui-slider-range{
|
187 |
|
188 |
.berocket_filter_slider.ui-widget-content .ui-slider-handle, .berocket_filter_price_slider.ui-widget-content .ui-slider-handle{
|
189 |
background: url("../images/handler.png") no-repeat scroll center center / cover transparent;
|
190 |
+
width: 1.2em;
|
191 |
+
height: 1.2em;
|
192 |
border: 0;
|
193 |
top: -4px;
|
194 |
+
font-size: inherit;
|
195 |
}
|
196 |
|
197 |
.berocket_aapf_widget li.slider div.slide{
|
includes/widget.php
CHANGED
@@ -310,49 +310,94 @@ class BeRocket_AAPF_Widget extends WP_Widget {
|
|
310 |
|
311 |
public static function get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ){
|
312 |
global $wpdb, $wp_query;
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
}
|
322 |
-
$
|
323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
|
325 |
-
|
326 |
-
|
327 |
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
}
|
341 |
-
|
342 |
-
|
343 |
-
$query_string = "
|
344 |
-
SELECT MIN(cast({$wpdb->postmeta}.meta_value as unsigned)) as min_price, MAX(cast({$wpdb->postmeta}.meta_value as unsigned)) as max_price
|
345 |
-
FROM {$wpdb->posts}
|
346 |
-
INNER JOIN {$wpdb->postmeta} ON ({$wpdb->posts}.ID = {$wpdb->postmeta}.post_id)
|
347 |
-
INNER JOIN {$wpdb->postmeta} AS pm1 ON ({$wpdb->posts}.ID = pm1.post_id)
|
348 |
-
{$out_of_stock1}
|
349 |
-
{$extra_inner}
|
350 |
-
WHERE {$wpdb->posts}.post_type = 'product'
|
351 |
-
AND {$wpdb->posts}.post_status = 'publish'
|
352 |
-
{$extra_where}
|
353 |
-
AND ( {$wpdb->postmeta}.meta_key = '_price' AND {$wpdb->postmeta}.meta_value > 0
|
354 |
-
AND ( pm1.meta_key = '_visibility' AND CAST(pm1.meta_value AS CHAR) IN ('visible','catalog') )
|
355 |
-
{$out_of_stock2} ) ";
|
356 |
|
357 |
$prices = $wpdb->get_row($query_string);
|
358 |
$price_range = false;
|
310 |
|
311 |
public static function get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ){
|
312 |
global $wpdb, $wp_query;
|
313 |
+
|
314 |
+
if( method_exists('WC_Query', 'get_main_tax_query') && method_exists('WC_Query', 'get_main_tax_query') &&
|
315 |
+
class_exists('WP_Meta_Query') && class_exists('WP_Tax_Query') ) {
|
316 |
+
$query_string = array(
|
317 |
+
'select' => "SELECT MIN(cast(FLOOR(br_prices.meta_value) as decimal)) as min_price, MAX(cast(CEIL(br_prices.meta_value) as decimal)) as max_price
|
318 |
+
FROM {$wpdb->posts}",
|
319 |
+
'join' => " INNER JOIN {$wpdb->postmeta} as br_prices ON ({$wpdb->posts}.ID = br_prices.post_id)",
|
320 |
+
'where' => " WHERE {$wpdb->posts}.post_type = 'product'
|
321 |
+
AND {$wpdb->posts}.post_status = 'publish'
|
322 |
+
AND br_prices.meta_key = '_price' AND br_prices.meta_value > 0");
|
323 |
+
$tax_query = array();
|
324 |
+
$args = $wp_query->query_vars;
|
325 |
+
$meta_query = isset( $args['meta_query'] ) ? $args['meta_query'] : array();
|
326 |
+
foreach ( $meta_query as $key => $query ) {
|
327 |
+
if ( ! empty( $query['price_filter'] ) || ! empty( $query['rating_filter'] ) ) {
|
328 |
+
unset( $meta_query[ $key ] );
|
329 |
+
}
|
330 |
}
|
331 |
+
if ( ! empty( $args['product_cat'] ) ) {
|
332 |
+
$tax_query[ 'product_cat' ] = array(
|
333 |
+
'taxonomy' => 'product_cat',
|
334 |
+
'terms' => array( $args['product_cat'] ),
|
335 |
+
'field' => 'slug',
|
336 |
+
);
|
337 |
+
}
|
338 |
+
$queried_object = $wp_query->get_queried_object_id();
|
339 |
+
if( ! empty($queried_object) ) {
|
340 |
+
$query_object = $wp_query->get_queried_object();
|
341 |
+
if( ! empty($query_object->taxonomy) && ! empty($query_object->slug) ) {
|
342 |
+
$tax_query[ $query_object->taxonomy ] = array(
|
343 |
+
'taxonomy' => $query_object->taxonomy,
|
344 |
+
'terms' => array( $query_object->slug ),
|
345 |
+
'field' => 'slug',
|
346 |
+
);
|
347 |
+
}
|
348 |
+
}
|
349 |
+
$meta_query = new WP_Meta_Query( $meta_query );
|
350 |
+
$tax_query = new WP_Tax_Query( $tax_query );
|
351 |
+
$meta_query_sql = $meta_query->get_sql( 'post', $wpdb->posts, 'ID' );
|
352 |
+
$tax_query_sql = $tax_query->get_sql( $wpdb->posts, 'ID' );
|
353 |
+
$query_string['join'] = $query_string['join'].' '. $tax_query_sql['join'] . $meta_query_sql['join'];
|
354 |
+
$query_string['where'] = $query_string['where'].' '. $tax_query_sql['where'] . $meta_query_sql['where'];
|
355 |
+
$query_string = implode( ' ', $query_string );
|
356 |
+
} else {
|
357 |
+
$_POST['product_cat'] = $wp_query_product_cat;
|
358 |
+
$extra_inner = $extra_where = '';
|
359 |
+
|
360 |
+
if ( @ $_POST['product_cat'] and $_POST['product_cat'] != '-1' ) {
|
361 |
+
$product_cat = get_term_by( 'slug', $_POST['product_cat'], 'product_cat' );
|
362 |
+
$sub_categories = get_term_children($product_cat->term_id, 'product_cat');
|
363 |
+
if( empty($sub_categories) || ! is_array($sub_categories) ) {
|
364 |
+
$sub_categories = array();
|
365 |
+
}
|
366 |
+
$sub_categories[] = $product_cat->term_id;
|
367 |
+
$sub_categories = implode(',', $sub_categories);
|
368 |
|
369 |
+
$extra_inner = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id) ";
|
370 |
+
$extra_where = " AND ( {$wpdb->term_relationships}.term_taxonomy_id IN (" . $sub_categories . ") ) ";
|
371 |
|
372 |
+
unset( $sub_categories );
|
373 |
+
} elseif ( isset($wp_query->query_vars['product_tag']) ) {
|
374 |
+
$product_tag = get_term_by( 'slug', $wp_query->query_vars['product_tag'], 'product_tag' );
|
375 |
+
$extra_inner = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id) ";
|
376 |
+
$extra_where = " AND ( {$wpdb->term_relationships}.term_taxonomy_id IN (" . $product_tag->term_id . ") ) ";
|
377 |
+
}
|
378 |
+
$hide_out_of_stock = BeRocket_AAPF_Widget::woocommerce_hide_out_of_stock_items();
|
379 |
+
$out_of_stock1 = '';
|
380 |
+
$out_of_stock2 = '';
|
381 |
+
if ( $hide_out_of_stock == 'yes' ) {
|
382 |
+
$out_of_stock1 = "INNER JOIN {$wpdb->postmeta} AS pm2 ON ({$wpdb->posts}.ID = pm2.post_id)";
|
383 |
+
$out_of_stock2 = "AND ( pm2.meta_key = '_stock_status' AND CAST(pm2.meta_value AS CHAR) = 'instock' )";
|
384 |
+
}
|
385 |
+
|
386 |
+
|
387 |
+
$query_string = "
|
388 |
+
SELECT MIN(cast({$wpdb->postmeta}.meta_value as unsigned)) as min_price, MAX(cast({$wpdb->postmeta}.meta_value as unsigned)) as max_price
|
389 |
+
FROM {$wpdb->posts}
|
390 |
+
INNER JOIN {$wpdb->postmeta} ON ({$wpdb->posts}.ID = {$wpdb->postmeta}.post_id)
|
391 |
+
INNER JOIN {$wpdb->postmeta} AS pm1 ON ({$wpdb->posts}.ID = pm1.post_id)
|
392 |
+
{$out_of_stock1}
|
393 |
+
{$extra_inner}
|
394 |
+
WHERE {$wpdb->posts}.post_type = 'product'
|
395 |
+
AND {$wpdb->posts}.post_status = 'publish'
|
396 |
+
{$extra_where}
|
397 |
+
AND ( {$wpdb->postmeta}.meta_key = '_price' AND {$wpdb->postmeta}.meta_value > 0
|
398 |
+
AND ( pm1.meta_key = '_visibility' AND CAST(pm1.meta_value AS CHAR) IN ('visible','catalog') )
|
399 |
+
{$out_of_stock2} ) ";
|
400 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
|
402 |
$prices = $wpdb->get_row($query_string);
|
403 |
$price_range = false;
|
js/admin.js
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
$('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().hide(0);
|
9 |
$('.berocket_aapf_widget_admin_price_attribute', $parent).show(0);
|
10 |
} else {
|
11 |
-
$('.berocket_aapf_widget_admin_type_select', $parent).html('<option value="checkbox">Checkbox</option><option value="radio">Radio</option><option value="select">Select</option
|
12 |
$('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().show(0);
|
13 |
$('.berocket_aapf_widget_admin_price_attribute', $parent).hide(0);
|
14 |
}
|
8 |
$('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().hide(0);
|
9 |
$('.berocket_aapf_widget_admin_price_attribute', $parent).show(0);
|
10 |
} else {
|
11 |
+
$('.berocket_aapf_widget_admin_type_select', $parent).html('<option value="checkbox">Checkbox</option><option value="radio">Radio</option><option value="select">Select</option>');
|
12 |
$('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().show(0);
|
13 |
$('.berocket_aapf_widget_admin_price_attribute', $parent).hide(0);
|
14 |
}
|
js/widget.min.js
CHANGED
@@ -28,7 +28,11 @@
|
|
28 |
&& typeof func != 'undefined'
|
29 |
&& func.length > 0
|
30 |
) {
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
}
|
34 |
|
28 |
&& typeof func != 'undefined'
|
29 |
&& func.length > 0
|
30 |
) {
|
31 |
+
try{
|
32 |
+
eval( func );
|
33 |
+
} catch(err){
|
34 |
+
alert('You have some incorrect JavaScript code (AJAX Products Filter)');
|
35 |
+
}
|
36 |
}
|
37 |
}
|
38 |
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Contributors: dholovnia, berocket
|
|
4 |
Donate link: http://berocket.com
|
5 |
Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters, widget, plugin
|
6 |
Requires at least: 4.0
|
7 |
-
Tested up to: 4.
|
8 |
-
Stable tag: 1.1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -51,7 +51,10 @@ WooCommerce AJAX Product Filters - advanced AJAX product filters plugin for WooC
|
|
51 |
http://berocket.com/product/woocommerce-ajax-products-filter
|
52 |
|
53 |
= Demo =
|
54 |
-
http://woocommerce-
|
|
|
|
|
|
|
55 |
|
56 |
|
57 |
= How It Works: =
|
@@ -139,6 +142,11 @@ http://woocommerce-product-filter.berocket.com
|
|
139 |
|
140 |
== Changelog ==
|
141 |
|
|
|
|
|
|
|
|
|
|
|
142 |
= 1.1.5 =
|
143 |
* Fix - Shortcode doesn't work
|
144 |
* Fix - Optimization for price filters
|
4 |
Donate link: http://berocket.com
|
5 |
Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters, widget, plugin
|
6 |
Requires at least: 4.0
|
7 |
+
Tested up to: 4.6.1
|
8 |
+
Stable tag: 1.1.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
51 |
http://berocket.com/product/woocommerce-ajax-products-filter
|
52 |
|
53 |
= Demo =
|
54 |
+
http://woocommerce-products-filter.berocket.com/shop/
|
55 |
+
|
56 |
+
= Demo Description =
|
57 |
+
http://woocommerce-products-filter.berocket.com/
|
58 |
|
59 |
|
60 |
= How It Works: =
|
142 |
|
143 |
== Changelog ==
|
144 |
|
145 |
+
= 1.1.6 =
|
146 |
+
* Fix - Price for currency exchange
|
147 |
+
* Fix - Optimization for price widget
|
148 |
+
* Fix - Custom JavaScript errors
|
149 |
+
|
150 |
= 1.1.5 =
|
151 |
* Fix - Shortcode doesn't work
|
152 |
* Fix - Optimization for price filters
|
templates/admin-settings.php
CHANGED
@@ -1,3 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div class="wrap">
|
2 |
<form method="post" action="options.php">
|
3 |
<?php
|
@@ -141,6 +149,9 @@
|
|
141 |
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
142 |
</p>
|
143 |
</form>
|
|
|
|
|
|
|
144 |
<h3>Receive more features and control with Paid version of the plugin:</h3>
|
145 |
<ul>
|
146 |
<li><b>- Filter by Attribute, Tag, Custom Taxonomy, Color, Sub-categories and Availability( in stock | out of stock | any )</b></li>
|
@@ -161,5 +172,30 @@
|
|
161 |
<li><b>- Enhancements of the free features</b></li>
|
162 |
</ul>
|
163 |
<h4>Support the plugin by purchasing paid version. This will provide faster growth, better support and much more functionality for the plugin!</h4>
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$dplugin_name = 'WooCommerce AJAX Products Filter';
|
3 |
+
$dplugin_link = 'http://berocket.com/product/woocommerce-ajax-products-filter';
|
4 |
+
$dplugin_price = 26;
|
5 |
+
$dplugin_desc = '';
|
6 |
+
@ include 'settings_head.php';
|
7 |
+
@ include 'discount.php';
|
8 |
+
?>
|
9 |
<div class="wrap">
|
10 |
<form method="post" action="options.php">
|
11 |
<?php
|
149 |
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
150 |
</p>
|
151 |
</form>
|
152 |
+
</div>
|
153 |
+
<?php
|
154 |
+
/*
|
155 |
<h3>Receive more features and control with Paid version of the plugin:</h3>
|
156 |
<ul>
|
157 |
<li><b>- Filter by Attribute, Tag, Custom Taxonomy, Color, Sub-categories and Availability( in stock | out of stock | any )</b></li>
|
172 |
<li><b>- Enhancements of the free features</b></li>
|
173 |
</ul>
|
174 |
<h4>Support the plugin by purchasing paid version. This will provide faster growth, better support and much more functionality for the plugin!</h4>
|
175 |
+
*/
|
176 |
+
$feature_list = array(
|
177 |
+
'Filter by Tag and Custom Taxonomy',
|
178 |
+
'Nice URLs for SEO Friendly URLs',
|
179 |
+
'Customization for text, checkbox, radio, slider and other elements',
|
180 |
+
'Filters Can be Collapsed, Option to Collapse Filter on Start',
|
181 |
+
'Shortcode Builder for Easy Shortcode Creation',
|
182 |
+
'Optimization to Handle up to 5 000 Products Total',
|
183 |
+
'Price Filter Custom Min and Max Values',
|
184 |
+
'Option to Set Values for the Price Slider Manually',
|
185 |
+
'Description for Widgets',
|
186 |
+
'Support 99% of the Themes',
|
187 |
+
'Selected Filters Area',
|
188 |
+
'Reset button widget',
|
189 |
+
'Search box widget',
|
190 |
+
'Cache for Widgets',
|
191 |
+
'Color and Image Type of Widgets',
|
192 |
+
'Custom CSS Styles',
|
193 |
+
'Filters Visibility by Pages',
|
194 |
+
'Icons Before and After Title',
|
195 |
+
'Icons Before and After Values',
|
196 |
+
'Count of Products with Attribute Values',
|
197 |
+
'Show amount of products before update',
|
198 |
+
'Price as checkbox with min and max values',
|
199 |
+
);
|
200 |
+
@ include 'settings_footer.php';
|
201 |
+
?>
|
templates/admin.php
CHANGED
@@ -31,8 +31,9 @@
|
|
31 |
<option <?php if ($instance['type'] == 'checkbox') echo 'selected'; ?> value="checkbox">Checkbox</option>
|
32 |
<option <?php if ($instance['type'] == 'radio') echo 'selected'; ?> value="radio">Radio</option>
|
33 |
<option <?php if ($instance['type'] == 'select') echo 'selected'; ?> value="select">Select</option>
|
34 |
-
<?php } ?>
|
35 |
<option <?php if ($instance['type'] == 'slider') echo 'selected'; ?> value="slider">Slider</option>
|
|
|
36 |
</select>
|
37 |
</label>
|
38 |
</p>
|
31 |
<option <?php if ($instance['type'] == 'checkbox') echo 'selected'; ?> value="checkbox">Checkbox</option>
|
32 |
<option <?php if ($instance['type'] == 'radio') echo 'selected'; ?> value="radio">Radio</option>
|
33 |
<option <?php if ($instance['type'] == 'select') echo 'selected'; ?> value="select">Select</option>
|
34 |
+
<?php } else { ?>
|
35 |
<option <?php if ($instance['type'] == 'slider') echo 'selected'; ?> value="slider">Slider</option>
|
36 |
+
<?php } ?>
|
37 |
</select>
|
38 |
</label>
|
39 |
</p>
|
templates/discount.php
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$start_time = 1475532000;//1475272800
|
3 |
+
$end_time = 1475791200;//1475445600
|
4 |
+
$time = time();
|
5 |
+
$discount = 30;
|
6 |
+
$d_type = 'p';
|
7 |
+
if( $d_type == 'p' ) {
|
8 |
+
$discount_text = $discount.'%';
|
9 |
+
$discount_amount = ($dplugin_price / 100 * $discount);
|
10 |
+
} else {
|
11 |
+
$discount_text = '$'.$discount;
|
12 |
+
$discount_amount = $discount;
|
13 |
+
}
|
14 |
+
$price_new = $dplugin_price - $discount_amount;
|
15 |
+
$price_new = number_format ( $price_new , 2 ,"." ," " );
|
16 |
+
$price_new = '$'.$price_new;
|
17 |
+
$discount_amount = number_format ( $discount_amount , 2 ,"." ," " );
|
18 |
+
$discount_amount = '$'.$discount_amount;
|
19 |
+
if( $time > $start_time && $time < $end_time ) { ?>
|
20 |
+
<div class="discount-block-check"></div>
|
21 |
+
<div class="wrap discount-block">
|
22 |
+
<div>
|
23 |
+
<?php
|
24 |
+
$text = 'Only today <strong>PRO</strong> version of %name% plugin for just %price%!<br>
|
25 |
+
Get your <strong class="scale red pulse">%disc% discount</strong> and save %amount% today
|
26 |
+
<a class="buy_button" href="%link%" target="_blank">Buy Now</a>';
|
27 |
+
$text = str_replace('%name%', $dplugin_name, $text);
|
28 |
+
$text = str_replace('%link%', $dplugin_link, $text);
|
29 |
+
$text = str_replace('%disc%', $discount_text, $text);
|
30 |
+
$text = str_replace('%amount%', $discount_amount, $text);
|
31 |
+
$text = str_replace('%price%', $price_new, $text);
|
32 |
+
echo $text;
|
33 |
+
?>
|
34 |
+
</div>
|
35 |
+
</div>
|
36 |
+
<script>
|
37 |
+
jQuery(window).scroll(function() {
|
38 |
+
var top = jQuery('.discount-block-check').offset().top - 32;
|
39 |
+
|
40 |
+
if( jQuery(window).width() <= 782 ) {
|
41 |
+
jQuery('.discount-block').removeClass('fixed');
|
42 |
+
jQuery('.discount-block-check').height(0);
|
43 |
+
} else {
|
44 |
+
if( jQuery(window).scrollTop() > top ) {
|
45 |
+
if( ! jQuery('.discount-block').is('.fixed') ) {
|
46 |
+
jQuery('.discount-block-check').height(jQuery('.discount-block').outerHeight(true));
|
47 |
+
jQuery('.discount-block').addClass('fixed');
|
48 |
+
}
|
49 |
+
} else {
|
50 |
+
if( jQuery('.discount-block').is('.fixed') ) {
|
51 |
+
jQuery('.discount-block-check').height(0);
|
52 |
+
jQuery('.discount-block').removeClass('fixed');
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
});
|
57 |
+
</script>
|
58 |
+
<style>
|
59 |
+
.discount-block-check {
|
60 |
+
margin: 0!important;
|
61 |
+
padding: 0!important;
|
62 |
+
}
|
63 |
+
.discount-block{
|
64 |
+
text-align: center;
|
65 |
+
background: #ffffff;
|
66 |
+
padding: 20px;
|
67 |
+
font-size: 24px;
|
68 |
+
border: 4px solid #ff8800;
|
69 |
+
line-height: 1.8em;
|
70 |
+
transition: 0.4s all;
|
71 |
+
animation-name: border_pulse;
|
72 |
+
animation-duration: 4s;
|
73 |
+
animation-iteration-count: infinite;
|
74 |
+
}
|
75 |
+
.discount-block.fixed{
|
76 |
+
position: fixed;
|
77 |
+
top: 32px;
|
78 |
+
left: 180px;
|
79 |
+
right: 0px;
|
80 |
+
}
|
81 |
+
@media only screen and (max-device-width: 960px) {
|
82 |
+
.discount-block.fixed{
|
83 |
+
left: 56px;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
@media only screen and (max-device-width: 782px) {
|
87 |
+
.discount-block{
|
88 |
+
font-size: 16px;
|
89 |
+
padding: 5px;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
@keyframes border_pulse {
|
93 |
+
0% {border-color: #ff8800;}
|
94 |
+
50% {border-color: #0088ff;}
|
95 |
+
100% {border-color: #ff8800;}
|
96 |
+
}
|
97 |
+
.discount-block .buy_button {
|
98 |
+
font-size: 20px;
|
99 |
+
padding: 8px 30px;
|
100 |
+
color: #fff;
|
101 |
+
line-height: 28px;
|
102 |
+
font-weight: 600;
|
103 |
+
text-transform: uppercase;
|
104 |
+
display: inline-block;
|
105 |
+
text-align: center;
|
106 |
+
text-decoration: none;
|
107 |
+
background-color: #f16543;
|
108 |
+
cursor: pointer;
|
109 |
+
}
|
110 |
+
.discount-block .buy_button:hover {
|
111 |
+
background-color: #d94825;
|
112 |
+
}
|
113 |
+
.pulse {
|
114 |
+
animation-duration: 1.5s;
|
115 |
+
animation-iteration-count: infinite;
|
116 |
+
animation-timing-function: linear;
|
117 |
+
animation-timing-function: cubic-bezier(0.2,0.2,0.2,0.2);
|
118 |
+
}
|
119 |
+
.time-5 {
|
120 |
+
animation-duration: 0.5s;
|
121 |
+
}
|
122 |
+
.time-10 {
|
123 |
+
animation-duration: 1s;
|
124 |
+
}
|
125 |
+
.time-15 {
|
126 |
+
animation-duration: 1.5s;
|
127 |
+
}
|
128 |
+
.time-20 {
|
129 |
+
animation-duration: 2s;
|
130 |
+
}
|
131 |
+
.time-25 {
|
132 |
+
animation-duration: 2.5s;
|
133 |
+
}
|
134 |
+
.time-30 {
|
135 |
+
animation-duration: 3s;
|
136 |
+
}
|
137 |
+
.time-35 {
|
138 |
+
animation-duration: 3.5s;
|
139 |
+
}
|
140 |
+
.time-40 {
|
141 |
+
animation-duration: 4s;
|
142 |
+
}
|
143 |
+
.red {
|
144 |
+
color: #ff0000;
|
145 |
+
}
|
146 |
+
.red.pulse {
|
147 |
+
animation-name: red_pulse;
|
148 |
+
}
|
149 |
+
@keyframes red_pulse {
|
150 |
+
0% {color: #ff0000;}
|
151 |
+
50% {color: #000000;}
|
152 |
+
100% {color: #ff0000;}
|
153 |
+
}
|
154 |
+
.blue {
|
155 |
+
color: #0000ff;
|
156 |
+
}
|
157 |
+
.blue.pulse {
|
158 |
+
animation-name: blue_pulse;
|
159 |
+
}
|
160 |
+
@keyframes blue_pulse {
|
161 |
+
0% {color: #0000ff;}
|
162 |
+
50% {color: #000000;}
|
163 |
+
100% {color: #0000ff;}
|
164 |
+
}
|
165 |
+
.pulse.scale {
|
166 |
+
display: inline-block;
|
167 |
+
animation-name: scale_pulse;
|
168 |
+
}
|
169 |
+
@keyframes scale_pulse {
|
170 |
+
0% {transform: scale(1);}
|
171 |
+
25%{transform: scale(1.05);}
|
172 |
+
50% {transform: scale(1);}
|
173 |
+
75% {transform: scale(0.9);}
|
174 |
+
100% {transform: scale(1);}
|
175 |
+
}
|
176 |
+
.pulse.scale.red {
|
177 |
+
animation-name: scale_red_pulse;
|
178 |
+
}
|
179 |
+
@keyframes scale_red_pulse {
|
180 |
+
0% {transform: scale(1);color: #ff0000;}
|
181 |
+
25%{transform: scale(1.05);color: #ff0000;}
|
182 |
+
50% {transform: scale(1);color: #ff0000;}
|
183 |
+
75% {transform: scale(0.9);color: #000000;}
|
184 |
+
100% {transform: scale(1);color: #ff0000;}
|
185 |
+
}
|
186 |
+
.pulse.scale.blue {
|
187 |
+
animation-name: scale_blue_pulse;
|
188 |
+
}
|
189 |
+
@keyframes scale_blue_pulse {
|
190 |
+
0% {transform: scale(1);color: #0000ff;}
|
191 |
+
25%{transform: scale(1.05);color: #0000ff;}
|
192 |
+
50% {transform: scale(1);color: #0000ff;}
|
193 |
+
75% {transform: scale(0.9);color: #000000;}
|
194 |
+
100% {transform: scale(1);color: #0000ff;}
|
195 |
+
}
|
196 |
+
</style>
|
197 |
+
<?php } ?>
|
templates/settings_footer.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<?php if( ! empty($feature_list) && count($feature_list) > 0 ) { ?>
|
3 |
+
<div class="paid_features">
|
4 |
+
<?php
|
5 |
+
$feature_text = '';
|
6 |
+
foreach($feature_list as $feature) {
|
7 |
+
$feature_text .= '<li>'.$feature.'</li>';
|
8 |
+
}
|
9 |
+
$text = '<h3>Receive more features and control with Paid version of the plugin:</h3>
|
10 |
+
<div>
|
11 |
+
<ul>
|
12 |
+
%feature_list%
|
13 |
+
</ul>
|
14 |
+
</div>
|
15 |
+
<div><a class="get_premium_version" href="%link%">PREMIUM VERSION</a></div>
|
16 |
+
<p>Support the plugin by purchasing paid version. This will provide faster growth, better support and much more functionality for the plugin</p>';
|
17 |
+
$text = str_replace('%feature_list%', $feature_text, $text);
|
18 |
+
$text = str_replace('%link%', $dplugin_link, $text);
|
19 |
+
$text = str_replace('%plugin_name%', @ $plugin_info['Name'], $text);
|
20 |
+
$text = str_replace('%plugin_link%', @ $plugin_info['PluginURI'], $text);
|
21 |
+
echo $text;
|
22 |
+
?>
|
23 |
+
</div>
|
24 |
+
<?php
|
25 |
+
$text = '<h4>Both <a href="%plugin_link%" target="_blank">Free</a> and <a href="%link%" target="_blank">Paid</a> versions of %plugin_name% developed by <a href="http://berocket.com" target="_blank">BeRocket</a></h4>';
|
26 |
+
} else {
|
27 |
+
$text = '<h4><a href="%plugin_link%" target="_blank">%plugin_name%</a> developed by <a href="http://berocket.com" target="_blank">BeRocket</a></h4>';
|
28 |
+
}
|
29 |
+
$text = str_replace('%link%', $dplugin_link, $text);
|
30 |
+
$text = str_replace('%plugin_name%', @ $plugin_info['Name'], $text);
|
31 |
+
$text = str_replace('%plugin_link%', @ $plugin_info['PluginURI'], $text);
|
32 |
+
echo $text;
|
33 |
+
?>
|
34 |
+
</div>
|
35 |
+
<style>
|
36 |
+
.paid_features {
|
37 |
+
border: 1px solid #c29a9a;
|
38 |
+
background: white;
|
39 |
+
padding: 20px 20px 10px 30px;
|
40 |
+
font-weight: 600;
|
41 |
+
}
|
42 |
+
.get_premium_version {
|
43 |
+
display: inline-block;
|
44 |
+
background-color: rgb(239, 109, 109);
|
45 |
+
border-color: rgb(222, 72, 72);
|
46 |
+
color: white;
|
47 |
+
font-size: 20px;
|
48 |
+
height: auto;
|
49 |
+
padding: 10px 41px;
|
50 |
+
margin: 1em 0 1em 0;
|
51 |
+
text-decoration: none;
|
52 |
+
cursor: pointer;
|
53 |
+
}
|
54 |
+
.get_premium_version:hover {
|
55 |
+
color: white;
|
56 |
+
background-color: rgb(222, 72, 72);
|
57 |
+
}
|
58 |
+
.paid_features ul li{
|
59 |
+
list-style: initial;
|
60 |
+
margin-left: 2em;
|
61 |
+
}
|
62 |
+
</style>
|
templates/settings_head.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<?php
|
3 |
+
$text = '<h1>%plugin_name% by BeRocket</h1>
|
4 |
+
<div>%desc%</div>';
|
5 |
+
$text = str_replace('%plugin_name%', $plugin_info['Name'], $text);
|
6 |
+
$text = str_replace('%desc%', $plugin_info['Description'], $text);
|
7 |
+
echo $text;
|
8 |
+
?>
|
9 |
+
</div>
|
woocommerce-filters.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Advanced AJAX Product Filters for WooCommerce
|
4 |
-
* Plugin URI:
|
5 |
-
* Description:
|
6 |
-
* Version: 1.1.
|
7 |
* Author: BeRocket
|
8 |
* Author URI: http://berocket.com
|
9 |
* Text Domain: BeRocket_AJAX_domain
|
10 |
* Domain Path: /languages/
|
11 |
*/
|
12 |
|
13 |
-
define( "BeRocket_AJAX_filters_version", '1.1.
|
14 |
define( "BeRocket_AJAX_domain", 'BeRocket_AJAX_domain' );
|
15 |
|
16 |
define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
|
@@ -34,6 +34,11 @@ class BeRocket_AAPF {
|
|
34 |
"filters_turn_off" => "0",
|
35 |
"seo_friendly_urls" => "0"
|
36 |
);
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
function __construct(){
|
39 |
register_activation_hook(__FILE__, array( __CLASS__, 'br_add_defaults' ) );
|
@@ -59,6 +64,9 @@ class BeRocket_AAPF {
|
|
59 |
add_action( 'wp_footer', array( 'BeRocket_AAPF_Widget', 'end_clean'), 999999 );
|
60 |
add_action( 'init', array( 'BeRocket_AAPF_Widget', 'start_clean'), 1 );
|
61 |
}
|
|
|
|
|
|
|
62 |
} else {
|
63 |
if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
64 |
add_action( 'admin_notices', array( __CLASS__, 'update_woocommerce' ) );
|
@@ -67,6 +75,24 @@ class BeRocket_AAPF {
|
|
67 |
}
|
68 |
}
|
69 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
public static function init() {
|
72 |
|
@@ -133,6 +159,7 @@ class BeRocket_AAPF {
|
|
133 |
wp_enqueue_style( 'berocket_aapf_widget-colorpicker-style' );
|
134 |
wp_enqueue_style( 'berocket_aapf_widget-admin-style' );
|
135 |
|
|
|
136 |
include AAPF_TEMPLATE_PATH . "admin-settings.php";
|
137 |
}
|
138 |
|
@@ -143,7 +170,7 @@ class BeRocket_AAPF {
|
|
143 |
|
144 |
if ( @ $_POST['price'] ) {
|
145 |
list( $_GET['min_price'], $_GET['max_price'] ) = $_POST['price'];
|
146 |
-
add_filter( 'loop_shop_post_in', array(
|
147 |
}
|
148 |
}
|
149 |
}
|
@@ -157,7 +184,7 @@ class BeRocket_AAPF {
|
|
157 |
|
158 |
if ( @ $_POST['price'] ) {
|
159 |
list( $_GET['min_price'], $_GET['max_price'] ) = $_POST['price'];
|
160 |
-
add_filter( 'loop_shop_post_in', array(
|
161 |
}
|
162 |
|
163 |
if ( @ $_POST['limits'] ) {
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Advanced AJAX Product Filters for WooCommerce
|
4 |
+
* Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/
|
5 |
+
* Description: Take a look at this fantastic AJAX products filter plugin for WooCommerce. Add unlimited filters with one widget.
|
6 |
+
* Version: 1.1.6
|
7 |
* Author: BeRocket
|
8 |
* Author URI: http://berocket.com
|
9 |
* Text Domain: BeRocket_AJAX_domain
|
10 |
* Domain Path: /languages/
|
11 |
*/
|
12 |
|
13 |
+
define( "BeRocket_AJAX_filters_version", '1.1.6' );
|
14 |
define( "BeRocket_AJAX_domain", 'BeRocket_AJAX_domain' );
|
15 |
|
16 |
define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
|
34 |
"filters_turn_off" => "0",
|
35 |
"seo_friendly_urls" => "0"
|
36 |
);
|
37 |
+
public static $values = array(
|
38 |
+
'settings_name' => '',
|
39 |
+
'option_page' => 'br-product-filters',
|
40 |
+
'premium_slug' => 'woocommerce-ajax-products-filter',
|
41 |
+
);
|
42 |
|
43 |
function __construct(){
|
44 |
register_activation_hook(__FILE__, array( __CLASS__, 'br_add_defaults' ) );
|
64 |
add_action( 'wp_footer', array( 'BeRocket_AAPF_Widget', 'end_clean'), 999999 );
|
65 |
add_action( 'init', array( 'BeRocket_AAPF_Widget', 'start_clean'), 1 );
|
66 |
}
|
67 |
+
add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 );
|
68 |
+
$plugin_base_slug = plugin_basename( __FILE__ );
|
69 |
+
add_filter( 'plugin_action_links_' . $plugin_base_slug, array( __CLASS__, 'plugin_action_links' ) );
|
70 |
} else {
|
71 |
if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
72 |
add_action( 'admin_notices', array( __CLASS__, 'update_woocommerce' ) );
|
75 |
}
|
76 |
}
|
77 |
}
|
78 |
+
public static function plugin_action_links($links) {
|
79 |
+
$action_links = array(
|
80 |
+
'settings' => '<a href="' . admin_url( 'admin.php?page='.self::$values['option_page'] ) . '" title="' . __( 'View Plugin Settings', 'BeRocket_products_label_domain' ) . '">' . __( 'Settings', 'BeRocket_products_label_domain' ) . '</a>',
|
81 |
+
);
|
82 |
+
return array_merge( $action_links, $links );
|
83 |
+
}
|
84 |
+
public static function plugin_row_meta($links, $file) {
|
85 |
+
$plugin_base_slug = plugin_basename( __FILE__ );
|
86 |
+
if ( $file == $plugin_base_slug ) {
|
87 |
+
$row_meta = array(
|
88 |
+
'docs' => '<a href="http://berocket.com/docs/plugin/'.self::$values['premium_slug'].'" title="' . __( 'View Plugin Documentation', 'BeRocket_products_label_domain' ) . '" target="_blank">' . __( 'Docs', 'BeRocket_products_label_domain' ) . '</a>',
|
89 |
+
'premium' => '<a href="http://berocket.com/product/'.self::$values['premium_slug'].'" title="' . __( 'View Premium Version Page', 'BeRocket_products_label_domain' ) . '" target="_blank">' . __( 'Premium Version', 'BeRocket_products_label_domain' ) . '</a>',
|
90 |
+
);
|
91 |
+
|
92 |
+
return array_merge( $links, $row_meta );
|
93 |
+
}
|
94 |
+
return (array) $links;
|
95 |
+
}
|
96 |
|
97 |
public static function init() {
|
98 |
|
159 |
wp_enqueue_style( 'berocket_aapf_widget-colorpicker-style' );
|
160 |
wp_enqueue_style( 'berocket_aapf_widget-admin-style' );
|
161 |
|
162 |
+
$plugin_info = get_plugin_data(__FILE__, false, true);
|
163 |
include AAPF_TEMPLATE_PATH . "admin-settings.php";
|
164 |
}
|
165 |
|
170 |
|
171 |
if ( @ $_POST['price'] ) {
|
172 |
list( $_GET['min_price'], $_GET['max_price'] ) = $_POST['price'];
|
173 |
+
add_filter( 'loop_shop_post_in', array( __CLASS__, 'price_filter' ) );
|
174 |
}
|
175 |
}
|
176 |
}
|
184 |
|
185 |
if ( @ $_POST['price'] ) {
|
186 |
list( $_GET['min_price'], $_GET['max_price'] ) = $_POST['price'];
|
187 |
+
add_filter( 'loop_shop_post_in', array( __CLASS__, 'price_filter' ) );
|
188 |
}
|
189 |
|
190 |
if ( @ $_POST['limits'] ) {
|