Advanced AJAX Product Filters - Version 1.6

Version Description

  • Enhancement - Less database queries
  • Enhancement - Optimization for database queries. Speed up request to database
  • Enhancement - Updated Additional tables for optimized requests and more correct filtering
  • Enhancement - Possibility to filter any products request on the page with help of shortcode [brapf_next_shortcode_apply]
  • Enhancement - Support for some page builders products elements with shortcode [brapf_next_shortcode_apply]
  • Enhancement - Hide reset products button on page load with help of CSS code
  • Enhancement - (DEV) New data for filtered page to get more control on selected elements
  • Enhancement - Removed Deprecated Filters Add-on
  • Fix - Multiple blocks with products in Divi Page Builder, when only single block must be filtered
  • Fix - Stock status "On Backorder" work as "In stock" for filtering
Download this release

Release Info

Developer RazyRx
Plugin Icon wp plugin Advanced AJAX Product Filters
Version 1.6
Comparing to
See all releases

Code changes from version 1.6beta to 1.6

addons/additional_tables/additional_tables.php CHANGED
@@ -539,13 +539,10 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
539
  $run_data['run'] = true;
540
  $variable_taxonomy = get_term_by('slug', 'variable', 'product_type');
541
  $this->set_current_create_position_data($run_data);
542
- $start_id = intval($run_data['start_id']);
543
- $min_id = intval($run_data['min_id']);
544
- $max_id = intval($run_data['max_id']);
545
- $end_id = $start_id + apply_filters('berocket_insert_table_braapf_variable_attributes_end', 2000);
546
  BeRocket_error_notices::add_plugin_error(1, 'insert_table_braapf_variable_attributes', array(
547
- 'start_id' => $start_id,
548
- 'end_id' => $end_id,
549
  ));
550
  global $wpdb;
551
  $table_name = $wpdb->prefix . 'braapf_variable_attributes';
@@ -554,9 +551,12 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
554
  $sql_select = "SELECT {$wpdb->posts}.ID as id, {$wpdb->postmeta}.meta_value as value FROM {$wpdb->posts}
555
  JOIN {$wpdb->postmeta} ON {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id
556
  JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id
557
- WHERE {$wpdb->posts}.ID >= {$start_id} AND {$wpdb->posts}.ID < {$end_id} AND {$wpdb->postmeta}.meta_key = '_product_attributes' AND {$wpdb->term_relationships}.term_taxonomy_id = {$variable_taxonomy->term_taxonomy_id}";
 
558
  $results = $wpdb->get_results($sql_select);
559
- if( ! empty($results) && is_array($results) ) {
 
 
560
  $insert_values = array();
561
  foreach($results as $product) {
562
  $product_attribute = maybe_unserialize($product->value);
@@ -577,33 +577,10 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
577
  }
578
  }
579
  }
580
- $sql_select = "SELECT {$table_name}.post_id as post_id,
581
- {$table_name}.post_id as parent_id,
582
- {$table_name}.attribute as meta_key,
583
- {$wpdb->term_taxonomy}.term_id as meta_value_id,
584
- 0 as stock_status
585
- FROM {$table_name}
586
- JOIN {$wpdb->term_relationships} ON {$table_name}.post_id = {$wpdb->term_relationships}.object_id
587
- JOIN {$wpdb->term_taxonomy} ON {$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id AND {$wpdb->term_taxonomy}.taxonomy = {$table_name}.attribute
588
- LEFT JOIN {$wpdb->prefix}braapf_product_variation_attributes ON {$wpdb->prefix}braapf_product_variation_attributes.parent_id = {$table_name}.post_id AND {$wpdb->prefix}braapf_product_variation_attributes.meta_value_id = {$wpdb->term_taxonomy}.term_id
589
- WHERE {$wpdb->prefix}braapf_product_variation_attributes.meta_value_id IS NULL
590
- AND {$table_name}.post_id >= {$start_id} AND {$table_name}.post_id";
591
- $test_row = $wpdb->get_row($sql_select);
592
- if( ! empty($test_row) ) {
593
- $sql = "INSERT IGNORE INTO {$wpdb->prefix}braapf_product_variation_attributes {$sql_select}";
594
- $query_status = $wpdb->query($sql);
595
- if( $query_status === FALSE ) {
596
- $this->save_query_error($sql);
597
- }
598
- }
599
- $status = max(0, min(100, (($end_id - $min_id) / (($max_id - $min_id) == 0 ? 1 : ($max_id - $min_id)) * 100)));
600
- if( $end_id <= $max_id ) {
601
  $this->set_current_create_position_data(array(
602
- 'status' => $status,
603
  'run' => false,
604
- 'start_id' => $end_id,
605
- 'min_id' => $min_id,
606
- 'max_id' => $max_id
607
  ));
608
  } else {
609
  $this->set_current_create_position(5);
539
  $run_data['run'] = true;
540
  $variable_taxonomy = get_term_by('slug', 'variable', 'product_type');
541
  $this->set_current_create_position_data($run_data);
542
+ $page = (isset($run_data['page']) ? $run_data['page'] : 0);
543
+ $page_step = apply_filters('berocket_insert_table_braapf_variable_attributes_end', 1000);
 
 
544
  BeRocket_error_notices::add_plugin_error(1, 'insert_table_braapf_variable_attributes', array(
545
+ 'page' => $page
 
546
  ));
547
  global $wpdb;
548
  $table_name = $wpdb->prefix . 'braapf_variable_attributes';
551
  $sql_select = "SELECT {$wpdb->posts}.ID as id, {$wpdb->postmeta}.meta_value as value FROM {$wpdb->posts}
552
  JOIN {$wpdb->postmeta} ON {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id
553
  JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id
554
+ WHERE {$wpdb->postmeta}.meta_key = '_product_attributes' AND {$wpdb->term_relationships}.term_taxonomy_id = {$variable_taxonomy->term_taxonomy_id}
555
+ LIMIT ".($page * $page_step).", {$page_step}";
556
  $results = $wpdb->get_results($sql_select);
557
+ $has_result = false;
558
+ if( ! empty($results) && is_array($results) && count($results) > 0 ) {
559
+ $has_result = true;
560
  $insert_values = array();
561
  foreach($results as $product) {
562
  $product_attribute = maybe_unserialize($product->value);
577
  }
578
  }
579
  }
580
+ if( $has_result ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
581
  $this->set_current_create_position_data(array(
 
582
  'run' => false,
583
+ 'page' => ++$page
 
 
584
  ));
585
  } else {
586
  $this->set_current_create_position(5);
berocket/framework.php CHANGED
@@ -35,8 +35,8 @@ if( ! class_exists( 'BeRocket_Framework' ) ) {
35
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
36
  load_plugin_textdomain('BeRocket_domain', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
37
  class BeRocket_Framework {
38
- public static $framework_version = '2.7.3';
39
- public $plugin_framework_version = '2.7.3';
40
  public static $settings_name = '';
41
  public $addons;
42
  public $libraries;
@@ -133,6 +133,11 @@ if( ! class_exists( 'BeRocket_Framework' ) ) {
133
  $framework_version = $framework_version_current;
134
  include($this->info['plugin_dir']."/berocket/framework_version.php");
135
  $this->plugin_framework_version = $framework_version_current;
 
 
 
 
 
136
  }
137
  do_action($this->info[ 'plugin_name' ].'_framework_construct', $this->cc);
138
  add_filter('brfr_get_plugin_version_capability_'.$this->cc->info['plugin_name'], array($this, 'get_plugin_version_capability'));
35
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
36
  load_plugin_textdomain('BeRocket_domain', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
37
  class BeRocket_Framework {
38
+ public static $framework_version = '2.7.4';
39
+ public $plugin_framework_version = '2.7.4';
40
  public static $settings_name = '';
41
  public $addons;
42
  public $libraries;
133
  $framework_version = $framework_version_current;
134
  include($this->info['plugin_dir']."/berocket/framework_version.php");
135
  $this->plugin_framework_version = $framework_version_current;
136
+ if( $this->plugin_version_capability < 10 ) {
137
+ if( file_exists(plugin_dir_path( __FILE__ ) . 'sale/sale.php') ) {
138
+ include_once( plugin_dir_path( __FILE__ ) . 'sale/sale.php');
139
+ }
140
+ }
141
  }
142
  do_action($this->info[ 'plugin_name' ].'_framework_construct', $this->cc);
143
  add_filter('brfr_get_plugin_version_capability_'.$this->cc->info['plugin_name'], array($this, 'get_plugin_version_capability'));
berocket/framework_version.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $framework_version_current = '2.7.3';
3
  if( version_compare($framework_version_current, $framework_version, '>') ) {
4
  $framework_version = $framework_version_current;
5
  $framework_dir = __DIR__;
1
  <?php
2
+ $framework_version_current = '2.7.4';
3
  if( version_compare($framework_version_current, $framework_version, '>') ) {
4
  $framework_version = $framework_version_current;
5
  $framework_dir = __DIR__;
berocket/includes/admin_notices.php CHANGED
@@ -1206,17 +1206,48 @@ if( ! class_exists( 'berocket_admin_notices_rate_stars' ) ) {
1206
 
1207
  function show_ad_above_admin_settings($plugin_version_capability, $cur_plugin) {
1208
  if( $plugin_version_capability < 10 ) {
1209
- $plugin = $this->get_plugin_data($cur_plugin->info['id']);
1210
- if( $plugin === false ) {
1211
- $plugin = $this->get_plugin_data(1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1212
  }
1213
  echo "
1214
- <div class='berocket-above-settings-banner'>
1215
- <h1>{$plugin['title']}</h1>
1216
- " . (empty($plugin['image_top']) ? '' : "<img src='{$plugin['image_top']}' alt='{$plugin['title']}' />" ) . "
1217
- <p>".(empty($plugin['desc_top']) ? $plugin['desc'] : $plugin['desc_top'])."</p>
1218
- <a href='{$plugin['url']}?utm_source=free_plugin&utm_medium=settings&utm_campaign={$cur_plugin->info['plugin_name']}&utm_content=top' target='_blank'>" . __('Get it now', 'BeRocket_domain') . "</a>
1219
- </div>
1220
  <style>
1221
  .berocket-above-settings-banner {
1222
  width: 100%;
@@ -1264,6 +1295,139 @@ if( ! class_exists( 'berocket_admin_notices_rate_stars' ) ) {
1264
  border: 2px solid #ff5252;
1265
  color: white;
1266
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1267
  </style>
1268
  ";
1269
  }
1206
 
1207
  function show_ad_above_admin_settings($plugin_version_capability, $cur_plugin) {
1208
  if( $plugin_version_capability < 10 ) {
1209
+ $plugin = $this->get_plugin_data($cur_plugin->info['id']);
1210
+ if( $plugin === false ) {
1211
+ $plugin = $this->get_plugin_data( 1 );
1212
+ }
1213
+ if ( time() > 1637841600 and time() < 1637841600+302400 ) {
1214
+ echo "
1215
+ <div class='berocket-above-settings-banner' style='background: #1a1a1a; padding: 0;'>
1216
+ <a href='{$plugin['url']}?utm_source=free_plugin&utm_medium=settings&utm_campaign={$cur_plugin->info['plugin_name']}&utm_content=top' target='_blank'
1217
+ style='background: transparent; width: auto; border: 0 none; box-shadow: none; padding: 0; margin: 0;'>
1218
+ <img alt='{$plugin['title']}' src='https://berocket.ams3.cdn.digitaloceanspaces.com/g/bf21-1202x280.jpg' style='display: block;'>
1219
+ </a>
1220
+ </div>";
1221
+ } else if ( time() > 1637841600+302400 and time() < 1637841600+302400+518400 ) {
1222
+ echo "
1223
+ <div class='berocket-above-settings-banner berocket-cm21-settings-wrapper' style='background: #07002e; padding: 0;'>
1224
+ <a href='{$plugin['url']}?utm_source=free_plugin&utm_medium=settings&utm_campaign={$cur_plugin->info['plugin_name']}&utm_content=top' target='_blank' >
1225
+ <img alt='{$plugin['title']}' src='https://berocket.ams3.cdn.digitaloceanspaces.com/g/cm21.jpg'>
1226
+ <div class='berocket-cm21-settings'>
1227
+ <div class='berocket-cm21-settings-header'>
1228
+ <p>Don't lose another 5% of the discount. Purchase now!</p>
1229
+ </div>
1230
+ <p style='top: 30%; left: 6%; '><span>Monday: <span style='padding-left: 20px; font-size: 1.25em; font-weight: bold;'>-30%</span></span></p>
1231
+ <p style='top: 32%; left: 55%;'><span>Tuesday: <span style='padding-left: 15px; font-size: 1.2em; font-weight: bold;'>-25%</span></span></p>
1232
+ <p style='top: 48%; left: 10%;'><span>Wednesday: <span style='padding-left: 5px; font-size: 1.15em'>-20%</span></span></p>
1233
+ <p style='top: 50%; left: 59%;'><span>Thursday: <span style='padding-left: 10px; font-size: 1.1em'>-15%</span></span></p>
1234
+ <p style='top: 66%; left: 16%;'><span>Friday: <span style='padding-left: 20px; font-size: 0.9em'>-10%</span></span></p>
1235
+ <p style='top: 68%; left: 63%;'><span>Saturday: <span style='padding-left: 15px; font-size: 0.9em'>-5%</span></span></p>
1236
+ </div>
1237
+ <div class='berocket-cm21-settings-mobiles-title' style='display: none;'>Up to 30% off sitewide!</div>
1238
+ </a>
1239
+ </div>";
1240
+ } else {
1241
+ echo "
1242
+ <div class='berocket-above-settings-banner'>
1243
+ <h1>{$plugin['title']}</h1>
1244
+ " . ( empty( $plugin['image_top'] ) ? '' : "<img src='{$plugin['image_top']}' alt='{$plugin['title']}' />" ) . "
1245
+ <p>" . ( empty( $plugin['desc_top'] ) ? $plugin['desc'] : $plugin['desc_top'] ) . "</p>
1246
+ <a href='{$plugin['url']}?utm_source=free_plugin&utm_medium=settings&utm_campaign={$cur_plugin->info['plugin_name']}&utm_content=top' target='_blank'>" . __( 'Get it now', 'BeRocket_domain' ) . "</a>
1247
+ </div>
1248
+ ";
1249
  }
1250
  echo "
 
 
 
 
 
 
1251
  <style>
1252
  .berocket-above-settings-banner {
1253
  width: 100%;
1295
  border: 2px solid #ff5252;
1296
  color: white;
1297
  }
1298
+ .berocket-cm21-settings {
1299
+ text-align: left;
1300
+ position: relative;
1301
+ }
1302
+ .berocket-cm21-settings > p{
1303
+ font-size: 1.1em;
1304
+ position: absolute;
1305
+ }
1306
+ .berocket-cm21-settings > p > span {
1307
+ position: relative;
1308
+ z-index: 100;
1309
+ }
1310
+ .berocket-cm21-settings > p:after {
1311
+ content: '';
1312
+ position: absolute;
1313
+ left: -10px;
1314
+ bottom: -2px;
1315
+ background: linear-gradient(106deg, #ff30b8, #ffe390 50%, #41ebfd);
1316
+ height: 10px;
1317
+ width: 50%;
1318
+ transform: skewX(-20deg);
1319
+ }
1320
+ .berocket-cm21-settings > p:before {
1321
+ content: '';
1322
+ position: absolute;
1323
+ left: -8px;
1324
+ bottom: 0;
1325
+ background: #07002e;
1326
+ height: 10px;
1327
+ width: 50%;
1328
+ transform: skewX(-20deg);
1329
+ z-index: 10;
1330
+ }
1331
+ .berocket-cm21-settings-header {
1332
+ margin-top: 20px;
1333
+ background: linear-gradient(106deg, #ff30b8, #ffe390 50%, #41ebfd);
1334
+ padding: 3px;
1335
+ }
1336
+ .berocket-cm21-settings-header p {
1337
+ font-size: 1.2em;
1338
+ background: #07002e;
1339
+ margin: 0;
1340
+ padding: 12px 18px;
1341
+ }
1342
+ .berocket-cm21-settings-wrapper > a {
1343
+ background: linear-gradient(46deg, #07002e 50%, #f743f4);
1344
+ width: auto;
1345
+ border: 0 none;
1346
+ box-shadow: none;
1347
+ padding: 0;
1348
+ margin: 0;
1349
+ display: flex;
1350
+ }
1351
+ @media (max-width: 1500px) {
1352
+ .berocket-above-settings-banner a img {
1353
+ max-height: 200px;
1354
+ }
1355
+ .berocket-cm21-settings-wrapper > a {
1356
+ background: linear-gradient(46deg, #07002e 75%, #f743f4);
1357
+ }
1358
+ .berocket-cm21-settings-header {
1359
+ padding: 2px;
1360
+ }
1361
+ .berocket-cm21-settings-header p {
1362
+ font-size: 1.1em;
1363
+ padding: 9px 14px;
1364
+ }
1365
+ }
1366
+ @media (max-width: 1200px) {
1367
+ .berocket-above-settings-banner a img {
1368
+ max-height: 150px;
1369
+ max-width: 100%;
1370
+ }
1371
+ .berocket-cm21-settings-header {
1372
+ margin-top: 10px;
1373
+ margin-left: -35px;
1374
+ }
1375
+ .berocket-cm21-settings-header p {
1376
+ font-size: 1em;
1377
+ padding: 6px 11px;
1378
+ }
1379
+ .berocket-cm21-settings > p {
1380
+ font-size: 0.8em;
1381
+ }
1382
+ }
1383
+ @media (max-width: 1200px) {
1384
+ .berocket-cm21-settings-wrapper a img {
1385
+ width: 240px;
1386
+ object-fit: cover;
1387
+ height: 150px;
1388
+ }
1389
+ .berocket-cm21-settings-header {
1390
+ margin-left: -15px;
1391
+ }
1392
+ .berocket-cm21-settings > p {
1393
+ margin-top: 10px;
1394
+ }
1395
+ }
1396
+ @media (max-width: 728px) {
1397
+ .berocket-cm21-settings-header {
1398
+ display: block;
1399
+ height: 1px;
1400
+ overflow: hidden;
1401
+ border: 0;
1402
+ padding: 0;
1403
+ background: transparent;
1404
+ }
1405
+ .berocket-cm21-settings-header p{
1406
+ background: transparent;
1407
+ }
1408
+ .berocket-cm21-settings > p {
1409
+ margin-top: -15px;
1410
+ margin-bottom: 30px;
1411
+ margin-left: -10px;
1412
+ }
1413
+ .berocket-cm21-settings > p:nth-child(2n+1) {
1414
+ margin-left: -40px;
1415
+ }
1416
+ }
1417
+ @media (max-width: 620px) {
1418
+ .berocket-cm21-settings > p {
1419
+ display: none;
1420
+ }
1421
+ .berocket-cm21-settings-wrapper > a {
1422
+ display: block;
1423
+ background: linear-gradient(180deg, #07002e 75%, #5b0b5a);
1424
+ }
1425
+ .berocket-cm21-settings-mobiles-title {
1426
+ display: block !important;
1427
+ padding: 10px 10px 30px;
1428
+ font-size: 20px;
1429
+ }
1430
+ }
1431
  </style>
1432
  ";
1433
  }
berocket/includes/updater.php CHANGED
@@ -538,6 +538,42 @@ if ( ! class_exists( 'BeRocket_updater' ) ) {
538
  } else {
539
  $plugins_key = array();
540
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  ?>
542
  <h2><?php _e('BeRocket Account Settings', 'BeRocket_domain'); ?></h2>
543
  <div>
538
  } else {
539
  $plugins_key = array();
540
  }
541
+ $has_free = false;
542
+ foreach(self::$plugin_info as $plugin) {
543
+ if( $plugin['version_capability'] < 10 ) {
544
+ $has_free = true;
545
+ }
546
+ }
547
+ if( $has_free ) {
548
+ if ( time() > 1637841600 and time() < 1637841600+302400 ) {
549
+ echo "
550
+ <div class='berocket-above-settings-banner' style='background: #1a1a1a; padding: 0;'>
551
+ <a href='https://berocket.com/products?utm_source=free_plugin&utm_medium=settings&utm_campaign=account_keys&utm_content=top' target='_blank'
552
+ style='background: transparent; width: auto; border: 0 none; box-shadow: none; padding: 0; margin: 0;'>
553
+ <img alt='BeRocket Products' src='https://berocket.ams3.cdn.digitaloceanspaces.com/g/bf21-1202x280.jpg' style='display: block;'>
554
+ </a>
555
+ </div>";
556
+ } else if ( time() > 1637841600+302400 and time() < 1637841600+302400+518400 ) {
557
+ echo "
558
+ <div class='berocket-above-settings-banner berocket-cm21-settings-wrapper' style='background: #07002e; padding: 0;'>
559
+ <a href='https://berocket.com/products?utm_source=free_plugin&utm_medium=settings&utm_campaign=account_keys&utm_content=top' target='_blank' >
560
+ <img alt='BeRocket Products' src='https://berocket.ams3.cdn.digitaloceanspaces.com/g/cm21.jpg'>
561
+ <div class='berocket-cm21-settings'>
562
+ <div class='berocket-cm21-settings-header'>
563
+ <p>Don't lose another 5% of the discount. Purchase now!</p>
564
+ </div>
565
+ <p style='top: 30%; left: 6%; '><span>Monday: <span style='padding-left: 20px; font-size: 1.25em; font-weight: bold;'>-30%</span></span></p>
566
+ <p style='top: 32%; left: 55%;'><span>Tuesday: <span style='padding-left: 15px; font-size: 1.2em; font-weight: bold;'>-25%</span></span></p>
567
+ <p style='top: 48%; left: 10%;'><span>Wednesday: <span style='padding-left: 5px; font-size: 1.15em'>-20%</span></span></p>
568
+ <p style='top: 50%; left: 59%;'><span>Thursday: <span style='padding-left: 10px; font-size: 1.1em'>-15%</span></span></p>
569
+ <p style='top: 66%; left: 16%;'><span>Friday: <span style='padding-left: 20px; font-size: 0.9em'>-10%</span></span></p>
570
+ <p style='top: 68%; left: 63%;'><span>Saturday: <span style='padding-left: 15px; font-size: 0.9em'>-5%</span></span></p>
571
+ </div>
572
+ <div class='berocket-cm21-settings-mobiles-title' style='display: none;'>Up to 30% off sitewide!</div>
573
+ </a>
574
+ </div>";
575
+ }
576
+ }
577
  ?>
578
  <h2><?php _e('BeRocket Account Settings', 'BeRocket_domain'); ?></h2>
579
  <div>
berocket/sale/cyber.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #adminmenu .toplevel_page_berocket_account,
2
+ #adminmenu .toplevel_page_berocket_account .wp-menu-arrow {
3
+ background-color: #07002E!important;
4
+ }
5
+ #adminmenu .toplevel_page_berocket_account .wp-menu-name:after {
6
+ content: "";
7
+ background: url(https://berocket.ams3.cdn.digitaloceanspaces.com/g/cm21-xs.jpg);
8
+ display: inline-block;
9
+ height: 34px;
10
+ width: 51px;
11
+ position: absolute;
12
+ top: 50%;
13
+ margin-top: -17px;
14
+ right: 8px;
15
+ background-size: cover;
16
+ }
berocket/sale/friday.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #adminmenu .toplevel_page_berocket_account,
2
+ #adminmenu .toplevel_page_berocket_account .wp-menu-arrow {
3
+ background-color: #1A1A1A!important;
4
+ }
5
+ #adminmenu .toplevel_page_berocket_account .wp-menu-name:after {
6
+ content: "";
7
+ background: url(https://berocket.ams3.cdn.digitaloceanspaces.com/g/present.png);
8
+ display: inline-block;
9
+ height: 34px;
10
+ width: 40px;
11
+ position: absolute;
12
+ top: 50%;
13
+ margin-top: -17px;
14
+ right: 8px;
15
+ background-size: cover;
16
+ }
berocket/sale/sale.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class BeRocket_framework_sale_style {
3
+ function __construct() {
4
+ add_action('admin_enqueue_scripts', array($this, 'add_style'));
5
+ }
6
+ function add_style() {
7
+ if( time() > 1637841600 and time() < 1637841600+302400 ) {
8
+ wp_register_style(
9
+ 'BeRocket_framework_sale_style',
10
+ plugins_url( 'friday.css', __FILE__ ),
11
+ "",
12
+ BeRocket_Framework::$framework_version
13
+ );
14
+ wp_enqueue_style( 'BeRocket_framework_sale_style' );
15
+ }
16
+ if( time() > 1637841600+302400 and time() < 1637841600+302400+518400 ) {
17
+ wp_register_style(
18
+ 'BeRocket_framework_sale_style',
19
+ plugins_url( 'cyber.css', __FILE__ ),
20
+ "",
21
+ BeRocket_Framework::$framework_version
22
+ );
23
+ wp_enqueue_style( 'BeRocket_framework_sale_style' );
24
+ }
25
+ }
26
+ }
27
+ new BeRocket_framework_sale_style();
includes/compatibility/bodycommerce.php CHANGED
@@ -2,8 +2,18 @@
2
  if ( ! function_exists('berocket_aapf_bodycommerce_archive_module_args') ) {
3
  add_filter('db_archive_module_args', 'berocket_aapf_bodycommerce_archive_module_args');
4
  function berocket_aapf_bodycommerce_archive_module_args( $new_args ) {
 
 
 
 
 
 
 
 
 
 
 
5
  $new_args = apply_filters('bapf_uparse_apply_filters_to_query_vars_save', $new_args);
6
-
7
  return $new_args;
8
  }
9
  }
2
  if ( ! function_exists('berocket_aapf_bodycommerce_archive_module_args') ) {
3
  add_filter('db_archive_module_args', 'berocket_aapf_bodycommerce_archive_module_args');
4
  function berocket_aapf_bodycommerce_archive_module_args( $new_args ) {
5
+ $unset_values = array(
6
+ 'bapf_tax_applied',
7
+ 'bapf_meta_applied',
8
+ 'bapf_postin_applied',
9
+ 'bapf_postnotin_applied'
10
+ );
11
+ foreach( $unset_values as $unset_value ) {
12
+ if( isset($new_args[$unset_value]) ) {
13
+ unset($new_args[$unset_value]);
14
+ }
15
+ }
16
  $new_args = apply_filters('bapf_uparse_apply_filters_to_query_vars_save', $new_args);
 
17
  return $new_args;
18
  }
19
  }
includes/compatibility/relevanssi.php CHANGED
@@ -5,6 +5,7 @@ if( ! class_exists('BeRocket_AAPF_compat_Relevanssi') ) {
5
  if( function_exists('relevanssi_do_query') ) {
6
  remove_filter('berocket_aapf_recount_terms_query', array('BeRocket_AAPF_faster_attribute_recount', 'search_query'), 50, 3);
7
  add_filter('berocket_aapf_recount_terms_query', array(__CLASS__, 'search_query'), 50, 3);
 
8
  add_filter('berocket_aapf_simple_recount_terms_query', array(__CLASS__, 'search_query_simple'), 50, 1);
9
  add_filter('bapf_query_count_before_update', array(__CLASS__, 'count_before_update'));
10
  add_filter('relevanssi_modify_wp_query', array(__CLASS__, 'relevanssi_query'));
@@ -67,36 +68,36 @@ if( ! class_exists('BeRocket_AAPF_compat_Relevanssi') ) {
67
  'join' => '',
68
  );
69
  $BeRocket_AAPF = BeRocket_AAPF::getInstance();
70
- $args = $BeRocket_AAPF->price_filter_post_clauses($args, $query);
71
- if( ! empty($args['where']) || ! empty($args['join']) ) {
72
- $args = array(
73
- 'fields' => "{$wpdb->posts}.ID",
74
- 'join' => '',
75
- 'where' => "{$wpdb->posts}.post_type = 'products'",
76
- 'groupby' => "{$wpdb->posts}.ID",
77
- 'distinct' => '',
78
- 'limits' => ''
79
- );
80
- $args = apply_filters('berocket_posts_clauses_recount', $args, FALSE, FALSE);
81
- $request = 'SELECT ' . $args['fields'] . " FROM {$wpdb->posts}";
82
- $request .= (empty($args['join']) ? '' : ' ' . $args['join']);
83
- $request .= (empty($args['where']) ? '' : ' ' . $args['where']);
84
- $request .= (empty($args['groupby']) ? '' : ' ' . $args['groupby']);
85
- $ids = $wpdb->get_col($request, 0);
86
- if( ! is_array($ids) || empty($ids) ) {
87
- $ids = array();
88
- }
89
- $posts_in = $query->get( 'post__in' );
90
- if( empty($posts_in) ) {
91
- $posts_in = $ids;
92
- } else {
93
- $posts_in = array_intersect($posts_in, $ids);
94
- }
95
- if( count($posts_in) == 0 ) {
96
- $posts_in = array(0);
97
- }
98
- $posts_in = $query->set( 'post__in', $posts_in );
99
  }
 
100
  return $query;
101
  }
102
  }
5
  if( function_exists('relevanssi_do_query') ) {
6
  remove_filter('berocket_aapf_recount_terms_query', array('BeRocket_AAPF_faster_attribute_recount', 'search_query'), 50, 3);
7
  add_filter('berocket_aapf_recount_terms_query', array(__CLASS__, 'search_query'), 50, 3);
8
+ add_filter('berocket_aapf_recount_price_query', array(__CLASS__, 'search_query_simple'), 50, 1);
9
  add_filter('berocket_aapf_simple_recount_terms_query', array(__CLASS__, 'search_query_simple'), 50, 1);
10
  add_filter('bapf_query_count_before_update', array(__CLASS__, 'count_before_update'));
11
  add_filter('relevanssi_modify_wp_query', array(__CLASS__, 'relevanssi_query'));
68
  'join' => '',
69
  );
70
  $BeRocket_AAPF = BeRocket_AAPF::getInstance();
71
+ $args_base = array(
72
+ 'fields' => "{$wpdb->posts}.ID",
73
+ 'join' => '',
74
+ 'where' => "{$wpdb->posts}.post_type = 'product'",
75
+ 'groupby' => "{$wpdb->posts}.ID",
76
+ 'distinct' => '',
77
+ 'limits' => ''
78
+ );
79
+ $args = apply_filters('berocket_posts_clauses_recount', $args_base, FALSE, FALSE);
80
+ if( $args === $args_base ) {
81
+ return $query;
82
+ }
83
+ $request = 'SELECT ' . $args['fields'] . " FROM {$wpdb->posts}";
84
+ $request .= (empty($args['join']) ? '' : ' ' . $args['join']);
85
+ $request .= (empty($args['where']) ? '' : ' ' . 'WHERE ' . $args['where']);
86
+ $request .= (empty($args['groupby']) ? '' : ' ' . 'GROUP BY ' . $args['groupby']);
87
+ $ids = $wpdb->get_col($request);
88
+ if( ! is_array($ids) || empty($ids) ) {
89
+ $ids = array();
90
+ }
91
+ $posts_in = $query->get( 'post__in' );
92
+ if( empty($posts_in) ) {
93
+ $posts_in = $ids;
94
+ } else {
95
+ $posts_in = array_intersect($posts_in, $ids);
96
+ }
97
+ if( count($posts_in) == 0 ) {
98
+ $posts_in = array(-1);
 
99
  }
100
+ $query->set( 'post__in', $posts_in );
101
  return $query;
102
  }
103
  }
includes/faster_recount.php CHANGED
@@ -104,7 +104,7 @@ class BeRocket_AAPF_faster_attribute_recount {
104
  if( BeRocket_AAPF::$debug_mode ) {
105
  $taxonomy_data['query_imploded'] = $query_imploded;
106
  $taxonomy_data['return_terms'] = $terms;
107
- $taxonomy_data['result'] = $result;
108
  BeRocket_AAPF::$error_log['faster_recount_sql'][] = $taxonomy_data;
109
  }
110
  do_action('bapf_faster_recount_after_recount_terms', $terms, $taxonomy_data);
@@ -136,7 +136,7 @@ class BeRocket_AAPF_faster_attribute_recount {
136
  self::$current_url_data = $berocket_parse_page_obj->get_current();
137
  if( ! empty($additional_data['use_filters']) ) {
138
  if( $additional_data['taxonomy_remove'] === false ) {
139
- $filter_data = $current_filter_data;
140
  } else {
141
  $filter_data = $berocket_parse_page_obj->remove_taxonomy(array('taxonomy' => $additional_data['taxonomy_remove']));
142
  }
104
  if( BeRocket_AAPF::$debug_mode ) {
105
  $taxonomy_data['query_imploded'] = $query_imploded;
106
  $taxonomy_data['return_terms'] = $terms;
107
+ $taxonomy_data['result'] = (isset($result) ? $result : 'cache');
108
  BeRocket_AAPF::$error_log['faster_recount_sql'][] = $taxonomy_data;
109
  }
110
  do_action('bapf_faster_recount_after_recount_terms', $terms, $taxonomy_data);
136
  self::$current_url_data = $berocket_parse_page_obj->get_current();
137
  if( ! empty($additional_data['use_filters']) ) {
138
  if( $additional_data['taxonomy_remove'] === false ) {
139
+ $filter_data = self::$current_url_data;
140
  } else {
141
  $filter_data = $berocket_parse_page_obj->remove_taxonomy(array('taxonomy' => $additional_data['taxonomy_remove']));
142
  }
includes/shortcode_apply_filters.php CHANGED
@@ -40,6 +40,18 @@ if( ! class_exists('BeRocket_AAPF_shortcode_apply_filters') ) {
40
  if( ! $this->is_query_product($post_type) ) return;
41
  $this->remove_all();
42
  $query->set('bapf_apply', true);
 
 
 
 
 
 
 
 
 
 
 
 
43
  }
44
  public function not_apply_filter_to_query($query) {
45
  $post_type = $query->get('post_type');
40
  if( ! $this->is_query_product($post_type) ) return;
41
  $this->remove_all();
42
  $query->set('bapf_apply', true);
43
+ $query->set('bapf_save_query', true);
44
+ $unset_values = array(
45
+ 'bapf_tax_applied',
46
+ 'bapf_meta_applied',
47
+ 'bapf_postin_applied',
48
+ 'bapf_postnotin_applied'
49
+ );
50
+ foreach( $unset_values as $unset_value ) {
51
+ if( isset($new_args[$unset_value]) ) {
52
+ $query->set($unset_value, false);
53
+ }
54
+ }
55
  }
56
  public function not_apply_filter_to_query($query) {
57
  $post_type = $query->get('post_type');
includes/url-parse.php CHANGED
@@ -105,7 +105,7 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
105
  add_action( 'wp_footer', array( $this, 'wp_footer_widget'), 99999 );
106
  }
107
  public function wp_footer_widget() {
108
- global $br_widget_ids;
109
  if( isset( $br_widget_ids ) && is_array( $br_widget_ids ) && count( $br_widget_ids ) > 0 ) {
110
  echo '<div class="berocket_wc_shortcode_fix" style="display: none;">';
111
  foreach ( $br_widget_ids as $widget ) {
@@ -136,6 +136,8 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
136
  return $query_vars;
137
  }
138
  public function query_vars_apply_filters_save($query_vars) {
 
 
139
  $query_vars = $this->query_vars_apply_filters($query_vars);
140
  return $query_vars;
141
  }
@@ -242,46 +244,62 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
242
  }
243
  }
244
  public function add_tax_query($query) {
245
- if( empty($query->query_vars['bapf_apply']) ) return;
 
 
 
246
  $args = $this->query_vars_tax_query($query->query_vars);
247
  $this->args_apply_to_query($query, $args);
248
  }
249
  public function add_meta_query($query) {
250
- if( empty($query->query_vars['bapf_apply']) ) return;
251
  $args = $this->query_vars_meta_query($query->query_vars);
252
  $this->args_apply_to_query($query, $args);
253
  }
254
  public function add_post_in($query) {
255
- if( empty($query->query_vars['bapf_apply']) ) return;
256
  $args = $this->query_vars_post_in($query->query_vars);
257
  $this->args_apply_to_query($query, $args);
258
  }
259
  public function add_post_not_in($query) {
260
- if( empty($query->query_vars['bapf_apply']) ) return;
261
  $args = $this->query_vars_post_not_in($query->query_vars);
262
  $this->args_apply_to_query($query, $args);
263
  }
264
  public function add_custom_query_line($query) {
265
- if( empty($query->query_vars['bapf_apply']) ) return;
266
  $args = $this->query_custom_query_line($query->query_vars);
267
  $this->args_apply_to_query($query, $args);
268
  }
269
  public function add_custom_args($query) {
270
- if( empty($query->query_vars['bapf_apply']) ) return;
271
  $args_list = $this->query_custom_args($query->query_vars);
272
  foreach($args_list as $args) {
273
  $this->args_apply_to_query($query, $args);
274
  }
275
  }
276
  public function add_custom_query($args, $query) {
277
- if( empty($query->query_vars['bapf_apply']) ) return $args;
278
- return $this->add_custom_query_without_check($args);
 
 
 
 
 
 
 
 
 
 
279
  }
280
  public function add_additional_args($query) {
281
- if( empty($query->query_vars['bapf_apply']) ) return;
282
  $args = apply_filters( 'bapf_uparse_query_vars_apply_filters', array(), $query->query_vars, $this->get_current() );
283
  $this->args_apply_to_query($query, $args);
284
  do_action('bapf_uparse_query_vars_ready', $query->query_vars);
 
 
 
285
  }
286
  public function add_custom_query_without_check($args) {
287
  $data = $this->get_current();
@@ -426,7 +444,9 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
426
  }
427
  $filter = apply_filters('', $filter, $data);
428
  }
429
- array_multisort($sort_array, $data['filters']);
 
 
430
  return $data;
431
  }
432
  public function parse_line($link = false) {
@@ -446,6 +466,12 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
446
  $data = $this->data_generate_global_filtering($data);
447
 
448
  $data = apply_filters('bapf_uparse_parse_line_modify', $data, $link);
 
 
 
 
 
 
449
  return $data;
450
  }
451
  public function get_link_from_data($data = false, $link = false, $args = false) {
@@ -558,6 +584,15 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
558
  return $link;
559
  }
560
  public function modify_data($args, $data = false) {
 
 
 
 
 
 
 
 
 
561
  $args = array_merge(array('values' => array(), 'type' => 'revert', 'op' => 'AND', 'calculate' => TRUE), $args);
562
  $data = $this->data_check($data);
563
  $result = apply_filters('bapf_uparse_modify_data', null, $this, $args, $data);
@@ -599,12 +634,24 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
599
  }
600
  if( ! empty($data['filters']) && is_array($data['filters']) && count($data['filters']) > 0 ) {
601
  foreach($data['filters'] as $filter_i => &$filter) {
 
 
 
 
 
602
  $result = apply_filters('bapf_uparse_modify_data_each', null, $this, $filter, $args, $data);
603
  if( $result !== null ) {
604
  unset($values[$value_i]);
605
  $filter = $this->back_generate($result, $data, $args);
606
  }
607
  foreach($values as $value_i => $value) {
 
 
 
 
 
 
 
608
  if($filter['taxonomy'] == $value['taxonomy'] && in_array($filter['type'], array('attribute', 'taxonomy')) ) {
609
  $position = false;
610
  if( isset($filter['val_arr']) && is_array($filter['val_arr']) ) {
@@ -743,7 +790,6 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
743
  } elseif( ! empty($_GET[$filter_var]) ) {
744
  $filter_line = $_GET[$filter_var];
745
  }
746
- $filter_line = berocket_sanitize_array($filter_line);
747
  $filter_line = urlencode($filter_line);
748
  $filter_line = str_replace('+', urlencode('+'), $filter_line);
749
  $filter_line = urldecode($filter_line);
@@ -770,10 +816,11 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
770
  $data['filters'][] = $single_filter;
771
  continue;
772
  }
 
773
  $data['filters'][] = array(
774
  'line' => $search[1][$i],
775
  'attr' => $search[2][$i],
776
- 'val' => $search[3][$i]
777
  );
778
  }
779
  }
@@ -1004,12 +1051,24 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
1004
  $tax_query['relation'] = $operator;
1005
  }
1006
  if( count($term_ids) > 0 ) {
1007
- $ids_tax_query = array(
1008
- 'taxonomy' => $filter['taxonomy'],
1009
- 'field' => 'id',
1010
- 'terms' => $term_ids,
1011
- 'operator' => ($operator == 'AND' ? 'AND' : 'IN')
1012
- );
 
 
 
 
 
 
 
 
 
 
 
 
1013
  if(empty($tax_query) ) {
1014
  $tax_query = $ids_tax_query;
1015
  } else {
@@ -1090,6 +1149,19 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
1090
  $count_terms_correct = count($terms_correct);
1091
  do {
1092
  $check_term = implode($values);
 
 
 
 
 
 
 
 
 
 
 
 
 
1093
  if( isset($terms[$check_term]) ) {
1094
  $terms_correct[] = $check_term;
1095
  if( $args['field'] == 'slug' ) {
@@ -1115,7 +1187,9 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
1115
  'operator' => $this->func_delimiter_to_operator($delimiter)
1116
  );
1117
  if( count($values_not_exist) > 0 ) {
1118
- $data['error'] = new WP_Error( 'bapf_uparse', __('Values not exist: ', 'BeRocket_AJAX_domain').implode($values_not_exist) );
 
 
1119
  }
1120
  }
1121
  }
@@ -1244,10 +1318,10 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
1244
  }
1245
  public function get_regex($return = false) {
1246
  $regex = apply_filters('bapf_uparse_regex', array(
1247
- 'filter' => '/((%val_sym%)\[(%val_sym%)\])(?:$|\|)/',
1248
- 'values' => '/[^%delimiters%]+|[%delimiters%]/',
1249
  'replacements' => array(
1250
- '%val_sym%' => '[\w+_*-]+',
1251
  '%delimiters%' => '\+_-'
1252
  )
1253
  ), $this);
@@ -1262,6 +1336,18 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
1262
  return ( empty($regex[$return]) ? '' : $regex[$return]);
1263
  }
1264
  }
 
 
 
 
 
 
 
 
 
 
 
 
1265
  }
1266
  new BeRocket_url_parse_page();
1267
  }
105
  add_action( 'wp_footer', array( $this, 'wp_footer_widget'), 99999 );
106
  }
107
  public function wp_footer_widget() {
108
+ global $br_widget_ids, $br_wc_query;
109
  if( isset( $br_widget_ids ) && is_array( $br_widget_ids ) && count( $br_widget_ids ) > 0 ) {
110
  echo '<div class="berocket_wc_shortcode_fix" style="display: none;">';
111
  foreach ( $br_widget_ids as $widget ) {
136
  return $query_vars;
137
  }
138
  public function query_vars_apply_filters_save($query_vars) {
139
+ $query_vars['bapf_apply'] = true;
140
+ $this->query_vars = $query_vars;
141
  $query_vars = $this->query_vars_apply_filters($query_vars);
142
  return $query_vars;
143
  }
244
  }
245
  }
246
  public function add_tax_query($query) {
247
+ if( ! $this->is_bapf_apply($query->query_vars) ) return;
248
+ if( ! empty($query->query_vars['bapf_save_query']) ) {
249
+ $this->query_vars = $query->query_vars;
250
+ }
251
  $args = $this->query_vars_tax_query($query->query_vars);
252
  $this->args_apply_to_query($query, $args);
253
  }
254
  public function add_meta_query($query) {
255
+ if( ! $this->is_bapf_apply($query->query_vars) ) return;
256
  $args = $this->query_vars_meta_query($query->query_vars);
257
  $this->args_apply_to_query($query, $args);
258
  }
259
  public function add_post_in($query) {
260
+ if( ! $this->is_bapf_apply($query->query_vars) ) return;
261
  $args = $this->query_vars_post_in($query->query_vars);
262
  $this->args_apply_to_query($query, $args);
263
  }
264
  public function add_post_not_in($query) {
265
+ if( ! $this->is_bapf_apply($query->query_vars) ) return;
266
  $args = $this->query_vars_post_not_in($query->query_vars);
267
  $this->args_apply_to_query($query, $args);
268
  }
269
  public function add_custom_query_line($query) {
270
+ if( ! $this->is_bapf_apply($query->query_vars) ) return;
271
  $args = $this->query_custom_query_line($query->query_vars);
272
  $this->args_apply_to_query($query, $args);
273
  }
274
  public function add_custom_args($query) {
275
+ if( ! $this->is_bapf_apply($query->query_vars) ) return;
276
  $args_list = $this->query_custom_args($query->query_vars);
277
  foreach($args_list as $args) {
278
  $this->args_apply_to_query($query, $args);
279
  }
280
  }
281
  public function add_custom_query($args, $query) {
282
+ if( ! $this->is_bapf_apply($query->query_vars) ) return $args;
283
+ $args = $this->add_custom_query_without_check($args);
284
+ if( BeRocket_AAPF::$debug_mode ) {
285
+ if( empty(BeRocket_AAPF::$error_log['filtered_queries']) || ! is_array(BeRocket_AAPF::$error_log['filtered_queries']) ) {
286
+ BeRocket_AAPF::$error_log['filtered_queries'] = array();
287
+ }
288
+ BeRocket_AAPF::$error_log['filtered_queries'][] = array(
289
+ 'args' => $args,
290
+ 'query' => $query,
291
+ );
292
+ }
293
+ return $args;
294
  }
295
  public function add_additional_args($query) {
296
+ if( ! $this->is_bapf_apply($query->query_vars) ) return;
297
  $args = apply_filters( 'bapf_uparse_query_vars_apply_filters', array(), $query->query_vars, $this->get_current() );
298
  $this->args_apply_to_query($query, $args);
299
  do_action('bapf_uparse_query_vars_ready', $query->query_vars);
300
+ if( ! empty($query->query_vars['bapf_save_query']) ) {
301
+ $this->save_shortcode_query_vars($query->query_vars);
302
+ }
303
  }
304
  public function add_custom_query_without_check($args) {
305
  $data = $this->get_current();
444
  }
445
  $filter = apply_filters('', $filter, $data);
446
  }
447
+ if( is_array($sort_array) && is_array($data['filters']) ) {
448
+ array_multisort($sort_array, $data['filters']);
449
+ }
450
  return $data;
451
  }
452
  public function parse_line($link = false) {
466
  $data = $this->data_generate_global_filtering($data);
467
 
468
  $data = apply_filters('bapf_uparse_parse_line_modify', $data, $link);
469
+ if( BeRocket_AAPF::$debug_mode ) {
470
+ if( empty(BeRocket_AAPF::$error_log['url_parse_data']) || ! is_array(BeRocket_AAPF::$error_log['url_parse_data']) ) {
471
+ BeRocket_AAPF::$error_log['url_parse_data'] = array();
472
+ }
473
+ BeRocket_AAPF::$error_log['url_parse_data'][] = $data;
474
+ }
475
  return $data;
476
  }
477
  public function get_link_from_data($data = false, $link = false, $args = false) {
584
  return $link;
585
  }
586
  public function modify_data($args, $data = false) {
587
+ if( BeRocket_AAPF::$debug_mode ) {
588
+ if( empty(BeRocket_AAPF::$error_log['url_parse_modify_data']) || ! is_array(BeRocket_AAPF::$error_log['url_parse_modify_data']) ) {
589
+ BeRocket_AAPF::$error_log['url_parse_modify_data'] = array();
590
+ }
591
+ BeRocket_AAPF::$error_log['url_parse_modify_data'][] = array(
592
+ 'args' => $args,
593
+ 'data' => $data
594
+ );
595
+ }
596
  $args = array_merge(array('values' => array(), 'type' => 'revert', 'op' => 'AND', 'calculate' => TRUE), $args);
597
  $data = $this->data_check($data);
598
  $result = apply_filters('bapf_uparse_modify_data', null, $this, $args, $data);
634
  }
635
  if( ! empty($data['filters']) && is_array($data['filters']) && count($data['filters']) > 0 ) {
636
  foreach($data['filters'] as $filter_i => &$filter) {
637
+ if( ! isset($filter['taxonomy']) ) {
638
+ BeRocket_error_notices::add_plugin_error(1, 'Cannot detect taxonomy on Data Modify', array(
639
+ 'filter' => $filter
640
+ ));
641
+ }
642
  $result = apply_filters('bapf_uparse_modify_data_each', null, $this, $filter, $args, $data);
643
  if( $result !== null ) {
644
  unset($values[$value_i]);
645
  $filter = $this->back_generate($result, $data, $args);
646
  }
647
  foreach($values as $value_i => $value) {
648
+ if( ! isset($value['taxonomy']) ) {
649
+ BeRocket_error_notices::add_plugin_error(1, 'Cannot detect taxonomy on Data Modify', array(
650
+ 'value' => $value,
651
+ 'args' => $args,
652
+ 'data' => $data
653
+ ));
654
+ }
655
  if($filter['taxonomy'] == $value['taxonomy'] && in_array($filter['type'], array('attribute', 'taxonomy')) ) {
656
  $position = false;
657
  if( isset($filter['val_arr']) && is_array($filter['val_arr']) ) {
790
  } elseif( ! empty($_GET[$filter_var]) ) {
791
  $filter_line = $_GET[$filter_var];
792
  }
 
793
  $filter_line = urlencode($filter_line);
794
  $filter_line = str_replace('+', urlencode('+'), $filter_line);
795
  $filter_line = urldecode($filter_line);
816
  $data['filters'][] = $single_filter;
817
  continue;
818
  }
819
+ $val = str_replace(array('%20', ' '), '+', $search[3][$i]);
820
  $data['filters'][] = array(
821
  'line' => $search[1][$i],
822
  'attr' => $search[2][$i],
823
+ 'val' => $val
824
  );
825
  }
826
  }
1051
  $tax_query['relation'] = $operator;
1052
  }
1053
  if( count($term_ids) > 0 ) {
1054
+ if( $operator == 'AND' ) {
1055
+ $ids_tax_query = array('relation' => 'AND');
1056
+ foreach($term_ids as $term_id) {
1057
+ $ids_tax_query[] = apply_filters('bapf_uparse_func_generate_tq_single_tax_query', array(
1058
+ 'taxonomy' => $filter['taxonomy'],
1059
+ 'field' => 'term_id',
1060
+ 'terms' => $term_id,
1061
+ 'operator' => 'IN',
1062
+ ), $this, $val_arr, $filter);
1063
+ }
1064
+ } else {
1065
+ $ids_tax_query = apply_filters('bapf_uparse_func_generate_tq_single_tax_query', array(
1066
+ 'taxonomy' => $filter['taxonomy'],
1067
+ 'field' => 'term_id',
1068
+ 'terms' => $term_ids,
1069
+ 'operator' => ($operator == 'AND' ? 'AND' : 'IN')
1070
+ ), $this, $val_arr, $filter);
1071
+ }
1072
  if(empty($tax_query) ) {
1073
  $tax_query = $ids_tax_query;
1074
  } else {
1149
  $count_terms_correct = count($terms_correct);
1150
  do {
1151
  $check_term = implode($values);
1152
+ $check_decoded = array(
1153
+ $check_term,
1154
+ strtolower($check_term),
1155
+ urldecode($check_term),
1156
+ urlencode($check_term),
1157
+ strtolower(urlencode($check_term))
1158
+ );
1159
+ foreach($check_decoded as $check_d) {
1160
+ if( isset($terms[$check_d]) ) {
1161
+ $check_term = $check_d;
1162
+ break;
1163
+ }
1164
+ }
1165
  if( isset($terms[$check_term]) ) {
1166
  $terms_correct[] = $check_term;
1167
  if( $args['field'] == 'slug' ) {
1187
  'operator' => $this->func_delimiter_to_operator($delimiter)
1188
  );
1189
  if( count($values_not_exist) > 0 ) {
1190
+ $data['error'] = new WP_Error( 'bapf_uparse', __('Values not exist: ', 'BeRocket_AJAX_domain').implode($values_not_exist), array(
1191
+ 'terms' => $terms
1192
+ ));
1193
  }
1194
  }
1195
  }
1318
  }
1319
  public function get_regex($return = false) {
1320
  $regex = apply_filters('bapf_uparse_regex', array(
1321
+ 'filter' => '/((%val_sym%)\[(%val_sym%)\])(?:$|\|)/u',
1322
+ 'values' => '/[^%delimiters%]+|[%delimiters%]/u',
1323
  'replacements' => array(
1324
+ '%val_sym%' => '[%\w+_*-]+',
1325
  '%delimiters%' => '\+_-'
1326
  )
1327
  ), $this);
1336
  return ( empty($regex[$return]) ? '' : $regex[$return]);
1337
  }
1338
  }
1339
+ public function is_bapf_apply($query_vars) {
1340
+ return ( ! empty($query_vars['bapf_apply']) && (empty($query_vars['post_type']) || $this->is_query_product($query_vars['post_type'])) );
1341
+ }
1342
+ public function is_query_product($post_type) {
1343
+ if( is_array($post_type) && count($post_type) > 1 ) {
1344
+ return false;
1345
+ } elseif(is_array($post_type)) {
1346
+ return array_pop($post_type) == 'product';
1347
+ } else {
1348
+ return $post_type == 'product';
1349
+ }
1350
+ }
1351
  }
1352
  new BeRocket_url_parse_page();
1353
  }
includes/widget_functions.php CHANGED
@@ -230,6 +230,7 @@ class BeRocket_AAPF_Widget_functions {
230
  $query['select']['elements']['price_range_count'] = "count(distinct($wpdb->posts.ID)) as product_count";
231
  $query['group'] = 'GROUP BY price_range';
232
  }
 
233
  $query['select']['elements']= implode(', ', $query['select']['elements']);
234
  $query['select'] = implode(' ', $query['select']);
235
  $query['join'] = implode(' ', $query['join']);
230
  $query['select']['elements']['price_range_count'] = "count(distinct($wpdb->posts.ID)) as product_count";
231
  $query['group'] = 'GROUP BY price_range';
232
  }
233
+ $query = apply_filters('berocket_aapf_recount_price_query', $query, $taxonomy_data, $price_ranges);
234
  $query['select']['elements']= implode(', ', $query['select']['elements']);
235
  $query['select'] = implode(' ', $query['select']);
236
  $query['join'] = implode(' ', $query['join']);
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://berocket.com/product/woocommerce-ajax-products-filter?utm_s
5
  Tags: filters, product filters, ajax product filters, ajax filter, ajax filter widget, color filter, size filter, product onsale filter, product preview, product category filter, product reset filter, product sort by filter, stock filter, product tag filter, price range filter, price box filter, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce products filter, woocommerce ajax product filters, widget, plugin, woocommerce item filters, filters plugin, ajax filters plugin, filter woocommerce products, filter woocommerce products plugin, wc filters, wc filters products, wc products filters, wc ajax products filters, wc product filters, wc advanced product filters, woocommerce layered nav, woocommerce layered navigation, ajax filtered nav, ajax filtered navigation, price filter, ajax price filter, woocommerce product sorting, sidebar filter, sidebar ajax filter, taxonomy filter, category filter, attribute filter, attributes filter, woocommerce product sort, ajax products filter plugin for woocommerce, rocket, berocket, berocket woocommerce ajax products filter
6
  Requires at least: 5.0
7
  Tested up to: 5.8
8
- Stable tag: 1.6beta
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -185,6 +185,18 @@ You can try this plugin's admin side [here](https://berocket.com/product/woocomm
185
 
186
  == Changelog ==
187
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  = 1.5.5.4 =
189
  * Enhancement - Added notice for deprecated filters add-on
190
  * Enhancement - Prepare for new update
5
  Tags: filters, product filters, ajax product filters, ajax filter, ajax filter widget, color filter, size filter, product onsale filter, product preview, product category filter, product reset filter, product sort by filter, stock filter, product tag filter, price range filter, price box filter, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce products filter, woocommerce ajax product filters, widget, plugin, woocommerce item filters, filters plugin, ajax filters plugin, filter woocommerce products, filter woocommerce products plugin, wc filters, wc filters products, wc products filters, wc ajax products filters, wc product filters, wc advanced product filters, woocommerce layered nav, woocommerce layered navigation, ajax filtered nav, ajax filtered navigation, price filter, ajax price filter, woocommerce product sorting, sidebar filter, sidebar ajax filter, taxonomy filter, category filter, attribute filter, attributes filter, woocommerce product sort, ajax products filter plugin for woocommerce, rocket, berocket, berocket woocommerce ajax products filter
6
  Requires at least: 5.0
7
  Tested up to: 5.8
8
+ Stable tag: 1.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
185
 
186
  == Changelog ==
187
 
188
+ = 1.6 =
189
+ * Enhancement - Less database queries
190
+ * Enhancement - Optimization for database queries. Speed up request to database
191
+ * Enhancement - Updated Additional tables for optimized requests and more correct filtering
192
+ * Enhancement - Possibility to filter any products request on the page with help of shortcode [brapf_next_shortcode_apply]
193
+ * Enhancement - Support for some page builders products elements with shortcode [brapf_next_shortcode_apply]
194
+ * Enhancement - Hide reset products button on page load with help of CSS code
195
+ * Enhancement - (DEV) New data for filtered page to get more control on selected elements
196
+ * Enhancement - Removed Deprecated Filters Add-on
197
+ * Fix - Multiple blocks with products in Divi Page Builder, when only single block must be filtered
198
+ * Fix - Stock status "On Backorder" work as "In stock" for filtering
199
+
200
  = 1.5.5.4 =
201
  * Enhancement - Added notice for deprecated filters add-on
202
  * Enhancement - Prepare for new update
templates/filters_group.php CHANGED
@@ -24,6 +24,7 @@
24
  wp_reset_postdata();
25
  }
26
  $filters_correct = 0;
 
27
  if( isset($filters['filters']) && is_array($filters['filters']) ) {
28
  echo '<ul class="berocket_filter_added_list" data-name="' . $post_name . '[filters][]" data-url="' . admin_url('post.php') . '">';
29
  foreach($filters['filters'] as $filter) {
@@ -40,10 +41,17 @@
40
  </div>
41
  </li>';
42
  $filters_correct++;
 
 
43
  }
44
  }
45
  echo '</ul>';
46
  }
 
 
 
 
 
47
  if($filters_correct == 0) {
48
  echo '<p>' . __('No one filters was created. Please create filters first', 'BeRocket_AJAX_domain')
49
  . ' <a href="' . admin_url('edit.php?post_type=br_product_filter') . '">' . __('FILTERS PAGE', 'BeRocket_AJAX_domain') . '</a></p>';
24
  wp_reset_postdata();
25
  }
26
  $filters_correct = 0;
27
+ $errors = array();
28
  if( isset($filters['filters']) && is_array($filters['filters']) ) {
29
  echo '<ul class="berocket_filter_added_list" data-name="' . $post_name . '[filters][]" data-url="' . admin_url('post.php') . '">';
30
  foreach($filters['filters'] as $filter) {
41
  </div>
42
  </li>';
43
  $filters_correct++;
44
+ } else {
45
+ $errors[] = $filter_id;
46
  }
47
  }
48
  echo '</ul>';
49
  }
50
+ if( count($errors) > 0 ) {
51
+ BeRocket_error_notices::add_plugin_error(1, 'Filter was removed, but it was added to group', array(
52
+ 'filter_ids' => $errors
53
+ ));
54
+ }
55
  if($filters_correct == 0) {
56
  echo '<p>' . __('No one filters was created. Please create filters first', 'BeRocket_AJAX_domain')
57
  . ' <a href="' . admin_url('edit.php?post_type=br_product_filter') . '">' . __('FILTERS PAGE', 'BeRocket_AJAX_domain') . '</a></p>';
woocommerce-filters.php CHANGED
@@ -3,14 +3,14 @@
3
  * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
5
  * Description: Unlimited AJAX products filters to make your shop perfect
6
- * Version: 1.6beta
7
  * Author: BeRocket
8
  * Requires at least: 5.0
9
  * Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
10
  * Text Domain: BeRocket_AJAX_domain
11
  * Domain Path: /languages/
12
- * WC tested up to: 5.8
13
  */
14
- define( "BeRocket_AJAX_filters_version", '1.6beta' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');
3
  * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
5
  * Description: Unlimited AJAX products filters to make your shop perfect
6
+ * Version: 1.6
7
  * Author: BeRocket
8
  * Requires at least: 5.0
9
  * Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
10
  * Text Domain: BeRocket_AJAX_domain
11
  * Domain Path: /languages/
12
+ * WC tested up to: 5.9
13
  */
14
+ define( "BeRocket_AJAX_filters_version", '1.6' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');