Ajax Search for WooCommerce - Version 1.7.0

Version Description

Download this release

Release Info

Developer damian-gora
Plugin Icon 128x128 Ajax Search for WooCommerce
Version 1.7.0
Comparing to
See all releases

Code changes from version 1.6.3 to 1.7.0

Files changed (69) hide show
  1. ajax-search-for-woocommerce.php +362 -357
  2. assets/css/admin-style.css +18 -14
  3. assets/css/style.css +153 -2
  4. assets/css/style.min.css +1 -1
  5. assets/js/admin.js +115 -184
  6. assets/js/admin.min.js +1 -1
  7. assets/js/search.js +439 -80
  8. assets/js/search.min.js +1 -1
  9. backward-compatibility/1-1-7/img/close.png +0 -0
  10. backward-compatibility/1-1-7/img/preloader.gif +0 -0
  11. backward-compatibility/1-1-7/img/preloader.png +0 -0
  12. backward-compatibility/1-1-7/jquery.dgwt-wcas.min.js +0 -1
  13. backward-compatibility/1-1-7/search-form.php +0 -97
  14. backward-compatibility/1-1-7/style.css +0 -825
  15. fs/config.php +4 -0
  16. includes/Admin/Install.php +0 -45
  17. includes/Admin/Promo/FeedbackNotice.php +82 -89
  18. includes/Admin/Promo/Upgrade.php +112 -109
  19. includes/Admin/RegenerateImages.php +137 -146
  20. includes/Admin/Requirements.php +1 -22
  21. includes/Admin/SettingsAPI.php +136 -131
  22. includes/BackwardCompatibility.php +0 -486
  23. includes/Conflicts/Solver.php +0 -52
  24. includes/EmbeddingViaMenu.php +169 -178
  25. includes/Engines/WordPressNative/DetailsBox.php +12 -16
  26. includes/Engines/WordPressNative/Search.php +99 -52
  27. includes/Helpers.php +136 -14
  28. includes/Integrations/Brands.php +207 -213
  29. includes/Integrations/Plugins/BoosterIO/BoosterIO.php +334 -346
  30. includes/Integrations/Plugins/BoosterIO/Filters.php +190 -198
  31. includes/Integrations/Plugins/PluginsCompatibility.php +32 -35
  32. includes/Integrations/Plugins/WooCommerce/WooCommerce.php +104 -0
  33. includes/Integrations/Plugins/WooCommerceAJAXFilters/WooCommerceAJAXFilters.php +47 -0
  34. includes/Integrations/Plugins/WooCommerceProductFilters/WooCommerceProductFilters.php +70 -0
  35. includes/Integrations/Plugins/WooCommerceProductTable/WooCommerceProductTable.php +68 -0
  36. includes/Integrations/Plugins/WooCommerceProductsFilter/WooCommerceProductsFilter.php +132 -0
  37. includes/Integrations/Plugins/WooProductFilter/WooProductFilter.php +108 -0
  38. includes/Integrations/Plugins/XforWooCommerceFilter/XforWooCommerceFilter.php +149 -0
  39. includes/Integrations/Solver.php +69 -0
  40. includes/Integrations/Themes/Astra/Astra.php +22 -20
  41. includes/Integrations/Themes/Enfold/Enfold.php +102 -0
  42. includes/Integrations/Themes/Flatsome/Flatsome.php +246 -249
  43. includes/Integrations/Themes/Impreza/Impreza.php +203 -0
  44. includes/Integrations/Themes/Storefront/Storefront.php +95 -96
  45. includes/Integrations/Themes/TheGem/TheGem.php +304 -0
  46. includes/Integrations/Themes/ThemesCompatibility.php +144 -131
  47. includes/Integrations/Themes/Woodmart/Woodmart.php +116 -0
  48. includes/Multilingual.php +421 -353
  49. includes/Order.php +0 -10
  50. includes/Personalization.php +154 -155
  51. includes/Product.php +521 -545
  52. includes/Scripts.php +100 -109
  53. includes/Settings.php +590 -674
  54. includes/Setup.php +30 -34
  55. includes/Shortcode.php +45 -47
  56. languages/ajax-search-for-woocommerce.pot +424 -450
  57. partials/admin/embedding-in-theme.php +11 -11
  58. partials/admin/features.php +23 -23
  59. partials/admin/how-to-use.php +12 -12
  60. partials/admin/indexer-header-demo.php +9 -10
  61. partials/admin/search-preview.php +134 -134
  62. partials/admin/settings.php +25 -29
  63. partials/details-panel/product.php +66 -66
  64. partials/details-panel/term-product.php +17 -17
  65. partials/search-form.php +45 -34
  66. partials/themes/storefront.php +33 -35
  67. partials/themes/woodmart.php +12 -0
  68. readme.txt +31 -3
  69. widget.php +31 -15
ajax-search-for-woocommerce.php CHANGED
@@ -1,357 +1,362 @@
1
- <?php
2
-
3
- /**
4
- * Plugin Name: AJAX Search for WooCommerce
5
- * Plugin URI: https://ajaxsearch.pro?utm_source=wp-admin&utm_medium=referral&utm_campaign=author_uri&utm_gen=utmdc
6
- * Description: The most popular WooCommerce product search. Gives your users a well-designed advanced AJAX search bar with live search suggestions.
7
- * Version: 1.6.3
8
- * Author: Damian Góra
9
- * Author URI: https://ajaxsearch.pro?utm_source=wp-admin&utm_medium=referral&utm_campaign=author_uri&utm_gen=utmdc
10
- * Text Domain: ajax-search-for-woocommerce
11
- * Domain Path: /languages
12
- * WC requires at least: 3.3
13
- * WC tested up to: 4.0
14
- *
15
- */
16
- // Exit if accessed directly
17
- if ( !defined( 'ABSPATH' ) ) {
18
- exit;
19
- }
20
-
21
- if ( !class_exists( 'DGWT_WC_Ajax_Search' ) && !function_exists( 'dgoraAsfwFs' ) ) {
22
- $fspath = dirname( __FILE__ ) . '/fs/config.php';
23
- if ( file_exists( $fspath ) ) {
24
- require_once $fspath;
25
- }
26
- final class DGWT_WC_Ajax_Search
27
- {
28
- private static $instance ;
29
- private $tnow ;
30
- public $engine = 'native' ;
31
- public $settings ;
32
- public $multilingual ;
33
- public $backwardCompatibility ;
34
- public $themeCompatibility ;
35
- public $brands ;
36
- public $nativeSearch ;
37
- public $tntsearch ;
38
- public $tntsearchValid = false ;
39
- public $tntsearchMySql ;
40
- public $tntsearchMySqlValid = false ;
41
- public $mobileDetect ;
42
- public $searchInstances = 0 ;
43
- public static function getInstance()
44
- {
45
-
46
- if ( !isset( self::$instance ) && !self::$instance instanceof DGWT_WC_Ajax_Search ) {
47
- self::$instance = new DGWT_WC_Ajax_Search();
48
- self::$instance->constants();
49
- self::$instance->loadTextdomain();
50
- if ( !self::$instance->checkRequirements() ) {
51
- return;
52
- }
53
- self::$instance->systemHooks();
54
- $mobileDetectExist = class_exists( 'Mobile_Detect' );
55
- self::$instance->autoload();
56
- self::$instance->mobileDetect = ( !$mobileDetectExist ? new \Detection\MobileDetect() : new \Mobile_Detect() );
57
- $setup = new \DgoraWcas\Setup();
58
- $setup->init();
59
- self::$instance->settings = new \DgoraWcas\Settings();
60
- self::$instance->hooks();
61
- self::$instance->multilingual = new \DgoraWcas\Multilingual();
62
- self::$instance->nativeSearch = new \DgoraWcas\Engines\WordPressNative\Search();
63
- // @TODO Temporary always use native WordPress DetailsBox engine.
64
- // Replace with details.php and shortinit in future releases
65
- new \DgoraWcas\Engines\WordPressNative\DetailsBox();
66
- new \DgoraWcas\Personalization();
67
- new \DgoraWcas\Scripts();
68
- $embeddingViaMenu = new \DgoraWcas\EmbeddingViaMenu();
69
- $embeddingViaMenu->init();
70
- self::$instance->themeCompatibility = new \DgoraWcas\Integrations\Themes\ThemesCompatibility();
71
- new \DgoraWcas\Integrations\Plugins\PluginsCompatibility();
72
- self::$instance->brands = new \DgoraWcas\Integrations\Brands();
73
- self::$instance->brands->init();
74
- \DgoraWcas\Shortcode::register();
75
-
76
- if ( is_admin() ) {
77
- \DgoraWcas\Admin\Install::maybeInstall();
78
- new \DgoraWcas\Admin\AdminMenu();
79
- new \DgoraWcas\Admin\Promo\FeedbackNotice();
80
- new \DgoraWcas\Admin\Promo\Upgrade();
81
- new \DgoraWcas\Admin\Requirements();
82
- $regenerateImages = new \DgoraWcas\Admin\RegenerateImages();
83
- $regenerateImages->init();
84
- }
85
-
86
- new \DgoraWcas\Conflicts\Solver();
87
- self::$instance->backwardCompatibility = new \DgoraWcas\BackwardCompatibility();
88
- }
89
-
90
- self::$instance->tnow = time();
91
- return self::$instance;
92
- }
93
-
94
- /**
95
- * Constructor Function
96
- */
97
- private function __construct()
98
- {
99
- self::$instance = $this;
100
- }
101
-
102
- /**
103
- * Uninstall, Activate, Deactivate hooks
104
- *
105
- * @return void
106
- */
107
- private function systemHooks()
108
- {
109
- register_deactivation_hook( __FILE__, function () {
110
- } );
111
- }
112
-
113
- /**
114
- * Check requirements
115
- *
116
- * @return void
117
- */
118
- private function checkRequirements()
119
- {
120
- if ( version_compare( PHP_VERSION, '5.5.0' ) < 0 ) {
121
-
122
- if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) {
123
- add_action( 'admin_notices', array( $this, 'adminNoticeReqPhp53' ) );
124
- return false;
125
- } else {
126
- add_action( 'admin_notices', array( $this, 'adminNoticeReqPhp55' ) );
127
- }
128
-
129
- }
130
-
131
- if ( !class_exists( 'WooCommerce' ) || !class_exists( 'WC_AJAX' ) ) {
132
- add_action( 'admin_notices', array( $this, 'admin_notice_no_woocommerce' ) );
133
- return false;
134
- }
135
-
136
- return true;
137
- }
138
-
139
- /**
140
- * Notice: PHP version less than 5.3
141
- * @return void
142
- */
143
- public function adminNoticeReqPhp53()
144
- {
145
- ?>
146
- <div class="notice notice-error dgwt-wcas-notice">
147
- <p>
148
- <?php
149
- _e( '<b>AJAX Search for WooCommerce</b>: You need PHP version at least 5.3 to run this plugin. You are currently using PHP version ', 'ajax-search-for-woocommerce' );
150
- echo PHP_VERSION . '.' ;
151
- ?>
152
- </p>
153
- </div>
154
- <?php
155
- }
156
-
157
- /**
158
- * Notice: PHP version less than 5.5
159
- *
160
- * @return void
161
- */
162
- public function adminNoticeReqPhp55()
163
- {
164
- if ( defined( 'DISABLE_NAG_NOTICES' ) && DISABLE_NAG_NOTICES ) {
165
- return;
166
- }
167
- $screen = get_current_screen();
168
- if ( empty($screen->id) || $screen->id !== 'dashboard' && $screen->id !== 'plugins' ) {
169
- return;
170
- }
171
- if ( !empty($_GET['dgwt-wcas-php55-notice']) && $_GET['dgwt-wcas-php55-notice'] === 'dismiss' ) {
172
- set_transient( 'dgwt-wcas-php55-notice-dismiss', '1', 60 * 60 * 24 * 7 );
173
- }
174
-
175
- if ( !get_transient( 'dgwt-wcas-php55-notice-dismiss' ) ) {
176
- ?>
177
- <div class="notice notice-error dgwt-wcas-notice">
178
- <p>
179
- <?php
180
- printf( __( "<b>AJAX Search for WooCommerce</b>:<br /> Your PHP version <b><i>%s</i></b> will not longer supported in the next plugin releases.", 'ajax-search-for-woocommerce' ), PHP_VERSION );
181
- _e( ' You have to update your PHP version to least 5.5 (recommended 7.2 or greater).', 'ajax-search-for-woocommerce' );
182
- echo '<br />' ;
183
- _e( "If you cannot upgrade your PHP version yourself, you can send an email to your host.", 'ajax-search-for-woocommerce' );
184
- echo '<br /><br />' ;
185
- echo '<span style="font-weight:bold; color: #dc3232">' . __( 'If you do not upgrade the php version, the next plugin release will not work!', 'ajax-search-for-woocommerce' ) . '</span>' ;
186
- echo '<br />' ;
187
- echo '<br />' ;
188
- echo '<a href="' . esc_url( add_query_arg( array(
189
- 'dgwt-wcas-php55-notice' => 'dismiss',
190
- ), $_SERVER['REQUEST_URI'] ) ) . '">' . __( 'Remind me again in week.', 'ajax-search-for-woocommerce' ) . '</a>' ;
191
- ?>
192
- </p>
193
- </div>
194
- <?php
195
- }
196
-
197
- }
198
-
199
- /**
200
- * Notice: requires WooCommerce
201
- *
202
- * @return void
203
- */
204
- public function admin_notice_no_woocommerce()
205
- {
206
- ?>
207
- <div class="notice notice-error dgwt-wcas-notice">
208
- <p>
209
- <?php
210
- printf( __( '<b>AJAX Search for WooCommerce</b> is enabled but not effective. It requires %s in order to work.', 'ajax-search-for-woocommerce' ), '<a href="https://pl.wordpress.org/plugins/woocommerce/" target="_blank">WooCommerce</a>' );
211
- ?>
212
- </p>
213
- </div>
214
- <?php
215
- }
216
-
217
- /**
218
- * Setup plugin constants
219
- *
220
- * @return void
221
- */
222
- private function constants()
223
- {
224
- $v = get_file_data( __FILE__, array(
225
- 'Version' => 'Version',
226
- ), 'plugin' );
227
- $this->define( 'DGWT_WCAS_VERSION', $v['Version'] );
228
- $this->define( 'DGWT_WCAS_NAME', 'AJAX Search for WooCommerce' );
229
- $this->define( 'DGWT_WCAS_FILE', __FILE__ );
230
- $this->define( 'DGWT_WCAS_DIR', plugin_dir_path( __FILE__ ) );
231
- $this->define( 'DGWT_WCAS_URL', plugin_dir_url( __FILE__ ) );
232
- $this->define( 'DGWT_WCAS_SETTINGS_KEY', 'dgwt_wcas_settings' );
233
- $this->define( 'DGWT_WCAS_SEARCH_ACTION', 'dgwt_wcas_ajax_search' );
234
- $this->define( 'DGWT_WCAS_RESULT_DETAILS_ACTION', 'dgwt_wcas_result_details' );
235
- $this->define( 'DGWT_WCAS_WC_AJAX_ENDPOINT', true );
236
- $this->define( 'DGWT_WCAS_DEBUG', false );
237
- }
238
-
239
- /**
240
- * Define constant if not already set
241
- *
242
- * @param string $name
243
- * @param string|bool $value
244
- *
245
- * @return void
246
- */
247
- private function define( $name, $value )
248
- {
249
- if ( !defined( $name ) ) {
250
- define( $name, $value );
251
- }
252
- }
253
-
254
- /**
255
- * PSR-4 autoload
256
- *
257
- * @return void
258
- */
259
- public function autoload()
260
- {
261
- $suffix = '';
262
- if ( file_exists( DGWT_WCAS_DIR . 'vendor' . $suffix . '/autoload.php' ) ) {
263
- require_once DGWT_WCAS_DIR . 'vendor' . $suffix . '/autoload.php';
264
- }
265
- require_once DGWT_WCAS_DIR . 'widget.php';
266
- }
267
-
268
- /**
269
- * Actions and filters
270
- *
271
- * @return void
272
- */
273
- private function hooks()
274
- {
275
- add_action( 'admin_init', array( $this, 'adminScripts' ), 8 );
276
- }
277
-
278
- /**
279
- * Enqueue admin sripts
280
- *
281
- * @return void
282
- */
283
- public function adminScripts()
284
- {
285
- // Register CSS
286
- wp_register_style(
287
- 'dgwt-wcas-admin-style',
288
- DGWT_WCAS_URL . 'assets/css/admin-style.css',
289
- array(),
290
- DGWT_WCAS_VERSION
291
- );
292
- // Register JS
293
- $min = ( !DGWT_WCAS_DEBUG ? '.min' : '' );
294
- wp_register_script(
295
- 'dgwt-wcas-admin-js',
296
- DGWT_WCAS_URL . 'assets/js/admin' . $min . '.js',
297
- array( 'jquery' ),
298
- DGWT_WCAS_VERSION
299
- );
300
-
301
- if ( \DgoraWcas\Helpers::isSettingsPage() ) {
302
- $localize = array(
303
- 'labels' => \DgoraWcas\Helpers::getLabels(),
304
- );
305
- $localize = apply_filters( 'dgwt/wcas/scripts/admin/localize', $localize );
306
- wp_localize_script( 'dgwt-wcas-admin-js', 'dgwt_wcas', $localize );
307
- // Enqueue CSS
308
- wp_enqueue_style( 'dgwt-wcas-admin-style' );
309
- wp_enqueue_style( 'wp-color-picker' );
310
- wp_enqueue_script( 'dgwt-wcas-admin-js' );
311
- wp_enqueue_script( 'wp-color-picker' );
312
- wp_enqueue_script(
313
- 'dgwt-wcas-admin-popper-js',
314
- DGWT_WCAS_URL . 'assets/js/popper.min.js',
315
- array( 'jquery' ),
316
- DGWT_WCAS_VERSION
317
- );
318
- wp_enqueue_script(
319
- 'dgwt-wcas-admin-tooltip-js',
320
- DGWT_WCAS_URL . 'assets/js/tooltip.min.js',
321
- array( 'jquery' ),
322
- DGWT_WCAS_VERSION
323
- );
324
- $min = ( !DGWT_WCAS_DEBUG ? '.min' : '' );
325
- wp_enqueue_style(
326
- 'dgwt-wcas-style',
327
- apply_filters( 'dgwt/wcas/scripts/css_style_url', DGWT_WCAS_URL . 'assets/css/style' . $min . '.css' ),
328
- array(),
329
- DGWT_WCAS_VERSION
330
- );
331
- }
332
-
333
- if ( \DgoraWcas\Helpers::isCheckoutPage() ) {
334
- wp_enqueue_style( 'dgwt-wcas-admin-style' );
335
- }
336
- }
337
-
338
- /**
339
- * Register text domain
340
- *
341
- * @return void
342
- */
343
- private function loadTextdomain()
344
- {
345
- $lang_dir = dirname( plugin_basename( DGWT_WCAS_FILE ) ) . '/languages/';
346
- load_plugin_textdomain( 'ajax-search-for-woocommerce', false, $lang_dir );
347
- }
348
-
349
- }
350
- // Init the plugin
351
- function DGWT_WCAS()
352
- {
353
- return DGWT_WC_Ajax_Search::getInstance();
354
- }
355
-
356
- add_action( 'plugins_loaded', 'DGWT_WCAS' );
357
- }
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Plugin Name: AJAX Search for WooCommerce
5
+ * Plugin URI: https://ajaxsearch.pro?utm_source=wp-admin&utm_medium=referral&utm_campaign=author_uri&utm_gen=utmdc
6
+ * Description: The most popular WooCommerce product search. Gives your users a well-designed advanced AJAX search bar with live search suggestions.
7
+ * Version: 1.7.0
8
+ * Author: Damian Góra
9
+ * Author URI: https://ajaxsearch.pro?utm_source=wp-admin&utm_medium=referral&utm_campaign=author_uri&utm_gen=utmdc
10
+ * Text Domain: ajax-search-for-woocommerce
11
+ * Domain Path: /languages
12
+ * WC requires at least: 3.3
13
+ * WC tested up to: 4.1
14
+ *
15
+ */
16
+ // Exit if accessed directly
17
+ if ( !defined( 'ABSPATH' ) ) {
18
+ exit;
19
+ }
20
+
21
+ if ( !class_exists( 'DGWT_WC_Ajax_Search' ) && !function_exists( 'dgoraAsfwFs' ) ) {
22
+ $fspath = dirname( __FILE__ ) . '/fs/config.php';
23
+ if ( file_exists( $fspath ) ) {
24
+ require_once $fspath;
25
+ }
26
+ final class DGWT_WC_Ajax_Search
27
+ {
28
+ private static $instance ;
29
+ private $tnow ;
30
+ public $engine = 'native' ;
31
+ /**
32
+ * @var \DgoraWcas\Settings
33
+ */
34
+ public $settings ;
35
+ public $multilingual ;
36
+ /**
37
+ * @var \DgoraWcas\Integrations\Themes\ThemesCompatibility
38
+ */
39
+ public $themeCompatibility ;
40
+ public $brands ;
41
+ public $nativeSearch ;
42
+ public $tntsearch ;
43
+ public $tntsearchValid = false ;
44
+ public $tntsearchMySql ;
45
+ public $tntsearchMySqlValid = false ;
46
+ public $mobileDetect ;
47
+ public $searchInstances = 0 ;
48
+ public static function getInstance()
49
+ {
50
+
51
+ if ( !isset( self::$instance ) && !self::$instance instanceof DGWT_WC_Ajax_Search ) {
52
+ self::$instance = new DGWT_WC_Ajax_Search();
53
+ self::$instance->constants();
54
+ self::$instance->loadTextdomain();
55
+ if ( !self::$instance->checkRequirements() ) {
56
+ return;
57
+ }
58
+ self::$instance->systemHooks();
59
+ $mobileDetectExist = class_exists( 'Mobile_Detect' );
60
+ self::$instance->autoload();
61
+ self::$instance->mobileDetect = ( !$mobileDetectExist ? new \Detection\MobileDetect() : new \Mobile_Detect() );
62
+ $setup = new \DgoraWcas\Setup();
63
+ $setup->init();
64
+ self::$instance->settings = new \DgoraWcas\Settings();
65
+ self::$instance->hooks();
66
+ self::$instance->multilingual = new \DgoraWcas\Multilingual();
67
+ self::$instance->nativeSearch = new \DgoraWcas\Engines\WordPressNative\Search();
68
+ // @TODO Temporary always use native WordPress DetailsBox engine.
69
+ // Replace with details.php and shortinit in future releases
70
+ new \DgoraWcas\Engines\WordPressNative\DetailsBox();
71
+ new \DgoraWcas\Personalization();
72
+ new \DgoraWcas\Scripts();
73
+ $embeddingViaMenu = new \DgoraWcas\EmbeddingViaMenu();
74
+ $embeddingViaMenu->init();
75
+ self::$instance->themeCompatibility = new \DgoraWcas\Integrations\Themes\ThemesCompatibility();
76
+ new \DgoraWcas\Integrations\Plugins\PluginsCompatibility();
77
+ self::$instance->brands = new \DgoraWcas\Integrations\Brands();
78
+ self::$instance->brands->init();
79
+ \DgoraWcas\Shortcode::register();
80
+
81
+ if ( is_admin() ) {
82
+ \DgoraWcas\Admin\Install::maybeInstall();
83
+ new \DgoraWcas\Admin\AdminMenu();
84
+ new \DgoraWcas\Admin\Promo\FeedbackNotice();
85
+ new \DgoraWcas\Admin\Promo\Upgrade();
86
+ new \DgoraWcas\Admin\Requirements();
87
+ $regenerateImages = new \DgoraWcas\Admin\RegenerateImages();
88
+ $regenerateImages->init();
89
+ }
90
+
91
+ new \DgoraWcas\Integrations\Solver();
92
+ }
93
+
94
+ self::$instance->tnow = time();
95
+ return self::$instance;
96
+ }
97
+
98
+ /**
99
+ * Constructor Function
100
+ */
101
+ private function __construct()
102
+ {
103
+ self::$instance = $this;
104
+ }
105
+
106
+ /**
107
+ * Uninstall, Activate, Deactivate hooks
108
+ *
109
+ * @return void
110
+ */
111
+ private function systemHooks()
112
+ {
113
+ register_deactivation_hook( __FILE__, function () {
114
+ } );
115
+ }
116
+
117
+ /**
118
+ * Check requirements
119
+ *
120
+ * @return void
121
+ */
122
+ private function checkRequirements()
123
+ {
124
+ if ( version_compare( PHP_VERSION, '5.5.0' ) < 0 ) {
125
+
126
+ if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) {
127
+ add_action( 'admin_notices', array( $this, 'adminNoticeReqPhp53' ) );
128
+ return false;
129
+ } else {
130
+ add_action( 'admin_notices', array( $this, 'adminNoticeReqPhp55' ) );
131
+ }
132
+
133
+ }
134
+
135
+ if ( !class_exists( 'WooCommerce' ) || !class_exists( 'WC_AJAX' ) ) {
136
+ add_action( 'admin_notices', array( $this, 'admin_notice_no_woocommerce' ) );
137
+ return false;
138
+ }
139
+
140
+ return true;
141
+ }
142
+
143
+ /**
144
+ * Notice: PHP version less than 5.3
145
+ * @return void
146
+ */
147
+ public function adminNoticeReqPhp53()
148
+ {
149
+ ?>
150
+ <div class="notice notice-error dgwt-wcas-notice">
151
+ <p>
152
+ <?php
153
+ _e( '<b>AJAX Search for WooCommerce</b>: You need PHP version at least 5.3 to run this plugin. You are currently using PHP version ', 'ajax-search-for-woocommerce' );
154
+ echo PHP_VERSION . '.' ;
155
+ ?>
156
+ </p>
157
+ </div>
158
+ <?php
159
+ }
160
+
161
+ /**
162
+ * Notice: PHP version less than 5.5
163
+ *
164
+ * @return void
165
+ */
166
+ public function adminNoticeReqPhp55()
167
+ {
168
+ if ( defined( 'DISABLE_NAG_NOTICES' ) && DISABLE_NAG_NOTICES ) {
169
+ return;
170
+ }
171
+ $screen = get_current_screen();
172
+ if ( empty($screen->id) || $screen->id !== 'dashboard' && $screen->id !== 'plugins' ) {
173
+ return;
174
+ }
175
+ if ( !empty($_GET['dgwt-wcas-php55-notice']) && $_GET['dgwt-wcas-php55-notice'] === 'dismiss' ) {
176
+ set_transient( 'dgwt-wcas-php55-notice-dismiss', '1', 60 * 60 * 24 * 7 );
177
+ }
178
+
179
+ if ( !get_transient( 'dgwt-wcas-php55-notice-dismiss' ) ) {
180
+ ?>
181
+ <div class="notice notice-error dgwt-wcas-notice">
182
+ <p>
183
+ <?php
184
+ printf( __( "<b>AJAX Search for WooCommerce</b>:<br /> Your PHP version <b><i>%s</i></b> will not longer supported in the next plugin releases.", 'ajax-search-for-woocommerce' ), PHP_VERSION );
185
+ _e( ' You have to update your PHP version to least 5.5 (recommended 7.2 or greater).', 'ajax-search-for-woocommerce' );
186
+ echo '<br />' ;
187
+ _e( "If you cannot upgrade your PHP version yourself, you can send an email to your host.", 'ajax-search-for-woocommerce' );
188
+ echo '<br /><br />' ;
189
+ echo '<span style="font-weight:bold; color: #dc3232">' . __( 'If you do not upgrade the php version, the next plugin release will not work!', 'ajax-search-for-woocommerce' ) . '</span>' ;
190
+ echo '<br />' ;
191
+ echo '<br />' ;
192
+ echo '<a href="' . esc_url( add_query_arg( array(
193
+ 'dgwt-wcas-php55-notice' => 'dismiss',
194
+ ), $_SERVER['REQUEST_URI'] ) ) . '">' . __( 'Remind me again in week.', 'ajax-search-for-woocommerce' ) . '</a>' ;
195
+ ?>
196
+ </p>
197
+ </div>
198
+ <?php
199
+ }
200
+
201
+ }
202
+
203
+ /**
204
+ * Notice: requires WooCommerce
205
+ *
206
+ * @return void
207
+ */
208
+ public function admin_notice_no_woocommerce()
209
+ {
210
+ ?>
211
+ <div class="notice notice-error dgwt-wcas-notice">
212
+ <p>
213
+ <?php
214
+ printf( __( '<b>AJAX Search for WooCommerce</b> is enabled but not effective. It requires %s in order to work.', 'ajax-search-for-woocommerce' ), '<a href="https://pl.wordpress.org/plugins/woocommerce/" target="_blank">WooCommerce</a>' );
215
+ ?>
216
+ </p>
217
+ </div>
218
+ <?php
219
+ }
220
+
221
+ /**
222
+ * Setup plugin constants
223
+ *
224
+ * @return void
225
+ */
226
+ private function constants()
227
+ {
228
+ $v = get_file_data( __FILE__, array(
229
+ 'Version' => 'Version',
230
+ ), 'plugin' );
231
+ $this->define( 'DGWT_WCAS_VERSION', $v['Version'] );
232
+ $this->define( 'DGWT_WCAS_NAME', 'AJAX Search for WooCommerce' );
233
+ $this->define( 'DGWT_WCAS_FILE', __FILE__ );
234
+ $this->define( 'DGWT_WCAS_DIR', plugin_dir_path( __FILE__ ) );
235
+ $this->define( 'DGWT_WCAS_URL', plugin_dir_url( __FILE__ ) );
236
+ $this->define( 'DGWT_WCAS_SETTINGS_KEY', 'dgwt_wcas_settings' );
237
+ $this->define( 'DGWT_WCAS_SEARCH_ACTION', 'dgwt_wcas_ajax_search' );
238
+ $this->define( 'DGWT_WCAS_RESULT_DETAILS_ACTION', 'dgwt_wcas_result_details' );
239
+ $this->define( 'DGWT_WCAS_GET_PRICES_ACTION', 'dgwt_wcas_get_prices' );
240
+ $this->define( 'DGWT_WCAS_WC_AJAX_ENDPOINT', true );
241
+ $this->define( 'DGWT_WCAS_DEBUG', false );
242
+ }
243
+
244
+ /**
245
+ * Define constant if not already set
246
+ *
247
+ * @param string $name
248
+ * @param string|bool $value
249
+ *
250
+ * @return void
251
+ */
252
+ private function define( $name, $value )
253
+ {
254
+ if ( !defined( $name ) ) {
255
+ define( $name, $value );
256
+ }
257
+ }
258
+
259
+ /**
260
+ * PSR-4 autoload
261
+ *
262
+ * @return void
263
+ */
264
+ public function autoload()
265
+ {
266
+ $suffix = '';
267
+ if ( file_exists( DGWT_WCAS_DIR . 'vendor' . $suffix . '/autoload.php' ) ) {
268
+ require_once DGWT_WCAS_DIR . 'vendor' . $suffix . '/autoload.php';
269
+ }
270
+ require_once DGWT_WCAS_DIR . 'widget.php';
271
+ }
272
+
273
+ /**
274
+ * Actions and filters
275
+ *
276
+ * @return void
277
+ */
278
+ private function hooks()
279
+ {
280
+ add_action( 'admin_init', array( $this, 'adminScripts' ), 8 );
281
+ }
282
+
283
+ /**
284
+ * Enqueue admin sripts
285
+ *
286
+ * @return void
287
+ */
288
+ public function adminScripts()
289
+ {
290
+ // Register CSS
291
+ wp_register_style(
292
+ 'dgwt-wcas-admin-style',
293
+ DGWT_WCAS_URL . 'assets/css/admin-style.css',
294
+ array(),
295
+ DGWT_WCAS_VERSION
296
+ );
297
+ // Register JS
298
+ $min = ( !DGWT_WCAS_DEBUG ? '.min' : '' );
299
+ wp_register_script(
300
+ 'dgwt-wcas-admin-js',
301
+ DGWT_WCAS_URL . 'assets/js/admin' . $min . '.js',
302
+ array( 'jquery' ),
303
+ DGWT_WCAS_VERSION
304
+ );
305
+
306
+ if ( \DgoraWcas\Helpers::isSettingsPage() ) {
307
+ $localize = array(
308
+ 'labels' => \DgoraWcas\Helpers::getLabels(),
309
+ );
310
+ $localize = apply_filters( 'dgwt/wcas/scripts/admin/localize', $localize );
311
+ wp_localize_script( 'dgwt-wcas-admin-js', 'dgwt_wcas', $localize );
312
+ // Enqueue CSS
313
+ wp_enqueue_style( 'dgwt-wcas-admin-style' );
314
+ wp_enqueue_style( 'wp-color-picker' );
315
+ wp_enqueue_script( 'dgwt-wcas-admin-js' );
316
+ wp_enqueue_script( 'wp-color-picker' );
317
+ wp_enqueue_script(
318
+ 'dgwt-wcas-admin-popper-js',
319
+ DGWT_WCAS_URL . 'assets/js/popper.min.js',
320
+ array( 'jquery' ),
321
+ DGWT_WCAS_VERSION
322
+ );
323
+ wp_enqueue_script(
324
+ 'dgwt-wcas-admin-tooltip-js',
325
+ DGWT_WCAS_URL . 'assets/js/tooltip.min.js',
326
+ array( 'jquery' ),
327
+ DGWT_WCAS_VERSION
328
+ );
329
+ $min = ( !DGWT_WCAS_DEBUG ? '.min' : '' );
330
+ wp_enqueue_style(
331
+ 'dgwt-wcas-style',
332
+ apply_filters( 'dgwt/wcas/scripts/css_style_url', DGWT_WCAS_URL . 'assets/css/style' . $min . '.css' ),
333
+ array(),
334
+ DGWT_WCAS_VERSION
335
+ );
336
+ }
337
+
338
+ if ( \DgoraWcas\Helpers::isCheckoutPage() ) {
339
+ wp_enqueue_style( 'dgwt-wcas-admin-style' );
340
+ }
341
+ }
342
+
343
+ /**
344
+ * Register text domain
345
+ *
346
+ * @return void
347
+ */
348
+ private function loadTextdomain()
349
+ {
350
+ $lang_dir = dirname( plugin_basename( DGWT_WCAS_FILE ) ) . '/languages/';
351
+ load_plugin_textdomain( 'ajax-search-for-woocommerce', false, $lang_dir );
352
+ }
353
+
354
+ }
355
+ // Init the plugin
356
+ function DGWT_WCAS()
357
+ {
358
+ return DGWT_WC_Ajax_Search::getInstance();
359
+ }
360
+
361
+ add_action( 'plugins_loaded', 'DGWT_WCAS' );
362
+ }
assets/css/admin-style.css CHANGED
@@ -34,7 +34,8 @@
34
  .dgwt-wcas-settings > .notice:not(.dgwt-wcas-notice),
35
  .dgwt-wcas-settings > .error:not(.dgwt-wcas-notice),
36
  .dgwt-wcas-settings > .info:not(.dgwt-wcas-notice),
37
- .dgwt-wcas-settings > .warning:not(.dgwt-wcas-notice) {
 
38
  display: none;
39
  }
40
 
@@ -71,14 +72,6 @@
71
  min-height: 30px;
72
  }
73
 
74
- #dgwt_wcas_backward-compatibility .form-table th {
75
- vertical-align: baseline;
76
- }
77
-
78
- #dgwt_wcas_backward-compatibility input[type="checkbox"] {
79
- margin-top: 3px;
80
- }
81
-
82
  .dgwt-wcas-row:after {
83
  content: '';
84
  display: block;
@@ -571,12 +564,10 @@
571
  margin-right: 10px;
572
  }
573
 
574
- /* Dismiss-able Notice */
575
- .dgwt-wcas-review-notice {
576
  border-left: 4px solid #00a0d2;
577
  background: #fefefe;
578
- padding: 1px 12px;
579
- padding-top: 10px;
580
  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
581
  -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
582
  margin: 15px 25px 20px 5px;
@@ -1093,6 +1084,19 @@ td.dgwt-wcas-indexing-details-row a {
1093
  max-width: 280px;
1094
  }
1095
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1096
  .dgwt_wcas_settings-group .wp-picker-clear {
1097
  display: none;
1098
  }
@@ -1398,4 +1402,4 @@ td.dgwt-wcas-indexing-details-row a {
1398
 
1399
  .dgwt-wcas-sgs-themes-label h2 b {
1400
  color: #000;
1401
- }
34
  .dgwt-wcas-settings > .notice:not(.dgwt-wcas-notice),
35
  .dgwt-wcas-settings > .error:not(.dgwt-wcas-notice),
36
  .dgwt-wcas-settings > .info:not(.dgwt-wcas-notice),
37
+ .dgwt-wcas-settings > .warning:not(.dgwt-wcas-notice),
38
+ .dgwt-wcas-settings > .updated:not(.dgwt-wcas-notice) {
39
  display: none;
40
  }
41
 
72
  min-height: 30px;
73
  }
74
 
 
 
 
 
 
 
 
 
75
  .dgwt-wcas-row:after {
76
  content: '';
77
  display: block;
564
  margin-right: 10px;
565
  }
566
 
567
+ .notice.dgwt-wcas-review-notice {
 
568
  border-left: 4px solid #00a0d2;
569
  background: #fefefe;
570
+ padding: 10px 12px 1px 12px;
 
571
  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
572
  -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
573
  margin: 15px 25px 20px 5px;
1084
  max-width: 280px;
1085
  }
1086
 
1087
+ .dgwt_wcas_settings-group .selectize-dropdown-content .create {
1088
+ display: none;
1089
+ }
1090
+ .dgwt_wcas_settings-group .selectize-dropdown-content .option.active {
1091
+ background: rgba(150,88,137, 0.15);
1092
+ }
1093
+ .dgwt_wcas_settings-group .selectize-dropdown-content .option .highlight {
1094
+ font-weight: bold;
1095
+ background: transparent;
1096
+ display: inline-block;
1097
+ border-bottom: 1px solid #444;
1098
+ }
1099
+
1100
  .dgwt_wcas_settings-group .wp-picker-clear {
1101
  display: none;
1102
  }
1402
 
1403
  .dgwt-wcas-sgs-themes-label h2 b {
1404
  color: #000;
1405
+ }
assets/css/style.css CHANGED
@@ -4,6 +4,7 @@
4
 
5
  .dgwt-wcas-search-wrapp {
6
  position: relative;
 
7
  display: block;
8
  color: #444;
9
  min-width: 230px;
@@ -43,6 +44,7 @@
43
  border: 1px solid #ddd;
44
  border-top: none;
45
  padding: 0;
 
46
  -webkit-box-sizing: border-box;
47
  -moz-box-sizing: border-box;
48
  box-sizing: border-box;
@@ -89,6 +91,7 @@
89
  justify-content: space-between;
90
  align-items: center;
91
  resize: vertical;
 
92
  }
93
 
94
  .dgwt-wcas-suggestion.dgwt-wcas-suggestion-more {
@@ -254,6 +257,7 @@ a.dgwt-wcas-product-details-readmore:hover {
254
  .dgwt-wcas-search-form {
255
  margin: 0;
256
  padding: 0;
 
257
  }
258
 
259
  .dgwt-wcas-sp del {
@@ -876,6 +880,11 @@ input[type="submit"].dgwt-wcas-search-submit, button.dgwt-wcas-search-submit {
876
  outline: 0;
877
  background: #fff;
878
  box-shadow: 0 0 9px 1px rgba(0, 0, 0, 0.06);
 
 
 
 
 
879
  }
880
 
881
  .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input::placeholder {
@@ -923,6 +932,8 @@ input[type="submit"].dgwt-wcas-search-submit, button.dgwt-wcas-search-submit {
923
  cursor: pointer;
924
  height: 40px;
925
  min-width: 50px;
 
 
926
  right: 0;
927
  left: auto;
928
  top: 0;
@@ -1089,7 +1100,8 @@ body:not(.dgwt-wcas-is-details) .dgwt-wcas-suggestion:last-child {
1089
  padding: 10px 40px 10px 15px;
1090
  }
1091
 
1092
- .dgwt-wcas-overlay-mobile-on, .dgwt-wcas-overlay-mobile-on body {
 
1093
  overflow: hidden;
1094
  }
1095
 
@@ -1135,6 +1147,56 @@ body:not(.dgwt-wcas-is-details) .dgwt-wcas-suggestion:last-child {
1135
  right: auto !important;
1136
  }
1137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1138
  .dgwt-wcas-om-bar .dgwt-wcas-sf-wrapp button.dgwt-wcas-search-submit {
1139
  display: none;
1140
  }
@@ -1142,6 +1204,10 @@ body:not(.dgwt-wcas-is-details) .dgwt-wcas-suggestion:last-child {
1142
  .dgwt-wcas-om-bar .dgwt-wcas-search-wrapp-mobile {
1143
  width: calc(100% - 45px);
1144
  max-width: none;
 
 
 
 
1145
  }
1146
 
1147
  .dgwt-wcas-overlay-mobile {
@@ -1179,6 +1245,12 @@ body:not(.dgwt-wcas-is-details) .dgwt-wcas-suggestion:last-child {
1179
  position: absolute;
1180
  overflow-y: auto;
1181
  border: none;
 
 
 
 
 
 
1182
  }
1183
 
1184
  .dgwt-wcas-overlay-mobile-on .dgwt-wcas-enable-mobile-form {
@@ -1245,6 +1317,85 @@ body .dgwt-wcas-content-wrapp .rood {
1245
  display: none;
1246
  }
1247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1248
  /*------------------------------------------------------
1249
  Style with headings
1250
  ---------------------------------------------------------*/
@@ -1288,4 +1439,4 @@ body .dgwt-wcas-content-wrapp .rood {
1288
 
1289
  .dgwt-wcas-is-details .dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-tax {
1290
  min-height: 30px;
1291
- }
4
 
5
  .dgwt-wcas-search-wrapp {
6
  position: relative;
7
+ line-height: 100%;
8
  display: block;
9
  color: #444;
10
  min-width: 230px;
44
  border: 1px solid #ddd;
45
  border-top: none;
46
  padding: 0;
47
+ margin: 0;
48
  -webkit-box-sizing: border-box;
49
  -moz-box-sizing: border-box;
50
  box-sizing: border-box;
91
  justify-content: space-between;
92
  align-items: center;
93
  resize: vertical;
94
+ width: 100%;
95
  }
96
 
97
  .dgwt-wcas-suggestion.dgwt-wcas-suggestion-more {
257
  .dgwt-wcas-search-form {
258
  margin: 0;
259
  padding: 0;
260
+ width: 100%;
261
  }
262
 
263
  .dgwt-wcas-sp del {
880
  outline: 0;
881
  background: #fff;
882
  box-shadow: 0 0 9px 1px rgba(0, 0, 0, 0.06);
883
+ -webkit-transition: all 150ms ease-in;
884
+ -moz-transition: all 150ms ease-in;
885
+ -ms-transition: all 150ms ease-in;
886
+ -o-transition: all 150ms ease-in;
887
+ transition: all 150ms ease-in;
888
  }
889
 
890
  .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input::placeholder {
932
  cursor: pointer;
933
  height: 40px;
934
  min-width: 50px;
935
+ line-height: 100%;
936
+ min-height: 100%;
937
  right: 0;
938
  left: auto;
939
  top: 0;
1100
  padding: 10px 40px 10px 15px;
1101
  }
1102
 
1103
+ .dgwt-wcas-overlay-mobile-on,
1104
+ .dgwt-wcas-overlay-mobile-on body {
1105
  overflow: hidden;
1106
  }
1107
 
1147
  right: auto !important;
1148
  }
1149
 
1150
+
1151
+ @keyframes dgwt-wcas-preloader-price-anim {
1152
+ 0% { background: rgba(128, 128, 128, 0.03) }
1153
+ 50% { background: rgba(128, 128, 128, 0.1) }
1154
+ 100% { background: rgba(128, 128, 128, 0.03) }
1155
+ }
1156
+
1157
+ .dgwt-wcas-preloader-price-inner div:nth-child(1) {
1158
+ left: 0px;
1159
+ animation-delay: -0.1s
1160
+ }
1161
+
1162
+ .dgwt-wcas-preloader-price-inner div:nth-child(2) {
1163
+ left: 13px;
1164
+ animation-delay: -0.2s
1165
+ }
1166
+
1167
+ .dgwt-wcas-preloader-price-inner div:nth-child(3) {
1168
+ left: 26px;
1169
+ animation-delay: -0.3s
1170
+ }
1171
+
1172
+ .dgwt-wcas-preloader-price {
1173
+ width: 34px;
1174
+ height: 10px;
1175
+ display: inline-block;
1176
+ overflow: hidden;
1177
+ background: none;
1178
+ }
1179
+ .dgwt-wcas-preloader-price-inner {
1180
+ width: 100%;
1181
+ height: 100%;
1182
+ position: relative;
1183
+ transform: translateZ(0) scale(1);
1184
+ backface-visibility: hidden;
1185
+ transform-origin: 0 0; /* see note above */
1186
+ }
1187
+ .dgwt-wcas-preloader-price-inner div {
1188
+ position: absolute;
1189
+ width: 8px;
1190
+ height: 8px;
1191
+ background: rgba(128, 128, 128, 0.05);
1192
+ animation: dgwt-wcas-preloader-price-anim 0.8s cubic-bezier(0, 0.5, 0.5, 1) infinite;
1193
+ -webkit-transition: all 200ms ease-in-out;
1194
+ -moz-transition: all 200ms ease-in-out;
1195
+ -ms-transition: all 200ms ease-in-out;
1196
+ -o-transition: all 200ms ease-in-out;
1197
+ transition: all 200ms ease-in-out;
1198
+ }
1199
+
1200
  .dgwt-wcas-om-bar .dgwt-wcas-sf-wrapp button.dgwt-wcas-search-submit {
1201
  display: none;
1202
  }
1204
  .dgwt-wcas-om-bar .dgwt-wcas-search-wrapp-mobile {
1205
  width: calc(100% - 45px);
1206
  max-width: none;
1207
+ margin: 0;
1208
+ }
1209
+ .dgwt-wcas-overlay-mobile .dgwt-wcas-search-form {
1210
+ width: 100%;
1211
  }
1212
 
1213
  .dgwt-wcas-overlay-mobile {
1245
  position: absolute;
1246
  overflow-y: auto;
1247
  border: none;
1248
+ margin: 0;
1249
+ display: block;
1250
+ }
1251
+
1252
+ .dgwt-wcas-overlay-mobile-on .dgwt-wcas-suggestion {
1253
+ width: 100%;
1254
  }
1255
 
1256
  .dgwt-wcas-overlay-mobile-on .dgwt-wcas-enable-mobile-form {
1317
  display: none;
1318
  }
1319
 
1320
+ /*------------------------------------------------------
1321
+ Icon instead of search bar
1322
+ ---------------------------------------------------------*/
1323
+
1324
+ .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon {
1325
+ min-width: unset;
1326
+ }
1327
+
1328
+ .dgwt-wcas-layout-icon-flexible .dgwt-wcas-search-form {
1329
+ opacity: 0;
1330
+ }
1331
+ .dgwt-wcas-layout-icon-flexible-loaded .dgwt-wcas-search-form {
1332
+ opacity: 1;
1333
+ }
1334
+ .dgwt-wcas-search-icon-arrow {
1335
+ display: none;
1336
+ }
1337
+
1338
+ html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-search-form {
1339
+ opacity: 0;
1340
+ display: none;
1341
+ position: absolute;
1342
+ left: 0;
1343
+ top: calc(100% + 8px);
1344
+ min-width: 500px;
1345
+ /*box-shadow: 0 0 10px 30px rgba(255,255,255,0.8);*/
1346
+ z-index: 1000;
1347
+ }
1348
+
1349
+ .dgwt-wcas-overlay-mobile .dgwt-wcas-search-icon,
1350
+ .dgwt-wcas-overlay-mobile .dgwt-wcas-search-icon-arrow {
1351
+ display: none;
1352
+ }
1353
+
1354
+ html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon.dgwt-wcas-layout-icon-open .dgwt-wcas-search-form {
1355
+ display: block;
1356
+ opacity: 1;
1357
+ }
1358
+ .dgwt-wcas-search-icon {
1359
+ width: 20px;
1360
+ height: auto;
1361
+ cursor: pointer;
1362
+ }
1363
+ .dgwt-wcas-ico-magnifier-handler {
1364
+ margin-bottom: -0.2em;
1365
+ width:100%;
1366
+ }
1367
+ .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon.dgwt-wcas-layout-icon-open .dgwt-wcas-search-icon {
1368
+ opacity: 0.6;
1369
+ }
1370
+
1371
+ .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon.dgwt-wcas-layout-icon-open .dgwt-wcas-sf-wrapp .dgwt-wcas-ico-magnifier {
1372
+ display: none;
1373
+ }
1374
+ .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon.dgwt-wcas-layout-icon-open.dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
1375
+ padding-left: 15px;
1376
+ }
1377
+ .dgwt-wcas-layout-icon-open .dgwt-wcas-search-icon-arrow {
1378
+ display: block;
1379
+ position: absolute;
1380
+ top: calc(100% + 2px);
1381
+ left: 0;
1382
+ z-index: 5;
1383
+ width: 15px;
1384
+ height: 15px;
1385
+ background: #fff;
1386
+ border: 1px solid #ddd;
1387
+ -webkit-transform: rotate(45deg);
1388
+ -moz-transform: rotate(45deg);
1389
+ -o-transform: rotate(45deg);
1390
+ -ms-transform: rotate(45deg);
1391
+ transform: rotate(45deg);
1392
+
1393
+ }
1394
+
1395
+ .dgwt-wcas-layout-icon-flexible:not(.dgwt-wcas-layout-icon) .dgwt-wcas-search-icon,
1396
+ .dgwt-wcas-layout-icon-flexible:not(.dgwt-wcas-layout-icon) .dgwt-wcas-search-icon-arrow {
1397
+ display: none;
1398
+ }
1399
  /*------------------------------------------------------
1400
  Style with headings
1401
  ---------------------------------------------------------*/
1439
 
1440
  .dgwt-wcas-is-details .dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-tax {
1441
  min-height: 30px;
1442
+ }
assets/css/style.min.css CHANGED
@@ -1 +1 @@
1
- .dgwt-wcas-block-scroll{overflow:hidden}.dgwt-wcas-search-wrapp{position:relative;display:block;color:#444;min-width:230px;width:100%;text-align:left;margin:0 auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.dgwt-wcas-tpd-image img{margin:0 15px 0 0!important;display:block}.rtl .dgwt-wcas-tpd-image img{margin:0 0 0 15px!important}.dgwt-wcas-preloader-wrapp img{margin:10px auto 0 auto;display:block;max-width:200px}.dgwt-wcas-preloader-wrapp img.dgwt-wcas-placeholder-preloader{display:block;width:100%;height:auto;max-width:300px;margin:0}.dgwt-wcas-suggestions-wrapp{background:#fff none repeat scroll 0 0;border:1px solid #ddd;border-top:none;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;overflow-y:auto}.dgwt-wcas-details-wrapp a:focus,.dgwt-wcas-suggestions-wrapp a:focus{outline:0}.dgwt-wcas-suggestions-wrapp.dgwt-wcas-suggestions-wrapp--top{border:1px solid #ddd;border-bottom:none}.dgwt-wcas-is-detail-box .dgwt-wcas-suggestions-wrapp{max-width:550px}.dgwt-wcas-full-width.dgwt-wcas-is-detail-box .dgwt-wcas-suggestion{padding:8px 15px}.dgwt-wcas-details-left .dgwt-wcas-suggestions-wrapp{border-radius:0 0 5px 0;border-left-color:#eee}.dgwt-wcas-details-right .dgwt-wcas-suggestions-wrapp{border-radius:0 0 0 5px;border-right-color:#eee}.dgwt-wcas-suggestion{cursor:pointer;font-size:12px;line-height:110%;text-align:left;padding:7px 10px;position:relative;border-bottom:1px solid #dfdfdf;display:flex;flex-direction:row;justify-content:space-between;align-items:center;resize:vertical}.dgwt-wcas-suggestion.dgwt-wcas-suggestion-more{justify-content:center;color:#6d6d6d}a.dgwt-wcas-details-more-products{padding:15px 0 10px 0;display:block;border-top:1px solid #eee;text-align:center;font-size:12px;text-transform:uppercase;color:#6d6d6d;transition:all .2s ease-in-out}a.dgwt-wcas-details-more-products:hover{text-decoration:underline}a.dgwt-wcas-product-details-readmore{display:block;text-align:right;margin-top:15px;color:#6d6d6d;text-transform:uppercase;letter-spacing:1px;font-weight:400;font-size:12px}a.dgwt-wcas-product-details-readmore:hover{text-decoration:underline}.dgwt-wcas-suggestion.dgwt-wcas-suggestion-no-border-bottom{border-bottom:none}.dgwt-wcas-suggestion:after{clear:both;display:block;content:''}.dgwt-wcas-suggestion.dgwt-wcas-nores{cursor:default;opacity:.5}.dgwt-wcas-has-img .dgwt-wcas-suggestion.dgwt-wcas-suggestion-product{padding-top:8px;padding-bottom:8px;min-height:60px}.dgwt-wcas-is-details .dgwt-wcas-has-img .dgwt-wcas-suggestion.dgwt-wcas-suggestion-more,.dgwt-wcas-suggestion.dgwt-wcas-suggestion-more{min-height:30px;text-transform:uppercase}.dgwt-wcas-suggestion.dgwt-wcas-suggestion-more .dgwt-wcas-st-more{padding:0 10px;text-align:center}.dgwt-wcas-st{display:block;color:#444;font-size:15px;width:100%;line-height:110%}.dgwt-wcas-st>span{display:inline-block;vertical-align:middle}.dgwt-wcas-has-sku .dgwt-wcas-st-title{margin-right:6px}.dgwt-wcas-st>span.dgwt-wcas-st--direct-headline{display:block;font-style:italic;font-size:10px;text-transform:uppercase;opacity:.4;line-height:10px;margin-bottom:1px;letter-spacing:2px}.dgwt-wcas-st-breadcrumbs{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:80%;text-align:left;opacity:.6;width:100%;padding-right:10px}.rtl .dgwt-wcas-st-breadcrumbs{padding-right:0;padding-left:10px;text-align:right}.dgwt-wcas-sku{font-size:80%}.dgwt-wcas-si{width:50px;display:block;height:100%}.dgwt-wcas-si img{background:#fff none repeat scroll 0 0;border:1px solid #e8e8e8;border-radius:3px;display:block;margin:auto;padding:2px;height:auto;width:auto;max-height:90%;max-width:100%}.dgwt-wcas-content-wrapp{display:flex;height:100%;width:100%;justify-content:space-between;align-items:center;resize:vertical;padding-left:10px}.rtl .dgwt-wcas-content-wrapp{padding-left:0;padding-right:10px}.dgwt-wcas-sp{color:#555;font-size:14px;line-height:120%;text-align:right;line-height:4px;padding-left:10px}.dgwt-wcas-sp *{line-height:130%}.dgwt-wcas-search-form{margin:0;padding:0}.dgwt-wcas-sp del{opacity:.5;font-size:12px}.dgwt-wcas-sd{color:#777;display:block;line-height:14px;width:100%;margin-top:5px;font-size:.8em}.dgwt-wcas-suggestion-selected{background-color:#eee}.dgwt-wcas-suggestion-selected:first-child{border-top:none}.rtl .dgwt-wcas-suggestion{padding-left:0;padding-right:15px;text-align:right}.dgwt-wcas-details-wrapp{background:#fff none repeat scroll 0 0;border:1px solid #ddd;border-top:none;border-left:none;padding:0;width:300px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;z-index:100;min-height:340px}.rtl .dgwt-wcas-details-wrapp{border-left:1px solid #ddd;border-right:none}.dgwt-wcas-details-outside .dgwt-wcas-details-wrapp{margin-top:-1px;border-top:1px solid #ddd}.dgwt-wcas-details-outside.dgwt-wcas-is-details .dgwt-wcas-suggestions-wrapp{margin-top:-1px;border-top:1px solid #ddd}.dgwt-wcas-details-right .dgwt-wcas-details-wrapp{border-left:none;border-right:1px solid #ddd;border-radius:0 5px 5px 0}.dgwt-wcas-details-left .dgwt-wcas-details-wrapp{border-right:none;border-left:1px solid #ddd;border-radius:5px 0 0 5px}.dgwt-wcas-details-notfit .dgwt-wcas-details-wrapp{display:none}.dgwt-wcas-full-width .dgwt-wcas-suggestions-wrapp{border-radius:0 0 0 5px}.dgwt-wcas-full-width .dgwt-wcas-details-wrapp{border-radius:0 0 5px 0}.rtl.dgwt-wcas-full-width .dgwt-wcas-suggestions-wrapp{border-radius:0 0 5px 0}.rtl.dgwt-wcas-full-width .dgwt-wcas-details-wrapp{border-radius:0 0 0 5px}.dgwt-wcas-details-inner-taxonomy{margin-top:11px}.woocommerce .dgwt-wcas-pd-rating .star-rating{float:left;margin-right:5px;font-size:12px;color:#ccae72}.rtl .dgwt-wcas-pd-rating .star-rating{float:right;margin-left:5px;margin-right:0}.dgwt-wcas-datails-title{border-bottom:1px dashed #eee;display:block;margin-bottom:15px;padding-bottom:5px;font-size:14px}.dgwt-wcas-pd-title{border-bottom:1px dashed #eee;margin-bottom:15px;padding-bottom:5px;display:block;color:#202020;text-decoration:none}.dgwt-wcas-pd-title .product-title{font-weight:900;color:#202020;text-transform:uppercase;letter-spacing:-1px;margin:0}.dgwt-wcas-details-title-tax{text-transform:uppercase;font-weight:900;letter-spacing:-1px;margin-right:3px}.dgwt-wcas-tax-product-details{text-decoration:none;display:flex;align-items:center;justify-content:left;transition:all .2s ease-in-out;padding:5px;margin:0 -5px 15px -5px}.dgwt-wcas-tax-product-details:after{content:'';clear:both;display:block}.dgwt-wcas-tax-product-details:hover{box-shadow:0 0 11px 2px rgba(0,0,0,.05)}.dgwt-wcas-details-wrapp .dgwt-wcas-pd-title{margin-bottom:8px}.dgwt-wcas-tpd-image{width:60px;margin-right:15px}.dgwt-wcas-pd-rest .product-title{display:block;line-height:100%;font-weight:500;margin-bottom:5px}.dgwt-wcas-tpd-rest{max-width:200px}.dgwt-wcas-tpd-rest-title{display:block;line-height:125%;font-size:14px;font-weight:500;letter-spacing:0;margin:0 0 8px;overflow:hidden;color:#000}.dgwt-wcas-suggestion-nores{pointer-events:none;opacity:.45}.dgwt-wcas-pd-price,.dgwt-wcas-tpd-price{font-size:14px;line-height:120%;overflow:hidden;color:#000;margin-top:15px;font-weight:700;font-size:18px}.dgwt-wcas-tpd-price{font-size:12px;color:#777}.dgwt-wcas-pd-price .woocommerce-price-suffix,.dgwt-wcas-tpd-price .woocommerce-price-suffix{font-size:12px;font-weight:lighter;color:#999;margin-left:4px;display:inline-block}.dgwt-wcas-pd-price del .amount,.dgwt-wcas-tpd-price del .amount{font-weight:lighter;background:0 0;font-size:90%;opacity:.6}.dgwt-wcas-pd-price ins,.dgwt-wcas-tpd-price ins{background:0 0;text-decoration:none}.dgwt-wcas-pd-rating{font-size:13px;line-height:13px}.dgwt-wcas-pd-rating:after{content:'';clear:both;display:block}.dgwt-wcas-pd-review{color:#777;font-size:11px;line-height:11px}.dgwt-wcas-datails-title{border-bottom:1px dashed #eee;display:block;margin:5px 0 15px 0;padding-bottom:5px}.dgwt-wcas-pd-title{border-bottom:1px dashed #eee;margin-bottom:15px;padding-bottom:5px;display:block;text-decoration:none}.dgwt-wcas-pd-title .product-title{font-weight:900;text-transform:uppercase;letter-spacing:-1px}.dgwt-wcas-details-title-tax{text-transform:uppercase;font-weight:900;letter-spacing:-1px;margin-right:3px}.rtl .dgwt-wcas-details-title-tax{margin:0 0 0 3px;float:right}.dgwt-wcas-tpd-image{width:70px;padding:4px;background-color:#fff;border:1px solid #e8e8e8;border-radius:4px;display:flex;flex-direction:column;justify-content:center}.dgwt-wcas-details-space{padding:0 15px 15px 15px}.dgwt-wcas-details-main-image{border-bottom:1px solid #eee;min-height:200px;display:flex}.dgwt-wcas-details-main-image img{width:auto;height:auto;display:block;max-height:250px;max-width:100%;margin:0 auto;padding:0;border:none;align-self:center}.dgwt-wcas-details-right .dgwt-wcas-details-main-image img{border-radius:0 3px 0 0}.dgwt-wcas-details-left .dgwt-wcas-details-main-image img{border-radius:3px 0 0 0}a.dgwt-wcas-details-post-title,a.dgwt-wcas-details-product-title{color:#333;display:block;line-height:120%;margin:10px 0 0 0;font-size:21px;font-weight:400;text-decoration:none;text-transform:none}a.dgwt-wcas-details-post-title:hover,a.dgwt-wcas-details-product-title:hover{text-decoration:underline}a.dgwt-wcas-details-post-title{margin-bottom:15px}.dgwt-wcas-details-product-sku{display:block;font-size:12px;line-height:110%;color:#999}.dgwt-wcas-tpd-image img{display:block;max-width:100%;width:100%;height:auto}.dgwt-wcas-details-hr{height:1px;width:100%;border-bottom:1px solid #eee;margin:15px 0}.rtl .dgwt-wcas-tpd-image{float:right;margin-right:0;margin-left:15px}.rtl .dgwt-wcas-tpd-rest{float:right;max-width:190px}.rtl input[type=search].dgwt-wcas-search-input{text-align:right}input[type=search].dgwt-wcas-search-input,input[type=text].dgwt-cas-search-input{-webkit-transition:none;-moz-transition:none;-ms-transition:none;-o-transition:none;transition:none;-webkit-box-shadow:none;box-shadow:none;margin:0;-webkit-appearance:textfield;text-align:left}[type=search].dgwt-wcas-search-input::-ms-clear{display:none}[type=search].dgwt-wcas-search-input::-webkit-search-decoration{-webkit-appearance:none}[type=search].dgwt-wcas-search-input::-webkit-search-cancel-button{display:none}.dgwt-wcas-details-desc{font-size:13px;line-height:157%}.dgwt-wcas-details-desc b,.dgwt-wcas-details-desc strong{font-weight:400;color:#000;margin:0;padding:0}.dgwt-wcas-pd-addtc-form{margin:10px 0;display:flex;align-items:center;justify-content:flex-end}.dgwt-wcas-pd-addtc-form>.quantity{margin-right:10px}.dgwt-wcas-pd-addtc-form .add_to_cart_inline,.dgwt-wcas-pd-addtc-form .quantity input.qty{margin-bottom:0;margin-top:0}.dgwt-wcas-stock{display:block;text-align:right;font-size:14px;line-height:14px;margin-bottom:14px}.dgwt-wcas-stock.in-stock{color:#0f834d}.dgwt-wcas-stock.out-of-stock{color:#e2401c}.dgwt-wcas-pd-addtc .add_to_cart_button,.dgwt-wcas-pd-addtc .add_to_cart_inline{margin:0}.dgwt-wcas-pd-addtc .add_to_cart_button.added{display:none}button.dgwt-wcas-search-submit,input[type=submit].dgwt-wcas-search-submit{position:relative}.dgwt-wcas-ico-magnifier{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0;height:65%;display:block}.dgwt-wcas-preloader{height:100%;position:absolute;right:0;top:0;width:40px;z-index:1;background-repeat:no-repeat;background-position:right 15px center;background-size:auto 44%}.rtl .dgwt-wcas-preloader{right:auto;left:5px}.dgwt-wcas-inner-preloader{background-image:url(../img/preloader.png);background-repeat:no-repeat;background-position:right 13px center;background-size:auto 22px}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.dgwt-wcas-inner-preloader{background-image:url(../img/preloader.gif)}}.dgwt-wcas-close:not(.dgwt-wcas-inner-preloader){cursor:pointer;background-image:url(../img/close.png);background-repeat:no-repeat;background-position:right 15px center;background-size:auto 18px;opacity:.6;-webkit-transition:all 160ms ease-in-out;-moz-transition:all 160ms ease-in-out;-ms-transition:all 160ms ease-in-out;-o-transition:all 160ms ease-in-out;transition:all 160ms ease-in-out}.dgwt-wcas-close:hover{opacity:.3}@media screen and (max-width:992px){.dgwt-wcas-is-detail-box .dgwt-wcas-suggestions-wrapp{max-width:none}}.dgwt-wcas-suggestion strong{font-weight:700}.screen-reader-text{clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;position:absolute!important;width:1px}.dgwt-wcas-sf-wrapp:after,.dgwt-wcas-sf-wrapp:before{content:"";display:table}.dgwt-wcas-sf-wrapp:after{clear:both}.dgwt-wcas-sf-wrapp{zoom:1;width:100%;margin:0;position:relative;background:0 0}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input{width:100%;height:40px;font-size:14px;line-height:100%;padding:10px 15px;margin:0;background:#fff;border:1px solid #ddd;border-radius:3px;-webkit-border-radius:3px;-webkit-appearance:none;box-sizing:border-box}.dgwt-wcas-open .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input{border-radius:3px 3px 0 0}.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-details-outside .dgwt-wcas-details-wrapp{display:none!important}.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-details-outside .dgwt-wcas-suggestions-wrapp{min-height:0!important;border-radius:0 0 5px 5px;border-right-color:#ddd}.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-full-width .dgwt-wcas-details-wrapp,.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-full-width .dgwt-wcas-suggestions-wrapp{min-height:41px!important}.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-full-width:not(.rtl):not(.dgwt-wcas-details-outside) .dgwt-wcas-suggestions-wrapp{border-right-color:transparent}.dgwt-wcas-open.dgwt-wcas-nores .dgwt-wcas-details-wrapp .dgwt-wcas-preloader-wrapp{display:none!important}.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-is-details:not(.dgwt-wcas-details-outside) .dgwt-wcas-suggestion-nores{margin-top:5px}.rtl.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-full-width:not(.dgwt-wcas-details-outside) .dgwt-wcas-suggestions-wrapp{border-left-color:transparent}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input:focus{outline:0;background:#fff;box-shadow:0 0 9px 1px rgba(0,0,0,.06)}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input::placeholder{color:#999;font-weight:400;font-style:italic;line-height:normal}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input::-webkit-input-placeholder{color:#999;font-weight:400;font-style:italic;line-height:normal}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input:-moz-placeholder{color:#999;font-weight:400;font-style:italic;line-height:normal}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input::-moz-placeholder{color:#999;font-weight:400;font-style:italic;line-height:normal}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input:-ms-input-placeholder{color:#999;font-weight:400;font-style:italic;line-height:normal}.dgwt-wcas-sf-wrapp button.dgwt-wcas-search-submit{overflow:visible;position:absolute;border:0;padding:0;margin:0;cursor:pointer;height:40px;min-width:50px;right:0;left:auto;top:0;bottom:auto;padding:0 15px;color:#fff;-webkit-transition:all 250ms ease-in-out;-moz-transition:all 250ms ease-in-out;-ms-transition:all 250ms ease-in-out;-o-transition:all 250ms ease-in-out;transition:all 250ms ease-in-out;text-transform:uppercase;background-color:#333;border-radius:0 2px 2px 0;-webkit-border-radius:0 2px 2px 0;text-shadow:0 -1px 0 rgba(0,0,0,.3);-webkit-box-shadow:none;box-shadow:none;-webkit-appearance:none}.rtl .dgwt-wcas-sf-wrapp button.dgwt-wcas-search-submit{left:0;right:auto}.dgwt-wcas-open .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit{border-radius:0 2px 0 0}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:hover{opacity:.7}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:active,.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:focus{opacity:.7;outline:0}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:before{content:'';position:absolute;border-width:8px 8px 8px 0;border-style:solid solid solid none;border-color:transparent #333 transparent;top:12px;left:-6px;-webkit-transition:all 250ms ease-in-out;-moz-transition:all 250ms ease-in-out;-ms-transition:all 250ms ease-in-out;-o-transition:all 250ms ease-in-out;transition:all 250ms ease-in-out}.rtl .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:before{left:auto;right:-6px;border-width:8px 0 8px 8px;border-style:solid none solid solid}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:hover:before{border-right-color:#333}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:active:before,.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:focus:before{border-right-color:#333}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit::-moz-focus-inner{border:0;padding:0}.dgwt-wcas-ico-magnifier{fill:#fff}.dgwt-wcas-details-wrapp .added_to_cart{display:block}.dgwt-wcas-has-desc .dgwt-wcas-sp>*,.dgwt-wcas-has-img .dgwt-wcas-sp>*{display:block}.dgwt-wcas-is-details .dgwt-wcas-suggestions-wrapp{min-height:340px}body:not(.dgwt-wcas-is-details) .dgwt-wcas-suggestion:last-child{border-bottom:none}.dgwt-wcas-is-details .dgwt-wcas-has-img .dgwt-wcas-suggestion.dgwt-wcas-suggestion-product{min-height:40px}.dgwt-wcas-is-details .dgwt-wcas-suggestions-wrapp{overflow:visible}.dgwt-wcas-is-details .dgwt-wcas-si{width:30px;max-width:100%;box-sizing:border-box}.dgwt-wcas-is-details .dgwt-wcas-sp{display:flex;top:0;flex-direction:column;height:100%;justify-content:center;resize:vertical}.dgwt-wcas-is-details .dgwt-wcas-sd{font-size:11px;line-height:100%}.dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy=product_cat],.dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy=product_tag]{padding-left:15px;min-height:0}.dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy=product_cat] .dgwt-wcas-st,.dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy=product_tag] .dgwt-wcas-st{padding-left:0}.dgwt-wcas-no-submit .dgwt-wcas-ico-magnifier{height:50%;max-height:20px;width:100%;max-width:20px;left:12px;right:auto;opacity:.5;fill:#000}.rtl .dgwt-wcas-no-submit .dgwt-wcas-ico-magnifier{left:auto;right:12px}.dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input{padding:10px 15px 10px 40px}.rtl .dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input{padding:10px 40px 10px 15px}.dgwt-wcas-overlay-mobile-on,.dgwt-wcas-overlay-mobile-on body{overflow:hidden}.dgwt-wcas-om-bar{display:flex;height:45px;width:100%}.dgwt-wcas-om-bar .dgwt-wcas-om-return{width:45px;height:100%;display:block;background:#ccc;cursor:pointer;position:relative}.dgwt-wcas-om-bar .dgwt-wcas-om-return svg{width:23px;height:23px;position:absolute;left:12px;top:12px}.rtl .dgwt-wcas-om-bar .dgwt-wcas-om-return svg{left:11px;top:9px;-moz-transform:rotate(180deg);-webkit-transform:rotate(180deg);-o-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.dgwt-wcas-om-bar .dgwt-wcas-has-submit-off .dgwt-wcas-preloader{right:0!important}.rtl .dgwt-wcas-om-bar .dgwt-wcas-has-submit-off .dgwt-wcas-preloader{left:4px!important;right:auto!important}.dgwt-wcas-om-bar .dgwt-wcas-sf-wrapp button.dgwt-wcas-search-submit{display:none}.dgwt-wcas-om-bar .dgwt-wcas-search-wrapp-mobile{width:calc(100% - 45px);max-width:none}.dgwt-wcas-overlay-mobile{position:absolute;left:0;right:0;top:0;bottom:0;width:100%;background:#fff}.dgwt-wcas-overlay-mobile *{box-sizing:border-box}.dgwt-wcas-search-wrapp-mobile input[type=search].dgwt-wcas-search-input{height:45px!important;border-top:none;border-right:none;border-left:none;border-radius:0;font-size:16px!important}.dgwt-wcas-search-wrapp-mobile input[type=search].dgwt-wcas-search-input:focus{font-size:16px!important}.dgwt-wcas-overlay-mobile-on .dgwt-wcas-suggestions-wrapp{left:0!important;top:45px!important;width:100%!important;height:calc(100% - 45px)!important;position:absolute;overflow-y:auto;border:none}.dgwt-wcas-overlay-mobile-on .dgwt-wcas-enable-mobile-form{display:none}.dgwt-wcas-enable-mobile-form{position:absolute;z-index:100;left:0;top:0;width:100%;height:100%;cursor:pointer}html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-icon-mobile .dgwt-wcas-search-form{display:none;position:relative}html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-search-wrapp.dgwt-wcas-icon-mobile{min-width:0;display:inline-block;width:28px;height:28px}html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-icon-handler{height:100%;width:100%}html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-icon-handler .dgwt-wcas-ico-magnifier{opacity:1;position:static;max-width:none;max-height:none}.dgwt-wcas-overlay-mobile-on .dgwt-wcas-icon-handler{display:none}.dgwt-wcas-overlay-mobile-on body.dgwt-wcas-is-ios .dgwt-wcas-suggestions-wrapp{height:calc(100% - 45px)!important}.dgwt-wcas-overlay-mobile-on body.dgwt-wcas-is-ios{overflow:visible;overflow-x:hidden}.dgwt-wcas-overlay-mobile-on body.dgwt-wcas-is-ios .dgwt-wcas-suggestions-wrapp{max-height:none!important;height:auto!important}.dgwt-wcas-overlay-mobile-on body.dgwt-wcas-is-ios:not(.dgwt-wcas-theme-flatsome)>:not(.dgwt-wcas-overlay-mobile){display:none}body .dgwt-wcas-content-wrapp .rood,body .dgwt-wcas-content-wrapp .zwave{display:none}.dgwt-wcas-has-headings .dgwt-wcas-suggestion{border-bottom:none}.dgwt-wcas-has-headings .dgwt-wcas-st>span.dgwt-wcas-st--direct-headline{display:none}.dgwt-wcas-has-headings .dgwt-wcas-suggestion-headline{pointer-events:none;display:block;font-weight:500;white-space:nowrap}.dgwt-wcas-has-headings .dgwt-wcas-suggestion-headline .dgwt-wcas-st{border-bottom:1px solid #ddd;padding-bottom:3px;text-transform:uppercase;margin-top:16px;font-size:12px}.dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-headline,.dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-tax{border-bottom:none}.dgwt-wcas-has-headings .dgwt-wcas-suggestion-tax .dgwt-wcas-st{padding:0}.dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-tax.dgwt-wcas-suggestion-selected,.dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-tax:hover{background:0 0;text-decoration:underline}.dgwt-wcas-is-details .dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-tax{min-height:30px}
1
+ .dgwt-wcas-block-scroll{overflow:hidden}.dgwt-wcas-search-wrapp{position:relative;line-height:100%;display:block;color:#444;min-width:230px;width:100%;text-align:left;margin:0 auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.dgwt-wcas-tpd-image img{margin:0 15px 0 0!important;display:block}.rtl .dgwt-wcas-tpd-image img{margin:0 0 0 15px!important}.dgwt-wcas-preloader-wrapp img{margin:10px auto 0 auto;display:block;max-width:200px}.dgwt-wcas-preloader-wrapp img.dgwt-wcas-placeholder-preloader{display:block;width:100%;height:auto;max-width:300px;margin:0}.dgwt-wcas-suggestions-wrapp{background:#fff none repeat scroll 0 0;border:1px solid #ddd;border-top:none;padding:0;margin:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;overflow-y:auto}.dgwt-wcas-details-wrapp a:focus,.dgwt-wcas-suggestions-wrapp a:focus{outline:0}.dgwt-wcas-suggestions-wrapp.dgwt-wcas-suggestions-wrapp--top{border:1px solid #ddd;border-bottom:none}.dgwt-wcas-is-detail-box .dgwt-wcas-suggestions-wrapp{max-width:550px}.dgwt-wcas-full-width.dgwt-wcas-is-detail-box .dgwt-wcas-suggestion{padding:8px 15px}.dgwt-wcas-details-left .dgwt-wcas-suggestions-wrapp{border-radius:0 0 5px 0;border-left-color:#eee}.dgwt-wcas-details-right .dgwt-wcas-suggestions-wrapp{border-radius:0 0 0 5px;border-right-color:#eee}.dgwt-wcas-suggestion{cursor:pointer;font-size:12px;line-height:110%;text-align:left;padding:7px 10px;position:relative;border-bottom:1px solid #dfdfdf;display:flex;flex-direction:row;justify-content:space-between;align-items:center;resize:vertical;width:100%}.dgwt-wcas-suggestion.dgwt-wcas-suggestion-more{justify-content:center;color:#6d6d6d}a.dgwt-wcas-details-more-products{padding:15px 0 10px 0;display:block;border-top:1px solid #eee;text-align:center;font-size:12px;text-transform:uppercase;color:#6d6d6d;transition:all .2s ease-in-out}a.dgwt-wcas-details-more-products:hover{text-decoration:underline}a.dgwt-wcas-product-details-readmore{display:block;text-align:right;margin-top:15px;color:#6d6d6d;text-transform:uppercase;letter-spacing:1px;font-weight:400;font-size:12px}a.dgwt-wcas-product-details-readmore:hover{text-decoration:underline}.dgwt-wcas-suggestion.dgwt-wcas-suggestion-no-border-bottom{border-bottom:none}.dgwt-wcas-suggestion:after{clear:both;display:block;content:''}.dgwt-wcas-suggestion.dgwt-wcas-nores{cursor:default;opacity:.5}.dgwt-wcas-has-img .dgwt-wcas-suggestion.dgwt-wcas-suggestion-product{padding-top:8px;padding-bottom:8px;min-height:60px}.dgwt-wcas-is-details .dgwt-wcas-has-img .dgwt-wcas-suggestion.dgwt-wcas-suggestion-more,.dgwt-wcas-suggestion.dgwt-wcas-suggestion-more{min-height:30px;text-transform:uppercase}.dgwt-wcas-suggestion.dgwt-wcas-suggestion-more .dgwt-wcas-st-more{padding:0 10px;text-align:center}.dgwt-wcas-st{display:block;color:#444;font-size:15px;width:100%;line-height:110%}.dgwt-wcas-st>span{display:inline-block;vertical-align:middle}.dgwt-wcas-has-sku .dgwt-wcas-st-title{margin-right:6px}.dgwt-wcas-st>span.dgwt-wcas-st--direct-headline{display:block;font-style:italic;font-size:10px;text-transform:uppercase;opacity:.4;line-height:10px;margin-bottom:1px;letter-spacing:2px}.dgwt-wcas-st-breadcrumbs{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:80%;text-align:left;opacity:.6;width:100%;padding-right:10px}.rtl .dgwt-wcas-st-breadcrumbs{padding-right:0;padding-left:10px;text-align:right}.dgwt-wcas-sku{font-size:80%}.dgwt-wcas-si{width:50px;display:block;height:100%}.dgwt-wcas-si img{background:#fff none repeat scroll 0 0;border:1px solid #e8e8e8;border-radius:3px;display:block;margin:auto;padding:2px;height:auto;width:auto;max-height:90%;max-width:100%}.dgwt-wcas-content-wrapp{display:flex;height:100%;width:100%;justify-content:space-between;align-items:center;resize:vertical;padding-left:10px}.rtl .dgwt-wcas-content-wrapp{padding-left:0;padding-right:10px}.dgwt-wcas-sp{color:#555;font-size:14px;line-height:120%;text-align:right;line-height:4px;padding-left:10px}.dgwt-wcas-sp *{line-height:130%}.dgwt-wcas-search-form{margin:0;padding:0;width:100%}.dgwt-wcas-sp del{opacity:.5;font-size:12px}.dgwt-wcas-sd{color:#777;display:block;line-height:14px;width:100%;margin-top:5px;font-size:.8em}.dgwt-wcas-suggestion-selected{background-color:#eee}.dgwt-wcas-suggestion-selected:first-child{border-top:none}.rtl .dgwt-wcas-suggestion{padding-left:0;padding-right:15px;text-align:right}.dgwt-wcas-details-wrapp{background:#fff none repeat scroll 0 0;border:1px solid #ddd;border-top:none;border-left:none;padding:0;width:300px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;z-index:100;min-height:340px}.rtl .dgwt-wcas-details-wrapp{border-left:1px solid #ddd;border-right:none}.dgwt-wcas-details-outside .dgwt-wcas-details-wrapp{margin-top:-1px;border-top:1px solid #ddd}.dgwt-wcas-details-outside.dgwt-wcas-is-details .dgwt-wcas-suggestions-wrapp{margin-top:-1px;border-top:1px solid #ddd}.dgwt-wcas-details-right .dgwt-wcas-details-wrapp{border-left:none;border-right:1px solid #ddd;border-radius:0 5px 5px 0}.dgwt-wcas-details-left .dgwt-wcas-details-wrapp{border-right:none;border-left:1px solid #ddd;border-radius:5px 0 0 5px}.dgwt-wcas-details-notfit .dgwt-wcas-details-wrapp{display:none}.dgwt-wcas-full-width .dgwt-wcas-suggestions-wrapp{border-radius:0 0 0 5px}.dgwt-wcas-full-width .dgwt-wcas-details-wrapp{border-radius:0 0 5px 0}.rtl.dgwt-wcas-full-width .dgwt-wcas-suggestions-wrapp{border-radius:0 0 5px 0}.rtl.dgwt-wcas-full-width .dgwt-wcas-details-wrapp{border-radius:0 0 0 5px}.dgwt-wcas-details-inner-taxonomy{margin-top:11px}.woocommerce .dgwt-wcas-pd-rating .star-rating{float:left;margin-right:5px;font-size:12px;color:#ccae72}.rtl .dgwt-wcas-pd-rating .star-rating{float:right;margin-left:5px;margin-right:0}.dgwt-wcas-datails-title{border-bottom:1px dashed #eee;display:block;margin-bottom:15px;padding-bottom:5px;font-size:14px}.dgwt-wcas-pd-title{border-bottom:1px dashed #eee;margin-bottom:15px;padding-bottom:5px;display:block;color:#202020;text-decoration:none}.dgwt-wcas-pd-title .product-title{font-weight:900;color:#202020;text-transform:uppercase;letter-spacing:-1px;margin:0}.dgwt-wcas-details-title-tax{text-transform:uppercase;font-weight:900;letter-spacing:-1px;margin-right:3px}.dgwt-wcas-tax-product-details{text-decoration:none;display:flex;align-items:center;justify-content:left;transition:all .2s ease-in-out;padding:5px;margin:0 -5px 15px -5px}.dgwt-wcas-tax-product-details:after{content:'';clear:both;display:block}.dgwt-wcas-tax-product-details:hover{box-shadow:0 0 11px 2px rgba(0,0,0,.05)}.dgwt-wcas-details-wrapp .dgwt-wcas-pd-title{margin-bottom:8px}.dgwt-wcas-tpd-image{width:60px;margin-right:15px}.dgwt-wcas-pd-rest .product-title{display:block;line-height:100%;font-weight:500;margin-bottom:5px}.dgwt-wcas-tpd-rest{max-width:200px}.dgwt-wcas-tpd-rest-title{display:block;line-height:125%;font-size:14px;font-weight:500;letter-spacing:0;margin:0 0 8px;overflow:hidden;color:#000}.dgwt-wcas-suggestion-nores{pointer-events:none;opacity:.45}.dgwt-wcas-pd-price,.dgwt-wcas-tpd-price{font-size:14px;line-height:120%;overflow:hidden;color:#000;margin-top:15px;font-weight:700;font-size:18px}.dgwt-wcas-tpd-price{font-size:12px;color:#777}.dgwt-wcas-pd-price .woocommerce-price-suffix,.dgwt-wcas-tpd-price .woocommerce-price-suffix{font-size:12px;font-weight:lighter;color:#999;margin-left:4px;display:inline-block}.dgwt-wcas-pd-price del .amount,.dgwt-wcas-tpd-price del .amount{font-weight:lighter;background:0 0;font-size:90%;opacity:.6}.dgwt-wcas-pd-price ins,.dgwt-wcas-tpd-price ins{background:0 0;text-decoration:none}.dgwt-wcas-pd-rating{font-size:13px;line-height:13px}.dgwt-wcas-pd-rating:after{content:'';clear:both;display:block}.dgwt-wcas-pd-review{color:#777;font-size:11px;line-height:11px}.dgwt-wcas-datails-title{border-bottom:1px dashed #eee;display:block;margin:5px 0 15px 0;padding-bottom:5px}.dgwt-wcas-pd-title{border-bottom:1px dashed #eee;margin-bottom:15px;padding-bottom:5px;display:block;text-decoration:none}.dgwt-wcas-pd-title .product-title{font-weight:900;text-transform:uppercase;letter-spacing:-1px}.dgwt-wcas-details-title-tax{text-transform:uppercase;font-weight:900;letter-spacing:-1px;margin-right:3px}.rtl .dgwt-wcas-details-title-tax{margin:0 0 0 3px;float:right}.dgwt-wcas-tpd-image{width:70px;padding:4px;background-color:#fff;border:1px solid #e8e8e8;border-radius:4px;display:flex;flex-direction:column;justify-content:center}.dgwt-wcas-details-space{padding:0 15px 15px 15px}.dgwt-wcas-details-main-image{border-bottom:1px solid #eee;min-height:200px;display:flex}.dgwt-wcas-details-main-image img{width:auto;height:auto;display:block;max-height:250px;max-width:100%;margin:0 auto;padding:0;border:none;align-self:center}.dgwt-wcas-details-right .dgwt-wcas-details-main-image img{border-radius:0 3px 0 0}.dgwt-wcas-details-left .dgwt-wcas-details-main-image img{border-radius:3px 0 0 0}a.dgwt-wcas-details-post-title,a.dgwt-wcas-details-product-title{color:#333;display:block;line-height:120%;margin:10px 0 0 0;font-size:21px;font-weight:400;text-decoration:none;text-transform:none}a.dgwt-wcas-details-post-title:hover,a.dgwt-wcas-details-product-title:hover{text-decoration:underline}a.dgwt-wcas-details-post-title{margin-bottom:15px}.dgwt-wcas-details-product-sku{display:block;font-size:12px;line-height:110%;color:#999}.dgwt-wcas-tpd-image img{display:block;max-width:100%;width:100%;height:auto}.dgwt-wcas-details-hr{height:1px;width:100%;border-bottom:1px solid #eee;margin:15px 0}.rtl .dgwt-wcas-tpd-image{float:right;margin-right:0;margin-left:15px}.rtl .dgwt-wcas-tpd-rest{float:right;max-width:190px}.rtl input[type=search].dgwt-wcas-search-input{text-align:right}input[type=search].dgwt-wcas-search-input,input[type=text].dgwt-cas-search-input{-webkit-transition:none;-moz-transition:none;-ms-transition:none;-o-transition:none;transition:none;-webkit-box-shadow:none;box-shadow:none;margin:0;-webkit-appearance:textfield;text-align:left}[type=search].dgwt-wcas-search-input::-ms-clear{display:none}[type=search].dgwt-wcas-search-input::-webkit-search-decoration{-webkit-appearance:none}[type=search].dgwt-wcas-search-input::-webkit-search-cancel-button{display:none}.dgwt-wcas-details-desc{font-size:13px;line-height:157%}.dgwt-wcas-details-desc b,.dgwt-wcas-details-desc strong{font-weight:400;color:#000;margin:0;padding:0}.dgwt-wcas-pd-addtc-form{margin:10px 0;display:flex;align-items:center;justify-content:flex-end}.dgwt-wcas-pd-addtc-form>.quantity{margin-right:10px}.dgwt-wcas-pd-addtc-form .add_to_cart_inline,.dgwt-wcas-pd-addtc-form .quantity input.qty{margin-bottom:0;margin-top:0}.dgwt-wcas-stock{display:block;text-align:right;font-size:14px;line-height:14px;margin-bottom:14px}.dgwt-wcas-stock.in-stock{color:#0f834d}.dgwt-wcas-stock.out-of-stock{color:#e2401c}.dgwt-wcas-pd-addtc .add_to_cart_button,.dgwt-wcas-pd-addtc .add_to_cart_inline{margin:0}.dgwt-wcas-pd-addtc .add_to_cart_button.added{display:none}button.dgwt-wcas-search-submit,input[type=submit].dgwt-wcas-search-submit{position:relative}.dgwt-wcas-ico-magnifier{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0;height:65%;display:block}.dgwt-wcas-preloader{height:100%;position:absolute;right:0;top:0;width:40px;z-index:1;background-repeat:no-repeat;background-position:right 15px center;background-size:auto 44%}.rtl .dgwt-wcas-preloader{right:auto;left:5px}.dgwt-wcas-inner-preloader{background-image:url(../img/preloader.png);background-repeat:no-repeat;background-position:right 13px center;background-size:auto 22px}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.dgwt-wcas-inner-preloader{background-image:url(../img/preloader.gif)}}.dgwt-wcas-close:not(.dgwt-wcas-inner-preloader){cursor:pointer;background-image:url(../img/close.png);background-repeat:no-repeat;background-position:right 15px center;background-size:auto 18px;opacity:.6;-webkit-transition:all 160ms ease-in-out;-moz-transition:all 160ms ease-in-out;-ms-transition:all 160ms ease-in-out;-o-transition:all 160ms ease-in-out;transition:all 160ms ease-in-out}.dgwt-wcas-close:hover{opacity:.3}@media screen and (max-width:992px){.dgwt-wcas-is-detail-box .dgwt-wcas-suggestions-wrapp{max-width:none}}.dgwt-wcas-suggestion strong{font-weight:700}.screen-reader-text{clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;position:absolute!important;width:1px}.dgwt-wcas-sf-wrapp:after,.dgwt-wcas-sf-wrapp:before{content:"";display:table}.dgwt-wcas-sf-wrapp:after{clear:both}.dgwt-wcas-sf-wrapp{zoom:1;width:100%;margin:0;position:relative;background:0 0}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input{width:100%;height:40px;font-size:14px;line-height:100%;padding:10px 15px;margin:0;background:#fff;border:1px solid #ddd;border-radius:3px;-webkit-border-radius:3px;-webkit-appearance:none;box-sizing:border-box}.dgwt-wcas-open .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input{border-radius:3px 3px 0 0}.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-details-outside .dgwt-wcas-details-wrapp{display:none!important}.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-details-outside .dgwt-wcas-suggestions-wrapp{min-height:0!important;border-radius:0 0 5px 5px;border-right-color:#ddd}.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-full-width .dgwt-wcas-details-wrapp,.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-full-width .dgwt-wcas-suggestions-wrapp{min-height:41px!important}.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-full-width:not(.rtl):not(.dgwt-wcas-details-outside) .dgwt-wcas-suggestions-wrapp{border-right-color:transparent}.dgwt-wcas-open.dgwt-wcas-nores .dgwt-wcas-details-wrapp .dgwt-wcas-preloader-wrapp{display:none!important}.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-is-details:not(.dgwt-wcas-details-outside) .dgwt-wcas-suggestion-nores{margin-top:5px}.rtl.dgwt-wcas-open.dgwt-wcas-nores.dgwt-wcas-full-width:not(.dgwt-wcas-details-outside) .dgwt-wcas-suggestions-wrapp{border-left-color:transparent}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input:focus{outline:0;background:#fff;box-shadow:0 0 9px 1px rgba(0,0,0,.06);-webkit-transition:all 150ms ease-in;-moz-transition:all 150ms ease-in;-ms-transition:all 150ms ease-in;-o-transition:all 150ms ease-in;transition:all 150ms ease-in}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input::placeholder{color:#999;font-weight:400;font-style:italic;line-height:normal}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input::-webkit-input-placeholder{color:#999;font-weight:400;font-style:italic;line-height:normal}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input:-moz-placeholder{color:#999;font-weight:400;font-style:italic;line-height:normal}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input::-moz-placeholder{color:#999;font-weight:400;font-style:italic;line-height:normal}.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input:-ms-input-placeholder{color:#999;font-weight:400;font-style:italic;line-height:normal}.dgwt-wcas-sf-wrapp button.dgwt-wcas-search-submit{overflow:visible;position:absolute;border:0;padding:0;margin:0;cursor:pointer;height:40px;min-width:50px;line-height:100%;min-height:100%;right:0;left:auto;top:0;bottom:auto;padding:0 15px;color:#fff;-webkit-transition:all 250ms ease-in-out;-moz-transition:all 250ms ease-in-out;-ms-transition:all 250ms ease-in-out;-o-transition:all 250ms ease-in-out;transition:all 250ms ease-in-out;text-transform:uppercase;background-color:#333;border-radius:0 2px 2px 0;-webkit-border-radius:0 2px 2px 0;text-shadow:0 -1px 0 rgba(0,0,0,.3);-webkit-box-shadow:none;box-shadow:none;-webkit-appearance:none}.rtl .dgwt-wcas-sf-wrapp button.dgwt-wcas-search-submit{left:0;right:auto}.dgwt-wcas-open .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit{border-radius:0 2px 0 0}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:hover{opacity:.7}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:active,.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:focus{opacity:.7;outline:0}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:before{content:'';position:absolute;border-width:8px 8px 8px 0;border-style:solid solid solid none;border-color:transparent #333 transparent;top:12px;left:-6px;-webkit-transition:all 250ms ease-in-out;-moz-transition:all 250ms ease-in-out;-ms-transition:all 250ms ease-in-out;-o-transition:all 250ms ease-in-out;transition:all 250ms ease-in-out}.rtl .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:before{left:auto;right:-6px;border-width:8px 0 8px 8px;border-style:solid none solid solid}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:hover:before{border-right-color:#333}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:active:before,.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:focus:before{border-right-color:#333}.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit::-moz-focus-inner{border:0;padding:0}.dgwt-wcas-ico-magnifier{fill:#fff}.dgwt-wcas-details-wrapp .added_to_cart{display:block}.dgwt-wcas-has-desc .dgwt-wcas-sp>*,.dgwt-wcas-has-img .dgwt-wcas-sp>*{display:block}.dgwt-wcas-is-details .dgwt-wcas-suggestions-wrapp{min-height:340px}body:not(.dgwt-wcas-is-details) .dgwt-wcas-suggestion:last-child{border-bottom:none}.dgwt-wcas-is-details .dgwt-wcas-has-img .dgwt-wcas-suggestion.dgwt-wcas-suggestion-product{min-height:40px}.dgwt-wcas-is-details .dgwt-wcas-suggestions-wrapp{overflow:visible}.dgwt-wcas-is-details .dgwt-wcas-si{width:30px;max-width:100%;box-sizing:border-box}.dgwt-wcas-is-details .dgwt-wcas-sp{display:flex;top:0;flex-direction:column;height:100%;justify-content:center;resize:vertical}.dgwt-wcas-is-details .dgwt-wcas-sd{font-size:11px;line-height:100%}.dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy=product_cat],.dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy=product_tag]{padding-left:15px;min-height:0}.dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy=product_cat] .dgwt-wcas-st,.dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy=product_tag] .dgwt-wcas-st{padding-left:0}.dgwt-wcas-no-submit .dgwt-wcas-ico-magnifier{height:50%;max-height:20px;width:100%;max-width:20px;left:12px;right:auto;opacity:.5;fill:#000}.rtl .dgwt-wcas-no-submit .dgwt-wcas-ico-magnifier{left:auto;right:12px}.dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input{padding:10px 15px 10px 40px}.rtl .dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input{padding:10px 40px 10px 15px}.dgwt-wcas-overlay-mobile-on,.dgwt-wcas-overlay-mobile-on body{overflow:hidden}.dgwt-wcas-om-bar{display:flex;height:45px;width:100%}.dgwt-wcas-om-bar .dgwt-wcas-om-return{width:45px;height:100%;display:block;background:#ccc;cursor:pointer;position:relative}.dgwt-wcas-om-bar .dgwt-wcas-om-return svg{width:23px;height:23px;position:absolute;left:12px;top:12px}.rtl .dgwt-wcas-om-bar .dgwt-wcas-om-return svg{left:11px;top:9px;-moz-transform:rotate(180deg);-webkit-transform:rotate(180deg);-o-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.dgwt-wcas-om-bar .dgwt-wcas-has-submit-off .dgwt-wcas-preloader{right:0!important}.rtl .dgwt-wcas-om-bar .dgwt-wcas-has-submit-off .dgwt-wcas-preloader{left:4px!important;right:auto!important}@keyframes dgwt-wcas-preloader-price-anim{0%{background:rgba(128,128,128,.03)}50%{background:rgba(128,128,128,.1)}100%{background:rgba(128,128,128,.03)}}.dgwt-wcas-preloader-price-inner div:nth-child(1){left:0;animation-delay:-.1s}.dgwt-wcas-preloader-price-inner div:nth-child(2){left:13px;animation-delay:-.2s}.dgwt-wcas-preloader-price-inner div:nth-child(3){left:26px;animation-delay:-.3s}.dgwt-wcas-preloader-price{width:34px;height:10px;display:inline-block;overflow:hidden;background:0 0}.dgwt-wcas-preloader-price-inner{width:100%;height:100%;position:relative;transform:translateZ(0) scale(1);backface-visibility:hidden;transform-origin:0 0}.dgwt-wcas-preloader-price-inner div{position:absolute;width:8px;height:8px;background:rgba(128,128,128,.05);animation:dgwt-wcas-preloader-price-anim .8s cubic-bezier(0,.5,.5,1) infinite;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.dgwt-wcas-om-bar .dgwt-wcas-sf-wrapp button.dgwt-wcas-search-submit{display:none}.dgwt-wcas-om-bar .dgwt-wcas-search-wrapp-mobile{width:calc(100% - 45px);max-width:none;margin:0}.dgwt-wcas-overlay-mobile .dgwt-wcas-search-form{width:100%}.dgwt-wcas-overlay-mobile{position:absolute;left:0;right:0;top:0;bottom:0;width:100%;background:#fff}.dgwt-wcas-overlay-mobile *{box-sizing:border-box}.dgwt-wcas-search-wrapp-mobile input[type=search].dgwt-wcas-search-input{height:45px!important;border-top:none;border-right:none;border-left:none;border-radius:0;font-size:16px!important}.dgwt-wcas-search-wrapp-mobile input[type=search].dgwt-wcas-search-input:focus{font-size:16px!important}.dgwt-wcas-overlay-mobile-on .dgwt-wcas-suggestions-wrapp{left:0!important;top:45px!important;width:100%!important;height:calc(100% - 45px)!important;position:absolute;overflow-y:auto;border:none;margin:0;display:block}.dgwt-wcas-overlay-mobile-on .dgwt-wcas-suggestion{width:100%}.dgwt-wcas-overlay-mobile-on .dgwt-wcas-enable-mobile-form{display:none}.dgwt-wcas-enable-mobile-form{position:absolute;z-index:100;left:0;top:0;width:100%;height:100%;cursor:pointer}html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-icon-mobile .dgwt-wcas-search-form{display:none;position:relative}html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-search-wrapp.dgwt-wcas-icon-mobile{min-width:0;display:inline-block;width:28px;height:28px}html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-icon-handler{height:100%;width:100%}html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-icon-handler .dgwt-wcas-ico-magnifier{opacity:1;position:static;max-width:none;max-height:none}.dgwt-wcas-overlay-mobile-on .dgwt-wcas-icon-handler{display:none}.dgwt-wcas-overlay-mobile-on body.dgwt-wcas-is-ios .dgwt-wcas-suggestions-wrapp{height:calc(100% - 45px)!important}.dgwt-wcas-overlay-mobile-on body.dgwt-wcas-is-ios{overflow:visible;overflow-x:hidden}.dgwt-wcas-overlay-mobile-on body.dgwt-wcas-is-ios .dgwt-wcas-suggestions-wrapp{max-height:none!important;height:auto!important}.dgwt-wcas-overlay-mobile-on body.dgwt-wcas-is-ios:not(.dgwt-wcas-theme-flatsome)>:not(.dgwt-wcas-overlay-mobile){display:none}body .dgwt-wcas-content-wrapp .rood,body .dgwt-wcas-content-wrapp .zwave{display:none}.dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon{min-width:unset}.dgwt-wcas-layout-icon-flexible .dgwt-wcas-search-form{opacity:0}.dgwt-wcas-layout-icon-flexible-loaded .dgwt-wcas-search-form{opacity:1}.dgwt-wcas-search-icon-arrow{display:none}html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-search-form{opacity:0;display:none;position:absolute;left:0;top:calc(100% + 8px);min-width:500px;z-index:1000}.dgwt-wcas-overlay-mobile .dgwt-wcas-search-icon,.dgwt-wcas-overlay-mobile .dgwt-wcas-search-icon-arrow{display:none}html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon.dgwt-wcas-layout-icon-open .dgwt-wcas-search-form{display:block;opacity:1}.dgwt-wcas-search-icon{width:20px;height:auto;cursor:pointer}.dgwt-wcas-ico-magnifier-handler{margin-bottom:-.2em;width:100%}.dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon.dgwt-wcas-layout-icon-open .dgwt-wcas-search-icon{opacity:.6}.dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon.dgwt-wcas-layout-icon-open .dgwt-wcas-sf-wrapp .dgwt-wcas-ico-magnifier{display:none}.dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon.dgwt-wcas-layout-icon-open.dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input{padding-left:15px}.dgwt-wcas-layout-icon-open .dgwt-wcas-search-icon-arrow{display:block;position:absolute;top:calc(100% + 2px);left:0;z-index:5;width:15px;height:15px;background:#fff;border:1px solid #ddd;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.dgwt-wcas-layout-icon-flexible:not(.dgwt-wcas-layout-icon) .dgwt-wcas-search-icon,.dgwt-wcas-layout-icon-flexible:not(.dgwt-wcas-layout-icon) .dgwt-wcas-search-icon-arrow{display:none}.dgwt-wcas-has-headings .dgwt-wcas-suggestion{border-bottom:none}.dgwt-wcas-has-headings .dgwt-wcas-st>span.dgwt-wcas-st--direct-headline{display:none}.dgwt-wcas-has-headings .dgwt-wcas-suggestion-headline{pointer-events:none;display:block;font-weight:500;white-space:nowrap}.dgwt-wcas-has-headings .dgwt-wcas-suggestion-headline .dgwt-wcas-st{border-bottom:1px solid #ddd;padding-bottom:3px;text-transform:uppercase;margin-top:16px;font-size:12px}.dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-headline,.dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-tax{border-bottom:none}.dgwt-wcas-has-headings .dgwt-wcas-suggestion-tax .dgwt-wcas-st{padding:0}.dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-tax.dgwt-wcas-suggestion-selected,.dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-tax:hover{background:0 0;text-decoration:underline}.dgwt-wcas-is-details .dgwt-wcas-has-headings .dgwt-wcas-suggestion.dgwt-wcas-suggestion-tax{min-height:30px}
assets/js/admin.js CHANGED
@@ -130,6 +130,82 @@
130
 
131
  };
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  var AJAX_BUILD_INDEX = {
134
  actionTriggerClass: 'js-ajax-build-index',
135
  actionStopTriggerClass: 'js-ajax-stop-build-index',
@@ -279,201 +355,39 @@
279
  }
280
  };
281
 
282
- var AJAX_CLOSE_BACKWARD_COMPATIBILITY = {
283
- actionTriggerClass: 'js-dgwt-wcas-bc-wipe-all',
284
- switchLeftLabelClass: 'js-dgwt-wcas-switch-left',
285
- switchRightLabelClass: 'js-dgwt-wcas-switch-right',
286
- switcherClass: 'js-dgwt-wcas-switcher',
287
- remindMeLaterClass: 'js-dgwt-wcas-bc-remind-me',
288
- applyChanges: function () {
289
  var _this = this;
290
 
291
-
292
- jQuery(document).on('click', '.' + _this.actionTriggerClass, function (e) {
293
- e.preventDefault();
294
-
295
- var $btn = $(this);
296
-
297
- $btn.attr('disabled', 'disabled');
298
- jQuery.ajax({
299
  url: ajaxurl,
300
- type: 'post',
301
  data: {
302
- action: 'dgwt_wcas_bc_keep_latest',
303
- },
304
- success: function (response) {
305
 
306
- if (typeof response.success != 'undefined' && response.success) {
307
-
308
- $('.dgwt_wcas_basic-tab').click();
309
-
310
- $('.js-dgwt-wcas-bc-notice').fadeOut(400, function () {
311
- $(this).remove();
312
- });
313
- }
314
  },
315
- complete: function () {
316
- $btn.removeAttr('disabled');
317
- }
318
- });
319
- })
320
-
321
- },
322
- switchAjaxRequest: function (state, visualChange) {
323
- var _this = this,
324
- $switcher = $('.dgwt-wcas-bc-switcher'),
325
- $errorNotice = $('.dgwt-wcas-bc-error'),
326
- $successNotice = $('.dgwt-wcas-bc-success'),
327
- $spinner = $('.js-dgwt-wcas-bc-spinner');
328
 
329
- $switcher.addClass('dgwt-wcas-non-events');
330
- $spinner.removeClass('dgwt-wcas-hidden');
331
- $errorNotice.addClass('dgwt-wcas-hidden');
332
- $successNotice.addClass('dgwt-wcas-hidden');
333
-
334
- state = state === 'enable' ? 'enable' : 'disable';
335
-
336
- jQuery.ajax({
337
- url: ajaxurl,
338
- type: 'post',
339
- data: {
340
- action: 'dgwt_wcas_bc_toggle',
341
- state: state
342
- },
343
- success: function (response) {
344
-
345
- if (typeof response.success != 'undefined' && response.success) {
346
- visualChange();
347
- if (state === 'disable') {
348
- _this.flashStepsContainer();
349
  }
350
- setTimeout(function () {
351
- $successNotice.removeClass('dgwt-wcas-hidden');
352
- }, 500);
353
- setTimeout(function () {
354
- $successNotice.addClass('dgwt-wcas-hidden');
355
- }, 2000);
356
-
357
-
358
- } else {
359
- $switcher.removeClass('dgwt-wcas-non-events');
360
- $spinner.addClass('dgwt-wcas-hidden');
361
- $errorNotice.removeClass('dgwt-wcas-hidden');
362
  }
363
-
364
- },
365
- error: function () {
366
- $errorNotice.removeClass('dgwt-wcas-hidden');
367
- },
368
- complete: function () {
369
- $switcher.removeClass('dgwt-wcas-non-events');
370
- $spinner.addClass('dgwt-wcas-hidden');
371
- }
372
- });
373
-
374
- },
375
- enableBC: function () {
376
- var _this = this;
377
-
378
- _this.switchAjaxRequest('enable', function () {
379
- $('.' + _this.switcherClass).attr('checked', true);
380
- $('.' + _this.switchLeftLabelClass).addClass('dgwt-wcas-toggler--is-active');
381
- $('.' + _this.switchRightLabelClass).removeClass("dgwt-wcas-toggler--is-active");
382
- $('.dgwt-wcas-toggle').addClass('dgwt-wcas-toggle--mute');
383
-
384
- $('.js-dgwt-wcas-todo-old').removeClass('dgwt-wcas-hidden');
385
- $('.js-dgwt-wcas-todo-latest').addClass('dgwt-wcas-hidden');
386
- });
387
-
388
-
389
- },
390
- disableBC: function () {
391
- var _this = this;
392
-
393
- _this.switchAjaxRequest('disable', function () {
394
- $('.' + _this.switcherClass).attr('checked', false);
395
- $('.' + _this.switchRightLabelClass).addClass('dgwt-wcas-toggler--is-active');
396
- $('.' + _this.switchLeftLabelClass).removeClass("dgwt-wcas-toggler--is-active");
397
- $('.dgwt-wcas-toggle').removeClass('dgwt-wcas-toggle--mute');
398
-
399
- $('.js-dgwt-wcas-todo-old').addClass('dgwt-wcas-hidden');
400
- $('.js-dgwt-wcas-todo-latest').removeClass('dgwt-wcas-hidden');
401
- });
402
-
403
- },
404
- remindMeLater: function () {
405
- jQuery.ajax({
406
- url: ajaxurl,
407
- type: 'post',
408
- data: {
409
- action: 'dgwt_wcas_bc_remind_me_later',
410
- },
411
- success: function (response) {
412
-
413
- if (typeof response.success != 'undefined' && response.success) {
414
- $('.js-dgwt-wcas-bc-notice').fadeOut(400, function () {
415
- $(this).remove();
416
- });
417
- }
418
-
419
- }
420
- });
421
- },
422
- flashStepsContainer: function () {
423
- var _this = this,
424
- $container = $('.dgwt-wcas-bc-todo-wrapp');
425
- $container.addClass('dgwt-wcas-anim-shake');
426
- setTimeout(function () {
427
- $container.removeClass('dgwt-wcas-anim-shake');
428
- }, 2000)
429
- },
430
- switchListeners: function () {
431
- var _this = this;
432
-
433
- $('.' + _this.switchLeftLabelClass).on('click', function () {
434
- _this.enableBC();
435
- });
436
-
437
- $('.' + _this.switchRightLabelClass).on('click', function () {
438
- _this.disableBC();
439
- });
440
-
441
- $('.' + _this.switcherClass).on('click', function (e) {
442
- e.preventDefault();
443
-
444
- if ($('.' + _this.switcherClass).is(':checked')) {
445
- _this.enableBC();
446
- } else {
447
- _this.disableBC();
448
- }
449
-
450
- });
451
-
452
- $('.' + _this.remindMeLaterClass).on('click', function (e) {
453
- e.preventDefault();
454
-
455
- _this.remindMeLater();
456
- });
457
 
458
  },
459
- init: function () {
460
- var _this = this;
461
- _this.applyChanges();
462
- _this.switchListeners();
463
- }
464
- };
465
 
466
- var SELECTIZE = {
467
- init: function () {
468
- var _this = this;
469
  var $inputs = $('.dgwt-wcas-selectize');
470
 
 
471
  if ($inputs.length > 0) {
472
  $inputs.each(function () {
473
 
474
  var $input = $(this);
475
  var optionsRaw = $input.data('options');
476
- var options = [];
477
 
478
  if (optionsRaw.length > 0) {
479
  optionsRaw = JSON.parse('["' + decodeURI(optionsRaw.replace(/&/g, "\",\"").replace(/=/g, "\",\"")) + '"]');
@@ -495,24 +409,41 @@
495
  $(this).selectize({
496
  persist: false,
497
  maxItems: null,
498
- valueField: 'value',
499
  labelField: 'label',
500
  searchField: ['value', 'label'],
 
501
  create: function (input) {
502
  return {
503
- value: input,
504
- label: input
505
  }
506
  },
507
- options: options,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
  });
509
 
510
  });
511
  }
512
 
513
-
514
  }
515
- }
516
 
517
  var TOOLTIP = {
518
  init: function () {
@@ -627,6 +558,7 @@
627
  setTimeout(function () {
628
  $options.removeClass(_this.transClass);
629
  CHECKBOX_SETTINGS_TOGGLE.refresh();
 
630
  }, 500)
631
 
632
  }, 500);
@@ -1451,11 +1383,10 @@
1451
 
1452
  RADIO_SETTINGS_TOGGLE.init();
1453
  CHECKBOX_SETTINGS_TOGGLE.init();
 
1454
 
1455
  automateSettingsColspan();
1456
 
1457
- AJAX_CLOSE_BACKWARD_COMPATIBILITY.init();
1458
-
1459
  AJAX_BUILD_INDEX.init();
1460
  SELECTIZE.init();
1461
  TOOLTIP.init();
130
 
131
  };
132
 
133
+ var CONDITIONAL_LAYOUT_SETTINGS = {
134
+ layoutSelect: "select[id*='search_layout']",
135
+ overlayMobile: "input[id*='enable_mobile_overlay']",
136
+ mobileBreakpoint: "input[id*='mobile_breakpoint']",
137
+ $select: null,
138
+ $overlayMobileEl: null,
139
+ $mobileBreakpointEl: null,
140
+ setConditions: function () {
141
+ var _this = this,
142
+ currentVal = _this.$select.find('option:selected').val(),
143
+ hasAdvSettings = $('.js-dgwt-wcas-adv-settings-toggle').hasClass('woocommerce-input-toggle--enabled');
144
+
145
+ _this.hideOption(_this.$overlayMobileEl);
146
+ _this.hideOption(_this.$mobileBreakpointEl);
147
+
148
+ switch (currentVal) {
149
+ case 'icon':
150
+ break;
151
+ case 'icon-flexible':
152
+
153
+ if (hasAdvSettings) {
154
+ _this.showOption(_this.$mobileBreakpointEl);
155
+ }
156
+
157
+ break;
158
+ default:
159
+
160
+ if (hasAdvSettings) {
161
+
162
+ _this.showOption(_this.$overlayMobileEl);
163
+
164
+ if (_this.$overlayMobileEl.is(':checked')) {
165
+ _this.showOption(_this.$mobileBreakpointEl);
166
+ }
167
+ }
168
+
169
+ break;
170
+ }
171
+ },
172
+ hideOption: function($el){
173
+ $el.closest('tr').hide();
174
+ },
175
+ showOption: function($el){
176
+ $el.closest('tr').show();
177
+ },
178
+ registerListeners: function () {
179
+ var _this = this;
180
+
181
+ _this.$select.on('change', function () {
182
+ _this.setConditions();
183
+ });
184
+
185
+ _this.$overlayMobileEl.on('change', function () {
186
+ _this.setConditions();
187
+ });
188
+
189
+ },
190
+ init: function () {
191
+ var _this = this,
192
+ $sel = $(_this.layoutSelect);
193
+
194
+ if ($sel.length > 0) {
195
+ _this.$select = $sel;
196
+ _this.$overlayMobileEl = $(_this.overlayMobile);
197
+ _this.$mobileBreakpointEl = $(_this.mobileBreakpoint);
198
+ _this.registerListeners();
199
+
200
+ setTimeout(function(){
201
+ _this.setConditions();
202
+ }, 400);
203
+ }
204
+
205
+ }
206
+
207
+ };
208
+
209
  var AJAX_BUILD_INDEX = {
210
  actionTriggerClass: 'js-ajax-build-index',
211
  actionStopTriggerClass: 'js-ajax-stop-build-index',
355
  }
356
  };
357
 
358
+ var SELECTIZE = {
359
+ init: function () {
 
 
 
 
 
360
  var _this = this;
361
 
362
+ if ($('.dgwt-wcas-selectize').length > 0) {
363
+ $.ajax({
 
 
 
 
 
 
364
  url: ajaxurl,
 
365
  data: {
366
+ action: 'dgwt_wcas_settings_list_custom_fields',
367
+ _wpnonce: $('.dgwt-wcas-selectize').data('security')
 
368
 
 
 
 
 
 
 
 
 
369
  },
370
+ success: function (res) {
 
 
 
 
 
 
 
 
 
 
 
 
371
 
372
+ if(typeof res != 'undefined' && typeof res.data != 'undefined') {
373
+ _this.initSelectize(res.data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  }
 
 
 
 
 
 
 
 
 
 
 
 
375
  }
376
+ });
377
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
 
379
  },
380
+ initSelectize: function (loadedOptions) {
 
 
 
 
 
381
 
 
 
 
382
  var $inputs = $('.dgwt-wcas-selectize');
383
 
384
+
385
  if ($inputs.length > 0) {
386
  $inputs.each(function () {
387
 
388
  var $input = $(this);
389
  var optionsRaw = $input.data('options');
390
+ var options = loadedOptions;
391
 
392
  if (optionsRaw.length > 0) {
393
  optionsRaw = JSON.parse('["' + decodeURI(optionsRaw.replace(/&/g, "\",\"").replace(/=/g, "\",\"")) + '"]');
409
  $(this).selectize({
410
  persist: false,
411
  maxItems: null,
412
+ valueField: 'key',
413
  labelField: 'label',
414
  searchField: ['value', 'label'],
415
+ options: options,
416
  create: function (input) {
417
  return {
418
+ value: input.key,
419
+ label: input.label
420
  }
421
  },
422
+ load: function (query, callback) {
423
+ if (!query.length) return callback();
424
+
425
+ $.ajax({
426
+ url: ajaxurl,
427
+ data: {
428
+ action: 'dgwt_wcas_settings_list_custom_fields',
429
+ _wpnonce: $input.data('security')
430
+
431
+ },
432
+ error: function () {
433
+ callback();
434
+ },
435
+ success: function (res) {
436
+ callback(res.data);
437
+ }
438
+ });
439
+ }
440
  });
441
 
442
  });
443
  }
444
 
 
445
  }
446
+ };
447
 
448
  var TOOLTIP = {
449
  init: function () {
558
  setTimeout(function () {
559
  $options.removeClass(_this.transClass);
560
  CHECKBOX_SETTINGS_TOGGLE.refresh();
561
+ CONDITIONAL_LAYOUT_SETTINGS.setConditions();
562
  }, 500)
563
 
564
  }, 500);
1383
 
1384
  RADIO_SETTINGS_TOGGLE.init();
1385
  CHECKBOX_SETTINGS_TOGGLE.init();
1386
+ CONDITIONAL_LAYOUT_SETTINGS.init();
1387
 
1388
  automateSettingsColspan();
1389
 
 
 
1390
  AJAX_BUILD_INDEX.init();
1391
  SELECTIZE.init();
1392
  TOOLTIP.init();
assets/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- !function(s){var t={inputSel:"dgwt-wcas-options-toggle input[type=radio]",groupSel:"dgwt_wcas_settings-group",reloadChoices:function(t){var e=s('[name="'+t+'"]').closest("."+this.groupSel),a=s('[name="'+t+'"]:checked').val(),i="";this.hideAll(e),(a=a.replace("_","-")).length>0&&(i="wcas-opt-"+a),s("."+i).length>0&&s("."+i).fadeIn()},hideAll:function(s){s.find('tr[class*="wcas-opt-"]').hide()},registerListeners:function(){var t=this;s("."+t.inputSel).on("change",function(){t.reloadChoices(s(this).attr("name"))})},init:function(){var t=this,e=s("."+t.inputSel+":checked");e.length>0&&(t.registerListeners(),e.each(function(){t.reloadChoices(s(this).attr("name"))}))}},e={inputSel:"dgwt-wcas-options-cb-toggle input[type=checkbox]",groupSel:"dgwt_wcas_settings-group",reloadChoices:function(t){var e=t.is(":checked"),a=this.getGroupSelector(t);s("."+a+":not(.dgwt-wcas-options-cb-toggle)").hide(),e&&s("."+a).each(function(){s(this).hasClass("js-dgwt-wcas-adv-settings")&&s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--disabled")||s(this).fadeIn()})},getGroupSelector(t){var e=t.closest(".dgwt-wcas-options-cb-toggle"),a="",i=e.attr("class").split(/\s+/);return s.each(i,function(s,t){-1!==t.indexOf("js-dgwt-wcas-cbtgroup-")&&(a=t)}),a},registerListeners:function(){var t=this;s(document).on("change","."+t.inputSel,function(){t.reloadChoices(s(this))})},refresh:function(){var t=this,e=s("."+t.inputSel);e.length>0&&e.each(function(){var e=s(this).is(":checked"),a=t.getGroupSelector(s(this));e?s("."+a).fadeIn():s("."+a+":not(.dgwt-wcas-options-cb-toggle)").hide()})},init:function(){var t=this,e=s("."+t.inputSel);e.length>0&&(t.registerListeners(),e.each(function(){t.reloadChoices(s(this))}))}},a={actionTriggerClass:"js-ajax-build-index",actionStopTriggerClass:"js-ajax-stop-build-index",indexingWrappoerClass:"js-dgwt-wcas-indexing-wrapper",getWrapper:function(){return s("."+this.indexingWrappoerClass).closest(".dgwt-wcas-settings-info")},registerListeners:function(){var t=this;s(document).on("click","."+t.actionTriggerClass,function(e){e.preventDefault();var a=s(this);a.attr("disabled","disabled"),s(".dgwt-wcas-settings-info").addClass("wcas-ajax-build-index-wait");var i=!!a.hasClass("js-ajax-build-index-emergency");i&&(s(".dgwt-wcas-indexing-header__title").text("[Emergency mode] Wait... Indexing in progress"),s(".dgwt-wcas-indexing-header__troubleshooting, .dgwt-wcas-indexing-header__actions, .js-dgwt-wcas-indexer-details").hide()),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_build_index",emergency:i},success:function(s){void 0!==s&&s.success&&(t.getWrapper().html(s.data.html),t.heartbeat())},complete:function(){a.removeAttr("disabled"),s(".dgwt-wcas-settings-info").removeClass("wcas-ajax-build-index-wait"),i&&window.location.reload()}})}),s(document).on("click","."+t.actionStopTriggerClass,function(e){e.preventDefault();var a=s(this);a.attr("disabled","disabled"),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_stop_build_index"},success:function(s){void 0!==s&&s.success&&(t.getWrapper().html(s.data.html),t.heartbeat())},complete:function(){a.removeAttr("disabled")}})})},heartbeat:function(){var t=this;setTimeout(function(){s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_build_index_heartbeat"},success:function(s){void 0!==s&&s.success&&(t.getWrapper().html(s.data.html),s.data.loop&&t.heartbeat())}})},1e3)},detailsToggle:function(){var t;s(document).on("click",".js-dgwt-wcas-indexing-details-trigger",function(e){e.preventDefault();var a=s(".js-dgwt-wcas-indexer-details");a.hasClass("show")?(a.removeClass("show"),a.addClass("hide"),s(".js-dgwt-wcas-indexing__showd").addClass("show").removeClass("hide"),s(".js-dgwt-wcas-indexing__hided").addClass("hide").removeClass("show"),t=!1):(a.addClass("show"),a.removeClass("hide"),s(".js-dgwt-wcas-indexing__showd").addClass("hide").removeClass("show"),s(".js-dgwt-wcas-indexing__hided").addClass("show").removeClass("hide"),t=!0),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_index_details_toggle",display:t}})})},init:function(){this.registerListeners(),s("."+this.indexingWrappoerClass).length>0&&this.heartbeat(),this.detailsToggle()}},i={actionTriggerClass:"js-dgwt-wcas-bc-wipe-all",switchLeftLabelClass:"js-dgwt-wcas-switch-left",switchRightLabelClass:"js-dgwt-wcas-switch-right",switcherClass:"js-dgwt-wcas-switcher",remindMeLaterClass:"js-dgwt-wcas-bc-remind-me",applyChanges:function(){jQuery(document).on("click","."+this.actionTriggerClass,function(t){t.preventDefault();var e=s(this);e.attr("disabled","disabled"),jQuery.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_bc_keep_latest"},success:function(t){void 0!==t.success&&t.success&&(s(".dgwt_wcas_basic-tab").click(),s(".js-dgwt-wcas-bc-notice").fadeOut(400,function(){s(this).remove()}))},complete:function(){e.removeAttr("disabled")}})})},switchAjaxRequest:function(t,e){var a=this,i=s(".dgwt-wcas-bc-switcher"),o=s(".dgwt-wcas-bc-error"),n=s(".dgwt-wcas-bc-success"),c=s(".js-dgwt-wcas-bc-spinner");i.addClass("dgwt-wcas-non-events"),c.removeClass("dgwt-wcas-hidden"),o.addClass("dgwt-wcas-hidden"),n.addClass("dgwt-wcas-hidden"),t="enable"===t?"enable":"disable",jQuery.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_bc_toggle",state:t},success:function(s){void 0!==s.success&&s.success?(e(),"disable"===t&&a.flashStepsContainer(),setTimeout(function(){n.removeClass("dgwt-wcas-hidden")},500),setTimeout(function(){n.addClass("dgwt-wcas-hidden")},2e3)):(i.removeClass("dgwt-wcas-non-events"),c.addClass("dgwt-wcas-hidden"),o.removeClass("dgwt-wcas-hidden"))},error:function(){o.removeClass("dgwt-wcas-hidden")},complete:function(){i.removeClass("dgwt-wcas-non-events"),c.addClass("dgwt-wcas-hidden")}})},enableBC:function(){var t=this;t.switchAjaxRequest("enable",function(){s("."+t.switcherClass).attr("checked",!0),s("."+t.switchLeftLabelClass).addClass("dgwt-wcas-toggler--is-active"),s("."+t.switchRightLabelClass).removeClass("dgwt-wcas-toggler--is-active"),s(".dgwt-wcas-toggle").addClass("dgwt-wcas-toggle--mute"),s(".js-dgwt-wcas-todo-old").removeClass("dgwt-wcas-hidden"),s(".js-dgwt-wcas-todo-latest").addClass("dgwt-wcas-hidden")})},disableBC:function(){var t=this;t.switchAjaxRequest("disable",function(){s("."+t.switcherClass).attr("checked",!1),s("."+t.switchRightLabelClass).addClass("dgwt-wcas-toggler--is-active"),s("."+t.switchLeftLabelClass).removeClass("dgwt-wcas-toggler--is-active"),s(".dgwt-wcas-toggle").removeClass("dgwt-wcas-toggle--mute"),s(".js-dgwt-wcas-todo-old").addClass("dgwt-wcas-hidden"),s(".js-dgwt-wcas-todo-latest").removeClass("dgwt-wcas-hidden")})},remindMeLater:function(){jQuery.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_bc_remind_me_later"},success:function(t){void 0!==t.success&&t.success&&s(".js-dgwt-wcas-bc-notice").fadeOut(400,function(){s(this).remove()})}})},flashStepsContainer:function(){var t=s(".dgwt-wcas-bc-todo-wrapp");t.addClass("dgwt-wcas-anim-shake"),setTimeout(function(){t.removeClass("dgwt-wcas-anim-shake")},2e3)},switchListeners:function(){var t=this;s("."+t.switchLeftLabelClass).on("click",function(){t.enableBC()}),s("."+t.switchRightLabelClass).on("click",function(){t.disableBC()}),s("."+t.switcherClass).on("click",function(e){e.preventDefault(),s("."+t.switcherClass).is(":checked")?t.enableBC():t.disableBC()}),s("."+t.remindMeLaterClass).on("click",function(s){s.preventDefault(),t.remindMeLater()})},init:function(){this.applyChanges(),this.switchListeners()}},o={init:function(){var t=s(".dgwt-wcas-selectize");t.length>0&&t.each(function(){var t=s(this).data("options"),e=[];if(t.length>0){t=JSON.parse('["'+decodeURI(t.replace(/&/g,'","').replace(/=/g,'","'))+'"]');var a="";t.forEach(function(s,t){if((t+1)%2==0){var i={value:s,label:a};e.push(i),a=""}a=s})}s(this).selectize({persist:!1,maxItems:null,valueField:"value",labelField:"label",searchField:["value","label"],create:function(s){return{value:s,label:s}},options:e})})}},n={init:function(){var t=s(".js-dgwt-wcas-tooltip");t.length>0&&t.each(function(){var t=s(this)[0],e=s(this).data("tooltip-html-el");if(e){new DgwtWcasTooltip(t,{title:s("."+e+" > .dgwt-wcas-tooltip-wrapper")[0],placement:"top",trigger:"hover",html:!0})}})}},c={advClass:"js-dgwt-wcas-adv-settings",highlightClass:"dgwt-wcas-opt-highlight",transClass:"dgwt-wcas-opt-transition",init:function(){this.clickListener(),this.setStartingState()},clickListener:function(){var t=this;s(document).on("click",".js-dgwt-wcas-settings__advanced",function(){var e;e=s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--disabled")?"show":"hide",t.saveChoice(e)})},setStartingState:function(){var t=s("."+this.advClass);t.length>0&&(s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--enabled")?(t.show(),e.refresh()):t.hide())},saveChoice:function(t){s(".js-dgwt-wcas-settings__advanced").append('<span class="dgwt-wcas-adv-settings-saving">saving...</span>'),s.ajax({url:ajaxurl,data:{action:"dgwt_wcas_adv_settings",adv_settings_value:t}}).done(function(t){s(".dgwt-wcas-adv-settings-saving").remove()});var e=s(".js-dgwt-wcas-adv-settings-toggle");"show"===t&&(e.removeClass("woocommerce-input-toggle--disabled"),e.addClass("woocommerce-input-toggle--enabled")),"hide"===t&&(e.removeClass("woocommerce-input-toggle--enabled"),e.addClass("woocommerce-input-toggle--disabled")),this.toggleAdvancedOpt(t)},toggleAdvancedOpt:function(t){var a=this,i=s("."+a.advClass);i.length>0&&(i.addClass(a.highlightClass),i.addClass(a.transClass),"show"===t&&i.fadeIn(500,function(){setTimeout(function(){i.removeClass(a.highlightClass),setTimeout(function(){i.removeClass(a.transClass),e.refresh()},500)},500)}),"hide"===t&&setTimeout(function(){i.removeClass(a.transClass),i.fadeOut(500,function(){i.removeClass(a.highlightClass)})},500))}};window.DGWT_WCAS_SEARCH_PREVIEW={previewWrapper:{},searchWrapp:{},suggestionWrapp:{},searchInput:{},init:function(){this.previewWrapper=s(".js-dgwt-wcas-preview"),this.searchWrapp=s(".js-dgwt-wcas-search-wrapp"),this.suggestionWrapp=s(".js-dgwt-wcas-suggestions-wrapp"),this.detailsWrapp=s(".js-dgwt-wcas-details-wrapp"),this.searchInput=s(".js-dgwt-wcas-search-input"),this.onChangeHandler(),this.onColorHandler(),this.onTypeHandler(),this.disableSubmit(),this.noResultsHandler(),this.fixSizesInit()},isChecked:function(s){return!!(s.length>0&&s.is(":checked"))},isColor:function(s){return"string"==typeof s&&7===s.length&&"#"===s.charAt(0)},camelCase:function(s){for(var t=s.split("_"),e="",a=0;a<t.length;a++)e+=t[a].charAt(0).toUpperCase()+t[a].slice(1);return e},disableSubmit:function(){var t,e;s(".js-dgwt-wcas-preview-source").on("click",function(a){a.preventDefault();var i=a.pageX-100,o=a.pageY+10;void 0!==t&&(clearTimeout(t),e&&e.remove()),s("body").append('<div class="dgwt-wcas-click-alert">No interaction! This is only a preview.</div>'),(e=s(".dgwt-wcas-click-alert")).css({left:i,top:o}),s(".dgwt-wcas-preview-source").addClass("dgwt-wcas-preview-source-no-click"),t=setTimeout(function(){e.fadeOut(500,function(){s(this).remove(),s(".dgwt-wcas-preview-source").removeClass("dgwt-wcas-preview-source-no-click")})},2e3)})},noResultsHandler:function(){var t=this,e=".js-dgwt-wcas-preview .dgwt-wcas-suggestion:not(.js-dgwt-wcas-suggestion-nores)",a="input[id*='search_no_results_text']";s(document).on("focus",a,function(){s(e).addClass("dgwt-wcas-hide"),s(".js-dgwt-wcas-suggestion-nores").removeClass("dgwt-wcas-hide"),t.detailsWrapp.addClass("dgwt-wcas-hide"),t.suggestionWrapp.addClass("dgwt-wcas-preview-nores")}),s(document).on("blur",a,function(){s(e).removeClass("dgwt-wcas-hide"),s(".js-dgwt-wcas-suggestion-nores").addClass("dgwt-wcas-hide"),t.detailsWrapp.removeClass("dgwt-wcas-hide"),t.suggestionWrapp.removeClass("dgwt-wcas-preview-nores")})},onChangeHandler:function(){for(var t=this,e=["show_submit_button","max_form_width","show_product_image","show_product_sku","show_product_desc","show_product_price","show_matching_categories","show_matching_tags","show_matching_brands","show_matching_posts","show_matching_pages","show_grouped_results","suggestions_limit","show_details_box"],a=0;a<e.length;a++){var i="input[id*='"+e[a]+"']",o=s(i),n="onChange"+t.camelCase(e[a]);"function"==typeof t[n]&&t[n](o,o.val()),s(document).on("change",i,function(){n=s(this).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),n="onChange"+t.camelCase(n),t[n](s(this),this.value)})}},onColorHandler:function(){for(var t=this,e=["bg_input_color","text_input_color","border_input_color","bg_submit_color","text_submit_color","sug_bg_color","sug_hover_color","sug_text_color","sug_highlight_color","sug_border_color"],a=0;a<e.length;a++){var i="input[id*='"+e[a]+"']",o=s(i),n="onColor"+t.camelCase(e[a]);t[n](o,o.val()),s(document).on("change",i,function(e){n=s(this).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),n="onColor"+t.camelCase(n),t[n](s(this),this.value)})}},onColorChangeHandler:function(s,t){var e=s.attr("id").replace("]","").replace("dgwt_wcas_settings[","");this[e="onColor"+this.camelCase(e)](s,t)},onTypeHandler:function(){for(var t=this,e=["search_submit_text","search_placeholder","search_no_results_text","search_see_all_results_text"],a=0;a<e.length;a++){var i="input[id*='"+e[a]+"']",o=s(i),n="onType"+t.camelCase(e[a]);t[n](o,o.val()),s(document).on("input",i,function(e){n=s(e.target).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),n="onType"+t.camelCase(n),t[n](s(e.target),this.value)})}},onChangeMaxFormWidth:function(t,e){e.length>0&&"0"!=e?(this.searchWrapp.css("max-width",e+"px"),this.suggestionWrapp.css("max-width",e+"px")):(this.searchWrapp.css("max-width","100%"),this.suggestionWrapp.css("max-width","100%")),this.onChangeShowDetailsBox(s("input[id*='show_details_box']"))},onChangeShowSubmitButton:function(t,e){var a=s(".js-dgwt-wcas-search-submit");if(this.isChecked(t)){this.searchWrapp.addClass("dgwt-wcas-has-submit"),this.searchWrapp.removeClass("dgwt-wcas-no-submit"),a.show(),s(".dgwt-wcas-sf-wrapp > .dgwt-wcas-ico-magnifier").hide();var i=s("input[id*='bg_submit_color']"),o=s("input[id*='text_submit_color']");this.onColorBgSubmitColor(i,i.val()),this.onColorTextSubmitColor(o,o.val())}else this.searchWrapp.addClass("dgwt-wcas-no-submit"),this.searchWrapp.removeClass("dgwt-wcas-has-submit"),a.hide(),s(".dgwt-wcas-sf-wrapp > .dgwt-wcas-ico-magnifier").show()},onChangeShowProductImage:function(t,e){var a=s(".js-dgwt-wcas-si"),i=s(".js-dgwt-wcas-content-wrapp");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-img"),s(".dgwt-wcas-suggestion-product > .dgwt-wcas-st").remove(),s(".dgwt-wcas-suggestion-product > .dgwt-wcas-sp").remove(),i.show(),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-img"),i.each(function(){s(this).closest(".dgwt-wcas-suggestion-product").append(s(this).html())}),i.hide(),a.hide())},onChangeShowProductSku:function(t,e){var a=s(".js-dgwt-wcas-sku");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-sku"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-sku"),a.hide())},onChangeShowProductDesc:function(t,e){var a=s(".js-dgwt-wcas-sd");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-desc"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-desc"),a.hide())},onChangeShowProductPrice:function(t,e){var a=s(".js-dgwt-wcas-sp");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-price"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-price"),a.hide())},onChangeShowMatchingCategories:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-cat"),i=s(".dgwt-wcas-suggestion-cat");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingTags:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-tag"),i=s(".dgwt-wcas-suggestion-tag");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingBrands:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-brand"),i=s(".dgwt-wcas-suggestion-brand");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingPosts:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-post"),i=s(".dgwt-wcas-suggestion-post");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingPages:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-page"),i=s(".dgwt-wcas-suggestion-page");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowGroupedResults:function(t,e){var a=s(".dgwt-wcas-st--direct-headline"),i=s(".dgwt-wcas-suggestion-headline");this.isChecked(t)?(a.addClass("dgwt-wcas-hidden"),this.suggestionWrapp.addClass("dgwt-wcas-has-headings"),s(".dgwt-wcas-suggestion-headline").show(),this.isChecked(s("input[id*='show_matching_categories']"))||s(".dgwt-wcas-suggestion-headline-cat").hide(),this.isChecked(s("input[id*='show_matching_tags']"))||s(".dgwt-wcas-suggestion-headline-tag").hide(),this.isChecked(s("input[id*='show_matching_brands']"))||s(".dgwt-wcas-suggestion-headline-brand").hide(),this.isChecked(s("input[id*='show_matching_posts']"))||s(".dgwt-wcas-suggestion-headline-post").hide(),this.isChecked(s("input[id*='show_matching_pages']"))||s(".dgwt-wcas-suggestion-headline-page").hide()):(a.removeClass("dgwt-wcas-hidden"),i.hide(),this.suggestionWrapp.removeClass("dgwt-wcas-has-headings"))},onChangeSuggestionsLimit:function(t,e){setTimeout(function(){var a=0,i=7,o=s(".dgwt-wcas-suggestion-duplicated"),n=["brand","cat","tag","post","page","product"];e.length>0&&"0"!=e&&(i=Math.abs(e)),o.length>0&&o.remove();var c=[];for(a=0;a<n.length;a++){var d=s(".dgwt-wcas-suggestion-"+n[a]+":not(.js-dgwt-wcas-suggestion-hidden)");d.length>0&&c.push(d)}var r=c.length;if(c.length>0)for(var g=i-c.length,l=c.length-1;g>0;){var w=c[l].clone();w.addClass("dgwt-wcas-suggestion-duplicated"),w.removeClass("dgwt-wcas-suggestion-selected"),c[l].after(w),r++,--l<0&&(l=c.length-1),g--}r>i&&t.val(r)},10)},onChangeShowDetailsBox:function(t,e){var a=this;a.isChecked(t)?(a.detailsWrapp.show(),a.searchWrapp.addClass("dgwt-wcas-is-detail-box"),a.previewWrapper.addClass("dgwt-wcas-is-details"),a.previewWrapper.addClass("dgwt-wcas-details-right"),setTimeout(function(){if(s(".dgwt-wcas-suggestion-product:not(.dgwt-wcas-suggestion-duplicated)").addClass("dgwt-wcas-suggestion-selected"),a.searchWrapp.width()>=550){a.previewWrapper.addClass("dgwt-wcas-full-width");var t=getComputedStyle(a.searchWrapp[0]).width;(t=Math.round(parseFloat(t.replace("px",""))))%2==0?(a.suggestionWrapp.css("width",Math.round(t/2)),a.detailsWrapp.css("width",Math.round(t/2))):(a.suggestionWrapp.css("width",Math.floor(t/2)),a.detailsWrapp.css("width",Math.ceil(t/2)))}else a.suggestionWrapp.width(a.searchWrapp.width())},10)):(a.detailsWrapp.hide(),a.searchWrapp.removeClass("dgwt-wcas-is-detail-box"),a.previewWrapper.removeClass("dgwt-wcas-is-details"),a.previewWrapper.removeClass("dgwt-wcas-details-right"),a.previewWrapper.removeClass("dgwt-wcas-full-width"),s(".dgwt-wcas-suggestion-product").removeClass("dgwt-wcas-suggestion-selected"),a.suggestionWrapp.css("width",""),a.detailsWrapp.css("width",""))},onColorBgInputColor:function(s,t){this.isColor(t)?this.searchInput.css("background-color",t):this.searchInput.css("background-color","")},onColorTextInputColor:function(t,e){var a="dgwt-wcas-preview-placeholder-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-search-input::placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input::-webkit-input-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input:-moz-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input::-moz-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input:-ms-input-placeholder{opacity: 0.3; color:"+e+"!important;}",i+="</style>",s("head").append(i),this.searchInput.css("color",e)}else{this.searchInput.css("color","");var o=s("."+a);o.length>0&&o.remove()}},onColorBorderInputColor:function(s,t){this.isColor(t)?this.searchInput.css("border-color",t):this.searchInput.css("border-color","")},onColorBgSubmitColor:function(t,e){if(this.isChecked(s("input[id*='show_submit_button']"))&&this.isColor(e)){var a='<style class="dgwt-wcas-preview-submit-style">';a+=".dgwt-wcas-search-submit::before{border-color: transparent "+e+"!important;}",a+=".dgwt-wcas-search-submit:hover::before{border-right-color: "+e+"!important;}",a+=".dgwt-wcas-search-submit:focus::before{border-right-color: "+e+"!important;}",a+=".dgwt-wcas-search-submit{background-color: "+e+"!important;}",a+=".dgwt-wcas-om-bar .dgwt-wcas-om-return{background-color: "+e+"!important;}",a+="</style>",s("head").append(a)}else{var i=s(".dgwt-wcas-preview-submit-style");i.length>0&&i.remove()}},onColorTextSubmitColor:function(t,e){this.isChecked(s("input[id*='show_submit_button']"))&&this.isColor(e)?(s(".js-dgwt-wcas-search-submit").css("color",e),s(".dgwt-wcas-ico-magnifier").css("fill",e)):(this.searchInput.css("background-color",""),s(".js-dgwt-wcas-search-submit").css("color",""),s(".dgwt-wcas-ico-magnifier").css("fill",""))},onColorSugBgColor:function(t,e){var a="dgwt-wcas-preview-sugbgcol-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp,",i+=".dgwt-wcas-details-wrapp",i+="{background-color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugHoverColor:function(t,e){this.isColor(e)?setTimeout(function(){s(".dgwt-wcas-suggestion-selected").css("background-color",e)},50):s(".dgwt-wcas-suggestion-selected").css("background-color","")},onColorSugTextColor:function(t,e){var a="dgwt-wcas-preview-sugtextcol-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp *,",i+=".dgwt-wcas-details-wrapp *,",i+=".dgwt-wcas-sd,",i+=".dgwt-wcas-suggestion *",i+="{color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugHighlightColor:function(t,e){var a="dgwt-wcas-preview-sughighlight-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-st strong,",i+=".dgwt-wcas-sd strong",i+="{color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugBorderColor:function(t,e){var a="dgwt-wcas-preview-sugborder-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp,",i+=".dgwt-wcas-details-wrapp,",i+=".dgwt-wcas-suggestion,",i+=".dgwt-wcas-datails-title,",i+=".dgwt-wcas-details-more-products",i+="{border-color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onTypeSearchSubmitText:function(t,e){var a=s(".js-dgwt-wcas-search-submit-l"),i=s(".js-dgwt-wcas-search-submit-m");e.length>0?(a.text(e),a.show(),i.hide()):(a.text(""),a.hide(),i.show())},onTypeSearchPlaceholder:function(s,t){0==t.length&&(t=dgwt_wcas.labels.search_placeholder),this.searchInput.attr("placeholder",t)},onTypeSearchNoResultsText:function(t,e){0==e.length&&(e=dgwt_wcas.labels.no_results),s(".js-dgwt-wcas-suggestion-nores span").text(e)},onTypeSearchSeeAllResultsText:function(t,e){0==e.length&&(e=dgwt_wcas.labels.show_more),s(".js-dgwt-wcas-st-more-label").text(e)},fixSizesInit:function(){var t=this;s(document).on("click","#dgwt_wcas_autocomplete-tab",function(){t.onChangeShowDetailsBox(s("input[id*='show_details_box']"))})}},s(document).ready(function(){var d,r;(d=s(".js-dgwt-wcas-settings-margin-nob")).length>0&&d.each(function(){var t=s(this).find("td .dgwt-wcas-fieldset");if(t.length>0){var e=s(this).prev(".js-dgwt-wcas-settings-margin");if(e.length>0){var a=s(this).attr("class").split(/\s+/),i="";s.each(a,function(s,t){-1!==t.indexOf("js-dgwt-wcas-cbtgroup-")&&(i=t)});var o=t.clone(!0,!0);o.addClass("dgwt-wcas-settings-margin-nob"),i&&o.addClass(i),o.appendTo(e.find("td")),s(this).remove()}}}),t.init(),e.init(),(r=s(".js-dgwt-wcas-sgs-autocolspan")).length>0&&r.find("td").attr("colspan",2),i.init(),a.init(),o.init(),n.init(),c.init(),window.DGWT_WCAS_SEARCH_PREVIEW.init()})}(jQuery);
1
+ !function(s){var t={inputSel:"dgwt-wcas-options-toggle input[type=radio]",groupSel:"dgwt_wcas_settings-group",reloadChoices:function(t){var e=s('[name="'+t+'"]').closest("."+this.groupSel),a=s('[name="'+t+'"]:checked').val(),i="";this.hideAll(e),(a=a.replace("_","-")).length>0&&(i="wcas-opt-"+a),s("."+i).length>0&&s("."+i).fadeIn()},hideAll:function(s){s.find('tr[class*="wcas-opt-"]').hide()},registerListeners:function(){var t=this;s("."+t.inputSel).on("change",function(){t.reloadChoices(s(this).attr("name"))})},init:function(){var t=this,e=s("."+t.inputSel+":checked");e.length>0&&(t.registerListeners(),e.each(function(){t.reloadChoices(s(this).attr("name"))}))}},e={inputSel:"dgwt-wcas-options-cb-toggle input[type=checkbox]",groupSel:"dgwt_wcas_settings-group",reloadChoices:function(t){var e=t.is(":checked"),a=this.getGroupSelector(t);s("."+a+":not(.dgwt-wcas-options-cb-toggle)").hide(),e&&s("."+a).each(function(){s(this).hasClass("js-dgwt-wcas-adv-settings")&&s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--disabled")||s(this).fadeIn()})},getGroupSelector(t){var e=t.closest(".dgwt-wcas-options-cb-toggle"),a="",i=e.attr("class").split(/\s+/);return s.each(i,function(s,t){-1!==t.indexOf("js-dgwt-wcas-cbtgroup-")&&(a=t)}),a},registerListeners:function(){var t=this;s(document).on("change","."+t.inputSel,function(){t.reloadChoices(s(this))})},refresh:function(){var t=this,e=s("."+t.inputSel);e.length>0&&e.each(function(){var e=s(this).is(":checked"),a=t.getGroupSelector(s(this));e?s("."+a).fadeIn():s("."+a+":not(.dgwt-wcas-options-cb-toggle)").hide()})},init:function(){var t=this,e=s("."+t.inputSel);e.length>0&&(t.registerListeners(),e.each(function(){t.reloadChoices(s(this))}))}},a={layoutSelect:"select[id*='search_layout']",overlayMobile:"input[id*='enable_mobile_overlay']",mobileBreakpoint:"input[id*='mobile_breakpoint']",$select:null,$overlayMobileEl:null,$mobileBreakpointEl:null,setConditions:function(){var t=this.$select.find("option:selected").val(),e=s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--enabled");switch(this.hideOption(this.$overlayMobileEl),this.hideOption(this.$mobileBreakpointEl),t){case"icon":break;case"icon-flexible":e&&this.showOption(this.$mobileBreakpointEl);break;default:e&&(this.showOption(this.$overlayMobileEl),this.$overlayMobileEl.is(":checked")&&this.showOption(this.$mobileBreakpointEl))}},hideOption:function(s){s.closest("tr").hide()},showOption:function(s){s.closest("tr").show()},registerListeners:function(){var s=this;s.$select.on("change",function(){s.setConditions()}),s.$overlayMobileEl.on("change",function(){s.setConditions()})},init:function(){var t=this,e=s(t.layoutSelect);e.length>0&&(t.$select=e,t.$overlayMobileEl=s(t.overlayMobile),t.$mobileBreakpointEl=s(t.mobileBreakpoint),t.registerListeners(),setTimeout(function(){t.setConditions()},400))}},i={actionTriggerClass:"js-ajax-build-index",actionStopTriggerClass:"js-ajax-stop-build-index",indexingWrappoerClass:"js-dgwt-wcas-indexing-wrapper",getWrapper:function(){return s("."+this.indexingWrappoerClass).closest(".dgwt-wcas-settings-info")},registerListeners:function(){var t=this;s(document).on("click","."+t.actionTriggerClass,function(e){e.preventDefault();var a=s(this);a.attr("disabled","disabled"),s(".dgwt-wcas-settings-info").addClass("wcas-ajax-build-index-wait");var i=!!a.hasClass("js-ajax-build-index-emergency");i&&(s(".dgwt-wcas-indexing-header__title").text("[Emergency mode] Wait... Indexing in progress"),s(".dgwt-wcas-indexing-header__troubleshooting, .dgwt-wcas-indexing-header__actions, .js-dgwt-wcas-indexer-details").hide()),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_build_index",emergency:i},success:function(s){void 0!==s&&s.success&&(t.getWrapper().html(s.data.html),t.heartbeat())},complete:function(){a.removeAttr("disabled"),s(".dgwt-wcas-settings-info").removeClass("wcas-ajax-build-index-wait"),i&&window.location.reload()}})}),s(document).on("click","."+t.actionStopTriggerClass,function(e){e.preventDefault();var a=s(this);a.attr("disabled","disabled"),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_stop_build_index"},success:function(s){void 0!==s&&s.success&&(t.getWrapper().html(s.data.html),t.heartbeat())},complete:function(){a.removeAttr("disabled")}})})},heartbeat:function(){var t=this;setTimeout(function(){s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_build_index_heartbeat"},success:function(s){void 0!==s&&s.success&&(t.getWrapper().html(s.data.html),s.data.loop&&t.heartbeat())}})},1e3)},detailsToggle:function(){var t;s(document).on("click",".js-dgwt-wcas-indexing-details-trigger",function(e){e.preventDefault();var a=s(".js-dgwt-wcas-indexer-details");a.hasClass("show")?(a.removeClass("show"),a.addClass("hide"),s(".js-dgwt-wcas-indexing__showd").addClass("show").removeClass("hide"),s(".js-dgwt-wcas-indexing__hided").addClass("hide").removeClass("show"),t=!1):(a.addClass("show"),a.removeClass("hide"),s(".js-dgwt-wcas-indexing__showd").addClass("hide").removeClass("show"),s(".js-dgwt-wcas-indexing__hided").addClass("show").removeClass("hide"),t=!0),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_index_details_toggle",display:t}})})},init:function(){this.registerListeners(),s("."+this.indexingWrappoerClass).length>0&&this.heartbeat(),this.detailsToggle()}},o={init:function(){var t=this;s(".dgwt-wcas-selectize").length>0&&s.ajax({url:ajaxurl,data:{action:"dgwt_wcas_settings_list_custom_fields",_wpnonce:s(".dgwt-wcas-selectize").data("security")},success:function(s){void 0!==s&&void 0!==s.data&&t.initSelectize(s.data)}})},initSelectize:function(t){var e=s(".dgwt-wcas-selectize");e.length>0&&e.each(function(){var e=s(this),a=e.data("options"),i=t;if(a.length>0){a=JSON.parse('["'+decodeURI(a.replace(/&/g,'","').replace(/=/g,'","'))+'"]');var o="";a.forEach(function(s,t){if((t+1)%2==0){var e={value:s,label:o};i.push(e),o=""}o=s})}s(this).selectize({persist:!1,maxItems:null,valueField:"key",labelField:"label",searchField:["value","label"],options:i,create:function(s){return{value:s.key,label:s.label}},load:function(t,a){if(!t.length)return a();s.ajax({url:ajaxurl,data:{action:"dgwt_wcas_settings_list_custom_fields",_wpnonce:e.data("security")},error:function(){a()},success:function(s){a(s.data)}})}})})}},n={init:function(){var t=s(".js-dgwt-wcas-tooltip");t.length>0&&t.each(function(){var t=s(this)[0],e=s(this).data("tooltip-html-el");if(e){new DgwtWcasTooltip(t,{title:s("."+e+" > .dgwt-wcas-tooltip-wrapper")[0],placement:"top",trigger:"hover",html:!0})}})}},c={advClass:"js-dgwt-wcas-adv-settings",highlightClass:"dgwt-wcas-opt-highlight",transClass:"dgwt-wcas-opt-transition",init:function(){this.clickListener(),this.setStartingState()},clickListener:function(){var t=this;s(document).on("click",".js-dgwt-wcas-settings__advanced",function(){var e;e=s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--disabled")?"show":"hide",t.saveChoice(e)})},setStartingState:function(){var t=s("."+this.advClass);t.length>0&&(s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--enabled")?(t.show(),e.refresh()):t.hide())},saveChoice:function(t){s(".js-dgwt-wcas-settings__advanced").append('<span class="dgwt-wcas-adv-settings-saving">saving...</span>'),s.ajax({url:ajaxurl,data:{action:"dgwt_wcas_adv_settings",adv_settings_value:t}}).done(function(t){s(".dgwt-wcas-adv-settings-saving").remove()});var e=s(".js-dgwt-wcas-adv-settings-toggle");"show"===t&&(e.removeClass("woocommerce-input-toggle--disabled"),e.addClass("woocommerce-input-toggle--enabled")),"hide"===t&&(e.removeClass("woocommerce-input-toggle--enabled"),e.addClass("woocommerce-input-toggle--disabled")),this.toggleAdvancedOpt(t)},toggleAdvancedOpt:function(t){var i=this,o=s("."+i.advClass);o.length>0&&(o.addClass(i.highlightClass),o.addClass(i.transClass),"show"===t&&o.fadeIn(500,function(){setTimeout(function(){o.removeClass(i.highlightClass),setTimeout(function(){o.removeClass(i.transClass),e.refresh(),a.setConditions()},500)},500)}),"hide"===t&&setTimeout(function(){o.removeClass(i.transClass),o.fadeOut(500,function(){o.removeClass(i.highlightClass)})},500))}};window.DGWT_WCAS_SEARCH_PREVIEW={previewWrapper:{},searchWrapp:{},suggestionWrapp:{},searchInput:{},init:function(){this.previewWrapper=s(".js-dgwt-wcas-preview"),this.searchWrapp=s(".js-dgwt-wcas-search-wrapp"),this.suggestionWrapp=s(".js-dgwt-wcas-suggestions-wrapp"),this.detailsWrapp=s(".js-dgwt-wcas-details-wrapp"),this.searchInput=s(".js-dgwt-wcas-search-input"),this.onChangeHandler(),this.onColorHandler(),this.onTypeHandler(),this.disableSubmit(),this.noResultsHandler(),this.fixSizesInit()},isChecked:function(s){return!!(s.length>0&&s.is(":checked"))},isColor:function(s){return"string"==typeof s&&7===s.length&&"#"===s.charAt(0)},camelCase:function(s){for(var t=s.split("_"),e="",a=0;a<t.length;a++)e+=t[a].charAt(0).toUpperCase()+t[a].slice(1);return e},disableSubmit:function(){var t,e;s(".js-dgwt-wcas-preview-source").on("click",function(a){a.preventDefault();var i=a.pageX-100,o=a.pageY+10;void 0!==t&&(clearTimeout(t),e&&e.remove()),s("body").append('<div class="dgwt-wcas-click-alert">No interaction! This is only a preview.</div>'),(e=s(".dgwt-wcas-click-alert")).css({left:i,top:o}),s(".dgwt-wcas-preview-source").addClass("dgwt-wcas-preview-source-no-click"),t=setTimeout(function(){e.fadeOut(500,function(){s(this).remove(),s(".dgwt-wcas-preview-source").removeClass("dgwt-wcas-preview-source-no-click")})},2e3)})},noResultsHandler:function(){var t=this,e=".js-dgwt-wcas-preview .dgwt-wcas-suggestion:not(.js-dgwt-wcas-suggestion-nores)",a="input[id*='search_no_results_text']";s(document).on("focus",a,function(){s(e).addClass("dgwt-wcas-hide"),s(".js-dgwt-wcas-suggestion-nores").removeClass("dgwt-wcas-hide"),t.detailsWrapp.addClass("dgwt-wcas-hide"),t.suggestionWrapp.addClass("dgwt-wcas-preview-nores")}),s(document).on("blur",a,function(){s(e).removeClass("dgwt-wcas-hide"),s(".js-dgwt-wcas-suggestion-nores").addClass("dgwt-wcas-hide"),t.detailsWrapp.removeClass("dgwt-wcas-hide"),t.suggestionWrapp.removeClass("dgwt-wcas-preview-nores")})},onChangeHandler:function(){for(var t=this,e=["show_submit_button","max_form_width","show_product_image","show_product_sku","show_product_desc","show_product_price","show_matching_categories","show_matching_tags","show_matching_brands","show_matching_posts","show_matching_pages","show_grouped_results","suggestions_limit","show_details_box"],a=0;a<e.length;a++){var i="input[id*='"+e[a]+"']",o=s(i),n="onChange"+t.camelCase(e[a]);"function"==typeof t[n]&&t[n](o,o.val()),s(document).on("change",i,function(){n=s(this).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),n="onChange"+t.camelCase(n),t[n](s(this),this.value)})}},onColorHandler:function(){for(var t=this,e=["bg_input_color","text_input_color","border_input_color","bg_submit_color","text_submit_color","sug_bg_color","sug_hover_color","sug_text_color","sug_highlight_color","sug_border_color"],a=0;a<e.length;a++){var i="input[id*='"+e[a]+"']",o=s(i),n="onColor"+t.camelCase(e[a]);t[n](o,o.val()),s(document).on("change",i,function(e){n=s(this).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),n="onColor"+t.camelCase(n),t[n](s(this),this.value)})}},onColorChangeHandler:function(s,t){var e=s.attr("id").replace("]","").replace("dgwt_wcas_settings[","");this[e="onColor"+this.camelCase(e)](s,t)},onTypeHandler:function(){for(var t=this,e=["search_submit_text","search_placeholder","search_no_results_text","search_see_all_results_text"],a=0;a<e.length;a++){var i="input[id*='"+e[a]+"']",o=s(i),n="onType"+t.camelCase(e[a]);t[n](o,o.val()),s(document).on("input",i,function(e){n=s(e.target).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),n="onType"+t.camelCase(n),t[n](s(e.target),this.value)})}},onChangeMaxFormWidth:function(t,e){e.length>0&&"0"!=e?(this.searchWrapp.css("max-width",e+"px"),this.suggestionWrapp.css("max-width",e+"px")):(this.searchWrapp.css("max-width","100%"),this.suggestionWrapp.css("max-width","100%")),this.onChangeShowDetailsBox(s("input[id*='show_details_box']"))},onChangeShowSubmitButton:function(t,e){var a=s(".js-dgwt-wcas-search-submit");if(this.isChecked(t)){this.searchWrapp.addClass("dgwt-wcas-has-submit"),this.searchWrapp.removeClass("dgwt-wcas-no-submit"),a.show(),s(".dgwt-wcas-sf-wrapp > .dgwt-wcas-ico-magnifier").hide();var i=s("input[id*='bg_submit_color']"),o=s("input[id*='text_submit_color']");this.onColorBgSubmitColor(i,i.val()),this.onColorTextSubmitColor(o,o.val())}else this.searchWrapp.addClass("dgwt-wcas-no-submit"),this.searchWrapp.removeClass("dgwt-wcas-has-submit"),a.hide(),s(".dgwt-wcas-sf-wrapp > .dgwt-wcas-ico-magnifier").show()},onChangeShowProductImage:function(t,e){var a=s(".js-dgwt-wcas-si"),i=s(".js-dgwt-wcas-content-wrapp");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-img"),s(".dgwt-wcas-suggestion-product > .dgwt-wcas-st").remove(),s(".dgwt-wcas-suggestion-product > .dgwt-wcas-sp").remove(),i.show(),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-img"),i.each(function(){s(this).closest(".dgwt-wcas-suggestion-product").append(s(this).html())}),i.hide(),a.hide())},onChangeShowProductSku:function(t,e){var a=s(".js-dgwt-wcas-sku");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-sku"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-sku"),a.hide())},onChangeShowProductDesc:function(t,e){var a=s(".js-dgwt-wcas-sd");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-desc"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-desc"),a.hide())},onChangeShowProductPrice:function(t,e){var a=s(".js-dgwt-wcas-sp");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-price"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-price"),a.hide())},onChangeShowMatchingCategories:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-cat"),i=s(".dgwt-wcas-suggestion-cat");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingTags:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-tag"),i=s(".dgwt-wcas-suggestion-tag");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingBrands:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-brand"),i=s(".dgwt-wcas-suggestion-brand");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingPosts:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-post"),i=s(".dgwt-wcas-suggestion-post");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingPages:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-page"),i=s(".dgwt-wcas-suggestion-page");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowGroupedResults:function(t,e){var a=s(".dgwt-wcas-st--direct-headline"),i=s(".dgwt-wcas-suggestion-headline");this.isChecked(t)?(a.addClass("dgwt-wcas-hidden"),this.suggestionWrapp.addClass("dgwt-wcas-has-headings"),s(".dgwt-wcas-suggestion-headline").show(),this.isChecked(s("input[id*='show_matching_categories']"))||s(".dgwt-wcas-suggestion-headline-cat").hide(),this.isChecked(s("input[id*='show_matching_tags']"))||s(".dgwt-wcas-suggestion-headline-tag").hide(),this.isChecked(s("input[id*='show_matching_brands']"))||s(".dgwt-wcas-suggestion-headline-brand").hide(),this.isChecked(s("input[id*='show_matching_posts']"))||s(".dgwt-wcas-suggestion-headline-post").hide(),this.isChecked(s("input[id*='show_matching_pages']"))||s(".dgwt-wcas-suggestion-headline-page").hide()):(a.removeClass("dgwt-wcas-hidden"),i.hide(),this.suggestionWrapp.removeClass("dgwt-wcas-has-headings"))},onChangeSuggestionsLimit:function(t,e){setTimeout(function(){var a=0,i=7,o=s(".dgwt-wcas-suggestion-duplicated"),n=["brand","cat","tag","post","page","product"];e.length>0&&"0"!=e&&(i=Math.abs(e)),o.length>0&&o.remove();var c=[];for(a=0;a<n.length;a++){var d=s(".dgwt-wcas-suggestion-"+n[a]+":not(.js-dgwt-wcas-suggestion-hidden)");d.length>0&&c.push(d)}var r=c.length;if(c.length>0)for(var g=i-c.length,l=c.length-1;g>0;){var h=c[l].clone();h.addClass("dgwt-wcas-suggestion-duplicated"),h.removeClass("dgwt-wcas-suggestion-selected"),c[l].after(h),r++,--l<0&&(l=c.length-1),g--}r>i&&t.val(r)},10)},onChangeShowDetailsBox:function(t,e){var a=this;a.isChecked(t)?(a.detailsWrapp.show(),a.searchWrapp.addClass("dgwt-wcas-is-detail-box"),a.previewWrapper.addClass("dgwt-wcas-is-details"),a.previewWrapper.addClass("dgwt-wcas-details-right"),setTimeout(function(){if(s(".dgwt-wcas-suggestion-product:not(.dgwt-wcas-suggestion-duplicated)").addClass("dgwt-wcas-suggestion-selected"),a.searchWrapp.width()>=550){a.previewWrapper.addClass("dgwt-wcas-full-width");var t=getComputedStyle(a.searchWrapp[0]).width;(t=Math.round(parseFloat(t.replace("px",""))))%2==0?(a.suggestionWrapp.css("width",Math.round(t/2)),a.detailsWrapp.css("width",Math.round(t/2))):(a.suggestionWrapp.css("width",Math.floor(t/2)),a.detailsWrapp.css("width",Math.ceil(t/2)))}else a.suggestionWrapp.width(a.searchWrapp.width())},10)):(a.detailsWrapp.hide(),a.searchWrapp.removeClass("dgwt-wcas-is-detail-box"),a.previewWrapper.removeClass("dgwt-wcas-is-details"),a.previewWrapper.removeClass("dgwt-wcas-details-right"),a.previewWrapper.removeClass("dgwt-wcas-full-width"),s(".dgwt-wcas-suggestion-product").removeClass("dgwt-wcas-suggestion-selected"),a.suggestionWrapp.css("width",""),a.detailsWrapp.css("width",""))},onColorBgInputColor:function(s,t){this.isColor(t)?this.searchInput.css("background-color",t):this.searchInput.css("background-color","")},onColorTextInputColor:function(t,e){var a="dgwt-wcas-preview-placeholder-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-search-input::placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input::-webkit-input-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input:-moz-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input::-moz-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input:-ms-input-placeholder{opacity: 0.3; color:"+e+"!important;}",i+="</style>",s("head").append(i),this.searchInput.css("color",e)}else{this.searchInput.css("color","");var o=s("."+a);o.length>0&&o.remove()}},onColorBorderInputColor:function(s,t){this.isColor(t)?this.searchInput.css("border-color",t):this.searchInput.css("border-color","")},onColorBgSubmitColor:function(t,e){if(this.isChecked(s("input[id*='show_submit_button']"))&&this.isColor(e)){var a='<style class="dgwt-wcas-preview-submit-style">';a+=".dgwt-wcas-search-submit::before{border-color: transparent "+e+"!important;}",a+=".dgwt-wcas-search-submit:hover::before{border-right-color: "+e+"!important;}",a+=".dgwt-wcas-search-submit:focus::before{border-right-color: "+e+"!important;}",a+=".dgwt-wcas-search-submit{background-color: "+e+"!important;}",a+=".dgwt-wcas-om-bar .dgwt-wcas-om-return{background-color: "+e+"!important;}",a+="</style>",s("head").append(a)}else{var i=s(".dgwt-wcas-preview-submit-style");i.length>0&&i.remove()}},onColorTextSubmitColor:function(t,e){this.isChecked(s("input[id*='show_submit_button']"))&&this.isColor(e)?(s(".js-dgwt-wcas-search-submit").css("color",e),s(".dgwt-wcas-ico-magnifier").css("fill",e)):(this.searchInput.css("background-color",""),s(".js-dgwt-wcas-search-submit").css("color",""),s(".dgwt-wcas-ico-magnifier").css("fill",""))},onColorSugBgColor:function(t,e){var a="dgwt-wcas-preview-sugbgcol-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp,",i+=".dgwt-wcas-details-wrapp",i+="{background-color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugHoverColor:function(t,e){this.isColor(e)?setTimeout(function(){s(".dgwt-wcas-suggestion-selected").css("background-color",e)},50):s(".dgwt-wcas-suggestion-selected").css("background-color","")},onColorSugTextColor:function(t,e){var a="dgwt-wcas-preview-sugtextcol-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp *,",i+=".dgwt-wcas-details-wrapp *,",i+=".dgwt-wcas-sd,",i+=".dgwt-wcas-suggestion *",i+="{color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugHighlightColor:function(t,e){var a="dgwt-wcas-preview-sughighlight-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-st strong,",i+=".dgwt-wcas-sd strong",i+="{color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugBorderColor:function(t,e){var a="dgwt-wcas-preview-sugborder-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp,",i+=".dgwt-wcas-details-wrapp,",i+=".dgwt-wcas-suggestion,",i+=".dgwt-wcas-datails-title,",i+=".dgwt-wcas-details-more-products",i+="{border-color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onTypeSearchSubmitText:function(t,e){var a=s(".js-dgwt-wcas-search-submit-l"),i=s(".js-dgwt-wcas-search-submit-m");e.length>0?(a.text(e),a.show(),i.hide()):(a.text(""),a.hide(),i.show())},onTypeSearchPlaceholder:function(s,t){0==t.length&&(t=dgwt_wcas.labels.search_placeholder),this.searchInput.attr("placeholder",t)},onTypeSearchNoResultsText:function(t,e){0==e.length&&(e=dgwt_wcas.labels.no_results),s(".js-dgwt-wcas-suggestion-nores span").text(e)},onTypeSearchSeeAllResultsText:function(t,e){0==e.length&&(e=dgwt_wcas.labels.show_more),s(".js-dgwt-wcas-st-more-label").text(e)},fixSizesInit:function(){var t=this;s(document).on("click","#dgwt_wcas_autocomplete-tab",function(){t.onChangeShowDetailsBox(s("input[id*='show_details_box']"))})}},s(document).ready(function(){var d,r;(d=s(".js-dgwt-wcas-settings-margin-nob")).length>0&&d.each(function(){var t=s(this).find("td .dgwt-wcas-fieldset");if(t.length>0){var e=s(this).prev(".js-dgwt-wcas-settings-margin");if(e.length>0){var a=s(this).attr("class").split(/\s+/),i="";s.each(a,function(s,t){-1!==t.indexOf("js-dgwt-wcas-cbtgroup-")&&(i=t)});var o=t.clone(!0,!0);o.addClass("dgwt-wcas-settings-margin-nob"),i&&o.addClass(i),o.appendTo(e.find("td")),s(this).remove()}}}),t.init(),e.init(),a.init(),(r=s(".js-dgwt-wcas-sgs-autocolspan")).length>0&&r.find("td").attr("colspan",2),i.init(),o.init(),n.init(),c.init(),window.DGWT_WCAS_SEARCH_PREVIEW.init()})}(jQuery);
assets/js/search.js CHANGED
@@ -40,30 +40,46 @@
40
  div.setAttribute('unselectable', 'on');
41
  return div;
42
  },
43
- highlight: function (suggestionValue, phrase) {
44
-
45
- if (dgwt_wcas.is_premium) {
46
- var i;
47
- var tokens = phrase.split(/ /);
48
-
49
- if (tokens) {
50
- tokens = tokens.sort(function (a, b) {
51
- return b.length - a.length;
52
- });
53
- for (i = 0; i < tokens.length; i++) {
54
- if (tokens[i] && tokens[i].length > 1) {
55
- var pattern = '(' + utils.escapeRegExChars(tokens[i].trim()) + ')';
56
- suggestionValue = suggestionValue.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
57
- }
58
- }
59
- }
60
- } else {
61
- var pattern = '(' + utils.escapeRegExChars(phrase) + ')';
62
- suggestionValue = suggestionValue.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
63
- }
64
 
65
- return suggestionValue;
66
- },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  debounce: function (func, wait) {
68
  var timeout,
69
  debounceID = new Date().getUTCMilliseconds();
@@ -152,6 +168,7 @@
152
  that.timeoutId = null;
153
  that.cachedResponse = {};
154
  that.cachedDetails = {};
 
155
  that.detailsRequestsSent = [];
156
  that.onChangeTimeout = null;
157
  that.onChange = null;
@@ -160,6 +177,7 @@
160
  that.detailsContainer = null;
161
  that.autoAligmentprocess = null;
162
  that.noSuggestionsContainer = null;
 
163
  that.options = $.extend(true, {}, DgwtWcasAutocompleteSearch.defaults, options);
164
  that.classes = {
165
  selected: 'dgwt-wcas-suggestion-selected',
@@ -197,6 +215,7 @@
197
  showDescription: false,
198
  showSaleBadge: false,
199
  showFeaturedBadge: false,
 
200
  saleBadgeText: 'sale',
201
  featuredBadgeText: 'featured',
202
  minChars: 3,
@@ -219,6 +238,7 @@
219
  searchInputClass: 'dgwt-wcas-search-input',
220
  preloaderClass: 'dgwt-wcas-preloader',
221
  closeTrigger: 'dgwt-wcas-close',
 
222
  tabDisabled: false,
223
  dataType: 'text',
224
  currentRequest: null,
@@ -277,6 +297,7 @@
277
  that.registerEventsSearchBar();
278
  that.registerEventsSuggestions();
279
  that.registerEventsDetailsPanel();
 
280
  that.registerEventsFixedMenu();
281
 
282
  that.fixPositionCapture = function () {
@@ -371,13 +392,40 @@
371
  var that = this;
372
 
373
  // Click close icon
374
- $(document).on('click.autocomplete', '.' + that.options.closeTrigger, function () {
375
- var that = utils.getActiveInstance();
376
- that.hide();
377
- that.clear(false);
378
- $(this).removeClass(that.options.closeTrigger);
379
- $(this).closest('.' + that.options.searchFormClass).find('.' + that.options.searchInputClass).val('').focus();
380
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
 
382
  that.el.on('keydown.autocomplete', function (e) {
383
  that.onKeyPress(e);
@@ -413,16 +461,23 @@
413
  $(document).on('mouseenter.autocomplete', suggestionSelector, function () {
414
  var that = utils.getActiveInstance();
415
 
 
 
 
 
416
  var currentIndex = $(this).data('index');
417
  var selector = '.dgwt-wcas-suggestion[data-index="' + currentIndex + '"]';
418
 
 
 
419
  if (that.selectedIndex != currentIndex) {
420
  utils.mouseHoverDebounce(function () {
421
  if (that.selectedIndex !== currentIndex) {
 
422
  that.getDetails(that.suggestions[currentIndex]);
423
  that.activate(currentIndex);
424
  }
425
- }, selector, 100);
426
 
427
  }
428
  });
@@ -461,6 +516,80 @@
461
  });
462
 
463
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
464
  registerEventsFixedMenu: function () {
465
  var that = this;
466
 
@@ -494,10 +623,6 @@
494
 
495
  var $formWrapper = that.getFormWrapper();
496
 
497
- if ($formWrapper.hasClass('js-dgwt-wcas-icon-mobile')) {
498
- $formWrapper.prepend('<div class="dgwt-wcas-icon-handler">' + dgwt_wcas.magnifier_icon + '</div>');
499
- }
500
-
501
  $formWrapper.prepend('<div class="js-dgwt-wcas-enable-mobile-form dgwt-wcas-enable-mobile-form"></div>');
502
 
503
  var $el = $formWrapper.find('.js-dgwt-wcas-enable-mobile-form');
@@ -509,6 +634,23 @@
509
  }
510
 
511
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  onFocus: function () {
513
  var that = this;
514
  $('.' + this.options.searchFormClass).removeClass('dgwt-wcas-active');
@@ -525,6 +667,10 @@
525
  value = that.el.val(),
526
  query = that.getQuery(value);
527
 
 
 
 
 
528
  // If user clicked on a suggestion, hide() will
529
  // be canceled, otherwise close suggestions
530
  that.blurTimeoutId = setTimeout(function () {
@@ -585,6 +731,7 @@
585
  clearCache: function () {
586
  this.cachedResponse = {};
587
  this.cachedDetails = {};
 
588
  this.badQueries = [];
589
  },
590
  clear: function (cache) {
@@ -891,16 +1038,16 @@
891
  return;
892
  }
893
  break;
894
- case keys.RETURN:
895
- that.hide();
896
- return;
897
- /*if (that.selectedIndex === -1) {
898
- that.hide();
899
- return;
900
- }
901
- that.select(that.selectedIndex);*/
902
- break;
903
- case keys.UP:
904
  that.moveUp();
905
  break;
906
  case keys.DOWN:
@@ -1034,6 +1181,8 @@
1034
  options.params['l'] = dgwt_wcas.current_lang;
1035
  }
1036
 
 
 
1037
  that.preloader('show', 'form', 'dgwt-wcas-inner-preloader');
1038
  searchForm.addClass('dgwt-wcas-processing');
1039
 
@@ -1088,6 +1237,7 @@
1088
  var that = ajaxDebounceState.object,
1089
  ajaxSettings = ajaxDebounceState.ajaxSettings;
1090
 
 
1091
  that.currentRequest = $.ajax(ajaxSettings).done(function (data) {
1092
  var result;
1093
  that.currentRequest = null;
@@ -1113,12 +1263,14 @@
1113
 
1114
  that.options.onSearchComplete.call(that.element, q, result.suggestions);
1115
 
 
1116
 
1117
  }).fail(function (jqXHR, textStatus, errorThrown) {
1118
  that.options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown);
1119
  });
1120
 
1121
- }, options.debounceWaitMs);
 
1122
 
1123
 
1124
  } else {
@@ -1204,8 +1356,12 @@
1204
 
1205
  if (typeof result.items != 'undefined') {
1206
  for (var i = 0; i < result.items.length; i++) {
1207
- var cacheKey = result.items[i]['objectID'];
1208
- that.cachedDetails[cacheKey] = {html: result.items[i]['html']};
 
 
 
 
1209
 
1210
  // Preload images
1211
  if (typeof result.items[i]['imageSrc'] != 'undefined' && result.items[i]['imageSrc'].length > 0) {
@@ -1228,6 +1384,8 @@
1228
  }
1229
  that.fixPositionCapture();
1230
  that.fixHeight();
 
 
1231
  },
1232
  error: function (jqXHR, exception) {
1233
 
@@ -1242,6 +1400,137 @@
1242
 
1243
  $(document).trigger('dgwtWcasDetailsPanelLoaded', that);
1244
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1245
  prepareSuggestionObjectID: function (suggestion) {
1246
  var objectID = '';
1247
 
@@ -1303,6 +1592,7 @@
1303
  return;
1304
  }
1305
 
 
1306
  that.getDetails(suggestions[index]);
1307
  that.activate(index);
1308
  },
@@ -1322,8 +1612,9 @@
1322
 
1323
  return false;
1324
  },
1325
- hide: function () {
1326
  var that = this,
 
1327
  $container = that.getSuggestionsContainer(),
1328
  $containerDetails = that.getDetailsContainer();
1329
 
@@ -1352,8 +1643,53 @@
1352
  that.autoAligmentprocess = null;
1353
  }
1354
 
1355
- that.signalHint(null);
1356
- },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1357
  hideAfterClickOutsideListener: function () {
1358
  var that = this;
1359
  if (!that.isMobileMode()) {
@@ -1666,6 +2002,24 @@
1666
  }
1667
 
1668
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1669
  findBestHint: function () {
1670
  var that = this,
1671
  value = that.el.val().toLowerCase(),
@@ -1720,7 +2074,7 @@
1720
  container = that.getDetailsContainer();
1721
  }
1722
 
1723
- // Disable preloader and check if container exist
1724
 
1725
  if (dgwt_wcas.show_preloader != 1 || container.length == 0) {
1726
  return;
@@ -1832,6 +2186,8 @@
1832
  return;
1833
  }
1834
 
 
 
1835
  if (that.selectedIndex === 0) {
1836
  that.getSuggestionsContainer().children('.' + that.classes.suggestion).first().removeClass(that.classes.selected);
1837
  that.selectedIndex = -1;
@@ -1841,7 +2197,7 @@
1841
  return;
1842
  }
1843
 
1844
- that.adjustScroll(that.selectedIndex - 1);
1845
  },
1846
  moveDown: function () {
1847
  var that = this;
@@ -1850,14 +2206,30 @@
1850
  return;
1851
  }
1852
 
1853
- that.adjustScroll(that.selectedIndex + 1);
 
 
1854
  },
1855
- adjustScroll: function (index) {
1856
- var that = this,
1857
- activeItem = that.activate(index);
 
 
 
 
 
 
 
 
 
 
1858
 
1859
  that.getDetails(that.suggestions[index]);
1860
 
 
 
 
 
1861
 
1862
  if (!activeItem || that.canShowDetailsBox()) {
1863
  return;
@@ -1885,7 +2257,7 @@
1885
  // that event, so that correct suggestion can be selected
1886
  // when clicking on suggestion with a mouse
1887
  that.ignoreValueChange = true;
1888
- that.el.val(that.getValue(that.suggestions[index].value));
1889
  }
1890
  that.signalHint(null);
1891
  },
@@ -1894,10 +2266,11 @@
1894
  onSelectCallback = that.options.onSelect,
1895
  suggestion = that.suggestions[index];
1896
 
1897
- if (typeof suggestion.type != 'undefined' && suggestion.type === 'more_products') {
1898
- that.el.closest('form').trigger('submit');
1899
- return;
1900
- }
 
1901
 
1902
  that.currentValue = that.getValue(suggestion.value);
1903
 
@@ -2015,6 +2388,9 @@
2015
  if ($clonedForm.length > 0) {
2016
  $closeBtn.removeClass('dgwt-wcas-close');
2017
  }
 
 
 
2018
  }, 150);
2019
 
2020
 
@@ -2098,24 +2474,6 @@
2098
 
2099
  (function () {
2100
 
2101
- /*-----------------------------------------------------------------
2102
- /* Positioning search preloader
2103
- /*------------------------------------------------------------------*/
2104
- $(window).on('load', function () {
2105
- if ($('.dgwt-wcas-search-submit').length > 0) {
2106
- $('.dgwt-wcas-search-submit').each(function () {
2107
-
2108
- var $preloader = $(this).closest('.dgwt-wcas-search-wrapp').find('.dgwt-wcas-preloader');
2109
-
2110
- if (dgwt_wcas.is_rtl == 1) {
2111
- $preloader.css('left', (6 + $(this).outerWidth()) + 'px');
2112
- } else {
2113
- $preloader.css('right', $(this).outerWidth() + 'px');
2114
- }
2115
- });
2116
- }
2117
- });
2118
-
2119
  // RUN
2120
  $(document).ready(function () {
2121
  "use strict";
@@ -2145,6 +2503,7 @@
2145
  showSKU: dgwt_wcas.show_sku == 1 ? true : false,
2146
  showSaleBadge: dgwt_wcas.show_sale_badge == 1 ? true : false,
2147
  showFeaturedBadge: dgwt_wcas.show_featured_badge == 1 ? true : false,
 
2148
  saleBadgeText: dgwt_wcas.labels.sale_badge,
2149
  featuredBadgeText: dgwt_wcas.labels.featured_badge,
2150
  isRtl: dgwt_wcas.is_rtl == 1 ? true : false,
40
  div.setAttribute('unselectable', 'on');
41
  return div;
42
  },
43
+ highlight: function (suggestionValue, phrase) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
+ if (dgwt_wcas.is_premium) {
46
+ var i,
47
+ tokens = phrase.split(/ /),
48
+ highlighted = false;
49
+
50
+ if (tokens) {
51
+ tokens = tokens.sort(function (a, b) {
52
+ return b.length - a.length;
53
+ });
54
+
55
+ for (i = 0; i < tokens.length; i++) {
56
+ if (tokens[i] && tokens[i].length > 1) {
57
+
58
+ var token = tokens[i].replace(/[\^\@]/g, '');
59
+
60
+ if (token.length > 0) {
61
+ var pattern = '(' + utils.escapeRegExChars(token.trim()) + ')';
62
+
63
+ suggestionValue = suggestionValue.replace(new RegExp(pattern, 'gi'), '\^\^$1\@\@');
64
+ highlighted = true;
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ if (highlighted) {
71
+ suggestionValue = suggestionValue.replace(/\^\^/g, '<strong>');
72
+ suggestionValue = suggestionValue.replace(/@@/g, '<\/strong>');
73
+ }
74
+
75
+
76
+ } else {
77
+ var pattern = '(' + utils.escapeRegExChars(phrase) + ')';
78
+ suggestionValue = suggestionValue.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
79
+ }
80
+
81
+ return suggestionValue;
82
+ },
83
  debounce: function (func, wait) {
84
  var timeout,
85
  debounceID = new Date().getUTCMilliseconds();
168
  that.timeoutId = null;
169
  that.cachedResponse = {};
170
  that.cachedDetails = {};
171
+ that.cachedPrices = {};
172
  that.detailsRequestsSent = [];
173
  that.onChangeTimeout = null;
174
  that.onChange = null;
177
  that.detailsContainer = null;
178
  that.autoAligmentprocess = null;
179
  that.noSuggestionsContainer = null;
180
+ that.latestActivateSource = '';
181
  that.options = $.extend(true, {}, DgwtWcasAutocompleteSearch.defaults, options);
182
  that.classes = {
183
  selected: 'dgwt-wcas-suggestion-selected',
215
  showDescription: false,
216
  showSaleBadge: false,
217
  showFeaturedBadge: false,
218
+ dynamicPrices: false,
219
  saleBadgeText: 'sale',
220
  featuredBadgeText: 'featured',
221
  minChars: 3,
238
  searchInputClass: 'dgwt-wcas-search-input',
239
  preloaderClass: 'dgwt-wcas-preloader',
240
  closeTrigger: 'dgwt-wcas-close',
241
+ formClass: 'dgwt-wcas-search-form',
242
  tabDisabled: false,
243
  dataType: 'text',
244
  currentRequest: null,
297
  that.registerEventsSearchBar();
298
  that.registerEventsSuggestions();
299
  that.registerEventsDetailsPanel();
300
+ that.registerIconHandler();
301
  that.registerEventsFixedMenu();
302
 
303
  that.fixPositionCapture = function () {
392
  var that = this;
393
 
394
  // Click close icon
395
+ $(document).on('click.autocomplete', '.' + that.options.closeTrigger, function () {
396
+ var that = utils.getActiveInstance();
397
+ that.hide();
398
+ that.clear(false);
399
+ $(this).removeClass(that.options.closeTrigger);
400
+ $(this).closest('.' + that.options.searchFormClass).find('.' + that.options.searchInputClass).val('').focus();
401
+ });
402
+
403
+ // Extra tasks on submit
404
+ that.el.closest('.' + that.options.formClass).on('submit.autocomplete', function (e) {
405
+
406
+ // If variation suggestion exist, click it instead submit search results page
407
+ if (that.suggestions.length > 0) {
408
+
409
+ $.each(that.suggestions, function (i, suggestion) {
410
+
411
+ if (
412
+ typeof suggestion.type != 'undefined'
413
+ && suggestion.type == 'product_variation'
414
+ ) {
415
+ that.select(i);
416
+ e.preventDefault();
417
+ return false;
418
+ }
419
+ });
420
+
421
+ }
422
+ });
423
+
424
+ // Position preloader
425
+ $(window).on('load', function () {
426
+ that.positionPreloader();
427
+ });
428
+
429
 
430
  that.el.on('keydown.autocomplete', function (e) {
431
  that.onKeyPress(e);
461
  $(document).on('mouseenter.autocomplete', suggestionSelector, function () {
462
  var that = utils.getActiveInstance();
463
 
464
+ if(typeof that == 'undefined'){
465
+ return;
466
+ }
467
+
468
  var currentIndex = $(this).data('index');
469
  var selector = '.dgwt-wcas-suggestion[data-index="' + currentIndex + '"]';
470
 
471
+ var timeOffset = that.canShowDetailsBox() ? 100 : 1;
472
+
473
  if (that.selectedIndex != currentIndex) {
474
  utils.mouseHoverDebounce(function () {
475
  if (that.selectedIndex !== currentIndex) {
476
+ that.latestActivateSource = 'mouse';
477
  that.getDetails(that.suggestions[currentIndex]);
478
  that.activate(currentIndex);
479
  }
480
+ }, selector, timeOffset);
481
 
482
  }
483
  });
516
  });
517
 
518
  },
519
+ registerIconHandler: function () {
520
+ var that = this,
521
+ $formWrapper = that.getFormWrapper();
522
+ var $form = $formWrapper.find('.' + that.options.formClass);
523
+
524
+ $formWrapper.on('click', '.js-dgwt-wcas-search-icon-handler', function (e) {
525
+
526
+ var $input = $formWrapper.find('.' + that.options.searchInputClass);
527
+
528
+ if ($formWrapper.hasClass('dgwt-wcas-layout-icon-open')) {
529
+
530
+ that.hide();
531
+ $form.hide(true);
532
+
533
+ $formWrapper.removeClass('dgwt-wcas-layout-icon-open');
534
+
535
+
536
+ } else {
537
+ var $arrow = $formWrapper.find('.dgwt-wcas-search-icon-arrow');
538
+ $form.hide();
539
+ $arrow.hide();
540
+ $formWrapper.addClass('dgwt-wcas-layout-icon-open');
541
+ that.positionIconSearchMode($formWrapper);
542
+
543
+ $form.fadeIn(200, function () {
544
+ $arrow.show();
545
+ that.positionPreloader($formWrapper);
546
+ $input.focus();
547
+ });
548
+
549
+ }
550
+
551
+
552
+ });
553
+
554
+ if ($('.js-dgwt-wcas-initialized').length == 0 && $('.js-dgwt-wcas-search-icon-handler').length > 0) {
555
+
556
+ $(document).click(function (event) {
557
+
558
+ if ($('.dgwt-wcas-layout-icon-open').length) {
559
+
560
+ var $target = $(event.target);
561
+
562
+ if (!($target.closest('.' + that.options.searchFormClass).length > 0
563
+ || $target.closest('.' + that.options.containerClass).length > 0
564
+ || $target.closest('.' + that.options.containerDetailsClass).length > 0
565
+ )) {
566
+ var activeInstance = utils.getActiveInstance();
567
+
568
+ if (typeof activeInstance != 'undefined') {
569
+ var $formWrapper = activeInstance.getFormWrapper();
570
+ var $form = $formWrapper.find('.' + that.options.formClass);
571
+
572
+ $form.hide();
573
+ activeInstance.hide(true);
574
+ $form.css({'left': '0'});
575
+ }
576
+
577
+ that.hideIconModeSearch();
578
+ }
579
+
580
+ }
581
+ });
582
+ }
583
+
584
+ $(window).on('resize.autocomplete', function () {
585
+ that.applyFlexibleMode();
586
+ });
587
+
588
+ $(window).on('load', function () {
589
+ that.applyFlexibleMode();
590
+ });
591
+
592
+ },
593
  registerEventsFixedMenu: function () {
594
  var that = this;
595
 
623
 
624
  var $formWrapper = that.getFormWrapper();
625
 
 
 
 
 
626
  $formWrapper.prepend('<div class="js-dgwt-wcas-enable-mobile-form dgwt-wcas-enable-mobile-form"></div>');
627
 
628
  var $el = $formWrapper.find('.js-dgwt-wcas-enable-mobile-form');
634
  }
635
 
636
  },
637
+ applyFlexibleMode: function () {
638
+ var that = this;
639
+ var $flexibleSearch = $('.js-dgwt-wcas-layout-icon-flexible');
640
+
641
+ if ($flexibleSearch.length) {
642
+
643
+ if (that.isMobileMode()) {
644
+ $flexibleSearch.addClass('js-dgwt-wcas-layout-icon');
645
+ $flexibleSearch.addClass('dgwt-wcas-layout-icon');
646
+ } else {
647
+ $flexibleSearch.removeClass('js-dgwt-wcas-layout-icon');
648
+ $flexibleSearch.removeClass('dgwt-wcas-layout-icon');
649
+ }
650
+
651
+ $flexibleSearch.addClass('dgwt-wcas-layout-icon-flexible-loaded');
652
+ }
653
+ },
654
  onFocus: function () {
655
  var that = this;
656
  $('.' + this.options.searchFormClass).removeClass('dgwt-wcas-active');
667
  value = that.el.val(),
668
  query = that.getQuery(value);
669
 
670
+ if(that.isMobileMode()){
671
+ return;
672
+ }
673
+
674
  // If user clicked on a suggestion, hide() will
675
  // be canceled, otherwise close suggestions
676
  that.blurTimeoutId = setTimeout(function () {
731
  clearCache: function () {
732
  this.cachedResponse = {};
733
  this.cachedDetails = {};
734
+ this.cachedPrices = {};
735
  this.badQueries = [];
736
  },
737
  clear: function (cache) {
1038
  return;
1039
  }
1040
  break;
1041
+ case keys.RETURN:
1042
+
1043
+ if (that.selectedIndex === -1) {
1044
+ that.hide();
1045
+ return;
1046
+ }
1047
+
1048
+ that.select(that.selectedIndex);
1049
+ break;
1050
+ case keys.UP:
1051
  that.moveUp();
1052
  break;
1053
  case keys.DOWN:
1181
  options.params['l'] = dgwt_wcas.current_lang;
1182
  }
1183
 
1184
+ options.params = that.applyCustomParams(options.params);
1185
+
1186
  that.preloader('show', 'form', 'dgwt-wcas-inner-preloader');
1187
  searchForm.addClass('dgwt-wcas-processing');
1188
 
1237
  var that = ajaxDebounceState.object,
1238
  ajaxSettings = ajaxDebounceState.ajaxSettings;
1239
 
1240
+
1241
  that.currentRequest = $.ajax(ajaxSettings).done(function (data) {
1242
  var result;
1243
  that.currentRequest = null;
1263
 
1264
  that.options.onSearchComplete.call(that.element, q, result.suggestions);
1265
 
1266
+ that.updatePrices();
1267
 
1268
  }).fail(function (jqXHR, textStatus, errorThrown) {
1269
  that.options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown);
1270
  });
1271
 
1272
+
1273
+ }, options.debounceWaitMs);
1274
 
1275
 
1276
  } else {
1356
 
1357
  if (typeof result.items != 'undefined') {
1358
  for (var i = 0; i < result.items.length; i++) {
1359
+ var cacheKey = result.items[i]['objectID'];
1360
+ that.cachedDetails[cacheKey] = {html: result.items[i]['html']}
1361
+
1362
+ if (typeof result.items[i]['price'] != 'undefined' && result.items[i]['price'].length > 0) {
1363
+ that.cachedPrices[cacheKey] = result.items[i]['price'];
1364
+ }
1365
 
1366
  // Preload images
1367
  if (typeof result.items[i]['imageSrc'] != 'undefined' && result.items[i]['imageSrc'].length > 0) {
1384
  }
1385
  that.fixPositionCapture();
1386
  that.fixHeight();
1387
+
1388
+ that.updatePrices(true);
1389
  },
1390
  error: function (jqXHR, exception) {
1391
 
1400
 
1401
  $(document).trigger('dgwtWcasDetailsPanelLoaded', that);
1402
  },
1403
+ updatePrices: function (noAjax) {
1404
+ var that = this,
1405
+ i, j,
1406
+ productsToLoad = [];
1407
+
1408
+ if (!(that.options.showPrice && that.options.dynamicPrices)) {
1409
+ return;
1410
+ }
1411
+
1412
+ if (that.suggestions.length == 0) {
1413
+ return;
1414
+ }
1415
+
1416
+ for (i = 0; i < that.suggestions.length; i++) {
1417
+
1418
+ if (
1419
+ typeof that.suggestions[i].type != 'undefined'
1420
+ && (that.suggestions[i].type == 'product' || that.suggestions[i].type == 'product_variation')
1421
+ ) {
1422
+ var key = 'product__' + that.suggestions[i].post_id;
1423
+
1424
+ if (typeof that.cachedPrices[key] != 'undefined') {
1425
+
1426
+ that.updatePrice(i, that.cachedPrices[key]);
1427
+
1428
+ } else {
1429
+
1430
+ that.applyPreloaderForPrice(i);
1431
+
1432
+ productsToLoad.push(that.suggestions[i].post_id);
1433
+ }
1434
+ }
1435
+
1436
+ }
1437
+
1438
+
1439
+ if (!noAjax && productsToLoad.length > 0) {
1440
+
1441
+ var data = {
1442
+ action: typeof dgwt_wcas.action_get_prices == 'undefined' ? 'dgwt_wcas_get_prices' : dgwt_wcas.action_get_prices,
1443
+ items: productsToLoad
1444
+ };
1445
+
1446
+ $.ajax({
1447
+ data: data,
1448
+ type: 'post',
1449
+ url: dgwt_wcas.ajax_prices_endpoint,
1450
+ success: function (response) {
1451
+
1452
+ if (typeof response.success != 'undefined' && response.success && response.data.length > 0) {
1453
+ for (i = 0; i < response.data.length; i++) {
1454
+
1455
+ var postID = response.data[i].id,
1456
+ price = response.data[i].price;
1457
+
1458
+ if (that.suggestions.length > 0) {
1459
+ for (j = 0; j < that.suggestions.length; j++) {
1460
+ if (
1461
+ typeof that.suggestions[j].type != 'undefined'
1462
+ && (that.suggestions[j].type == 'product' || that.suggestions[j].type == 'product_variation')
1463
+ && that.suggestions[j].post_id == postID
1464
+ ) {
1465
+
1466
+ var key = 'product__' + postID;
1467
+
1468
+ that.cachedPrices[key] = price;
1469
+
1470
+ that.updatePrice(j, price);
1471
+
1472
+ }
1473
+ }
1474
+ }
1475
+ }
1476
+ }
1477
+
1478
+ },
1479
+ error: function (jqXHR, exception) {
1480
+
1481
+ },
1482
+ });
1483
+
1484
+ }
1485
+
1486
+ },
1487
+ updatePrice: function (index, price) {
1488
+ var that = this;
1489
+
1490
+ if(typeof that.suggestions[index] != 'undefined'){
1491
+
1492
+ that.suggestions[index].price = price;
1493
+
1494
+ var $price = $('.dgwt-wcas-suggestions-wrapp').find('[data-index="' + index + '"] .dgwt-wcas-sp');
1495
+
1496
+ if($price.length){
1497
+ $price.html(price);
1498
+ }
1499
+ }
1500
+
1501
+ },
1502
+ applyCustomParams: function(params){
1503
+ var that = this;
1504
+
1505
+ // Custom params (global)
1506
+ if (typeof dgwt_wcas.custom_params == 'object') {
1507
+ var cp = dgwt_wcas.custom_params;
1508
+ for (var property in cp) {
1509
+ params[property] = cp[property];
1510
+ }
1511
+ }
1512
+
1513
+ // Custom params (local)
1514
+ var inputCustomParams = that.el.data('custom-params');
1515
+
1516
+ if(typeof inputCustomParams === 'object'){
1517
+ for (var property in inputCustomParams) {
1518
+ params[property] = inputCustomParams[property];
1519
+ }
1520
+ }
1521
+
1522
+ return params;
1523
+ },
1524
+ applyPreloaderForPrice: function(index){
1525
+ var that = this;
1526
+
1527
+ if(typeof that.suggestions[index] != 'undefined'){
1528
+ var $price = $('.dgwt-wcas-suggestions-wrapp').find('[data-index="' + index + '"] .dgwt-wcas-sp');
1529
+ if($price.length){
1530
+ $price.html('<div class="dgwt-wcas-preloader-price"><div class="dgwt-wcas-preloader-price-inner"> <div></div><div></div><div></div></div></div>');
1531
+ }
1532
+ }
1533
+ },
1534
  prepareSuggestionObjectID: function (suggestion) {
1535
  var objectID = '';
1536
 
1592
  return;
1593
  }
1594
 
1595
+ that.latestActivateSource = 'system';
1596
  that.getDetails(suggestions[index]);
1597
  that.activate(index);
1598
  },
1612
 
1613
  return false;
1614
  },
1615
+ hide: function (clear) {
1616
  var that = this,
1617
+ $formWrapper = that.getFormWrapper(),
1618
  $container = that.getSuggestionsContainer(),
1619
  $containerDetails = that.getDetailsContainer();
1620
 
1643
  that.autoAligmentprocess = null;
1644
  }
1645
 
1646
+ if (typeof clear == 'boolean' && clear) {
1647
+
1648
+ $formWrapper.find('.' + that.options.searchInputClass).val('');
1649
+ var $close = $formWrapper.find('.' + that.options.closeTrigger);
1650
+ if ($close.length) {
1651
+ $close.removeClass(that.options.closeTrigger);
1652
+ }
1653
+
1654
+ that.currentValue = '';
1655
+ that.suggestions = [];
1656
+
1657
+ }
1658
+
1659
+ that.signalHint(null);
1660
+ },
1661
+ positionIconSearchMode: function ($formWrapper) {
1662
+ var that = this,
1663
+ side = 'right',
1664
+ formLeftValue = -20;
1665
+
1666
+ var $form = $formWrapper.find('.' + that.options.formClass);
1667
+ var formWidth = $form.width(),
1668
+ windowWidth = $(window).width();
1669
+
1670
+ var iconLeftOffset = $formWrapper[0].getBoundingClientRect().left;
1671
+ var formLeftOffset = $form[0].getBoundingClientRect().left;
1672
+
1673
+ // Is the icon on left or right side of screen?
1674
+ if (iconLeftOffset + 10 < windowWidth / 2) {
1675
+ side = 'left';
1676
+ }
1677
+
1678
+ var iconLeftRatio = (iconLeftOffset + 10) / windowWidth;
1679
+
1680
+ formLeftValue = Math.floor(-1 * (formWidth * iconLeftRatio));
1681
+
1682
+ $form.css({'left': formLeftValue + 'px'});
1683
+
1684
+ },
1685
+ hideIconModeSearch: function () {
1686
+
1687
+ var $openedElements = $('.dgwt-wcas-layout-icon-open');
1688
+
1689
+ if ($openedElements.length > 0) {
1690
+ $openedElements.removeClass('dgwt-wcas-layout-icon-open');
1691
+ }
1692
+ },
1693
  hideAfterClickOutsideListener: function () {
1694
  var that = this;
1695
  if (!that.isMobileMode()) {
2002
  }
2003
 
2004
  },
2005
+ positionPreloader: function ($formWrapper) {
2006
+
2007
+ var $submit = typeof $formWrapper == 'object' ? $formWrapper.find('.dgwt-wcas-search-submit') : $('.dgwt-wcas-search-submit');
2008
+
2009
+ if ($submit.length > 0) {
2010
+ $submit.each(function () {
2011
+
2012
+ var $preloader = $(this).closest('.dgwt-wcas-search-wrapp').find('.dgwt-wcas-preloader');
2013
+
2014
+ if (dgwt_wcas.is_rtl == 1) {
2015
+ $preloader.css('left', (6 + $(this).outerWidth()) + 'px');
2016
+ } else {
2017
+ $preloader.css('right', $(this).outerWidth() + 'px');
2018
+ }
2019
+ });
2020
+ }
2021
+
2022
+ },
2023
  findBestHint: function () {
2024
  var that = this,
2025
  value = that.el.val().toLowerCase(),
2074
  container = that.getDetailsContainer();
2075
  }
2076
 
2077
+ // Disable preloader and check if container exist
2078
 
2079
  if (dgwt_wcas.show_preloader != 1 || container.length == 0) {
2080
  return;
2186
  return;
2187
  }
2188
 
2189
+ that.latestActivateSource = 'key';
2190
+
2191
  if (that.selectedIndex === 0) {
2192
  that.getSuggestionsContainer().children('.' + that.classes.suggestion).first().removeClass(that.classes.selected);
2193
  that.selectedIndex = -1;
2197
  return;
2198
  }
2199
 
2200
+ that.adjustScroll(that.selectedIndex - 1, 'up');
2201
  },
2202
  moveDown: function () {
2203
  var that = this;
2206
  return;
2207
  }
2208
 
2209
+ that.latestActivateSource = 'key';
2210
+
2211
+ that.adjustScroll(that.selectedIndex + 1, 'down');
2212
  },
2213
+ adjustScroll: function (index, direction) {
2214
+ var that = this;
2215
+
2216
+
2217
+ if(that.suggestions[index].type === 'headline'){
2218
+ index = direction === 'down' ? index + 1 : index - 1;
2219
+ }
2220
+
2221
+ if(typeof that.suggestions[index] == 'undefined'){
2222
+ return;
2223
+ }
2224
+
2225
+ var activeItem = that.activate(index);
2226
 
2227
  that.getDetails(that.suggestions[index]);
2228
 
2229
+ if(that.suggestions[index].type === 'more_products'){
2230
+
2231
+ return;
2232
+ }
2233
 
2234
  if (!activeItem || that.canShowDetailsBox()) {
2235
  return;
2257
  // that event, so that correct suggestion can be selected
2258
  // when clicking on suggestion with a mouse
2259
  that.ignoreValueChange = true;
2260
+ //that.el.val(that.getValue(that.suggestions[index].value));
2261
  }
2262
  that.signalHint(null);
2263
  },
2266
  onSelectCallback = that.options.onSelect,
2267
  suggestion = that.suggestions[index];
2268
 
2269
+ if ((typeof suggestion.type != 'undefined' && suggestion.type === 'more_products')
2270
+ || that.latestActivateSource != 'key') {
2271
+ that.el.closest('form').trigger('submit');
2272
+ return;
2273
+ }
2274
 
2275
  that.currentValue = that.getValue(suggestion.value);
2276
 
2388
  if ($clonedForm.length > 0) {
2389
  $closeBtn.removeClass('dgwt-wcas-close');
2390
  }
2391
+
2392
+ that.hide();
2393
+
2394
  }, 150);
2395
 
2396
 
2474
 
2475
  (function () {
2476
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2477
  // RUN
2478
  $(document).ready(function () {
2479
  "use strict";
2503
  showSKU: dgwt_wcas.show_sku == 1 ? true : false,
2504
  showSaleBadge: dgwt_wcas.show_sale_badge == 1 ? true : false,
2505
  showFeaturedBadge: dgwt_wcas.show_featured_badge == 1 ? true : false,
2506
+ dynamicPrices: typeof dgwt_wcas.dynamic_prices != 'undefined' && dgwt_wcas.dynamic_prices ? true : false,
2507
  saleBadgeText: dgwt_wcas.labels.sale_badge,
2508
  featuredBadgeText: dgwt_wcas.labels.featured_badge,
2509
  isRtl: dgwt_wcas.is_rtl == 1 ? true : false,
assets/js/search.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"function"==typeof require?t(require("jquery")):t(jQuery)}(function(t){"use strict";var e={escapeRegExChars:function(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(t){var e=document.createElement("div");return e.className=t,e.style.position="absolute",e.style.display="none",e.setAttribute("unselectable","on"),e},highlight:function(t,s){if(dgwt_wcas.is_premium){var i,a=s.split(/ /);if(a)for(a=a.sort(function(t,e){return e.length-t.length}),i=0;i<a.length;i++)if(a[i]&&a[i].length>1){var o="("+e.escapeRegExChars(a[i].trim())+")";t=t.replace(new RegExp(o,"gi"),"<strong>$1</strong>")}}else o="("+e.escapeRegExChars(s)+")",t=t.replace(new RegExp(o,"gi"),"<strong>$1</strong>");return t},debounce:function(t,e){var i,a=(new Date).getUTCMilliseconds();if(0===s.id.length)return s.id=a,void t();s.id=a,i=setTimeout(function(){a===s.id?(t(),s.id=""):clearTimeout(i)},e)},mouseHoverDebounce:function(e,s,i){var a;a=setTimeout(function(){t(s+":hover").length>0?e():clearTimeout(a)},i)},getActiveInstance:function(){var e,s=t(".dgwt-wcas-search-wrapp.dgwt-wcas-active");return s.length>0&&s.each(function(){var s=t(this).find(".dgwt-wcas-search-input");if("object"==typeof s.data("autocomplete"))return e=s.data("autocomplete"),!1}),e}},s={id:"",callback:null,ajaxSettings:null,object:null},i=27,a=9,o=13,n=38,r=39,l=40,c=t.noop;function d(e,s){this.element=e,this.el=t(e),this.suggestions=[],this.badQueries=[],this.selectedIndex=-1,this.currentValue=this.element.value,this.timeoutId=null,this.cachedResponse={},this.cachedDetails={},this.detailsRequestsSent=[],this.onChangeTimeout=null,this.onChange=null,this.isLocal=!1,this.suggestionsContainer=null,this.detailsContainer=null,this.autoAligmentprocess=null,this.noSuggestionsContainer=null,this.options=t.extend(!0,{},d.defaults,s),this.classes={selected:"dgwt-wcas-suggestion-selected",suggestion:"dgwt-wcas-suggestion",suggestionsContainerOrientTop:"dgwt-wcas-suggestions-wrapp--top"},this.hint=null,this.hintValue="",this.selection=null,this.overlayMobileState="off",this.initialize(),this.setOptions(s)}d.utils=e,t.DgwtWcasAutocompleteSearch=d,d.defaults={ajaxSettings:{},autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",containerDetailsWidth:"auto",showDetailsPanel:!1,showImage:!1,showPrice:!1,showSKU:!1,showDescription:!1,showSaleBadge:!1,showFeaturedBadge:!1,saleBadgeText:"sale",featuredBadgeText:"featured",minChars:3,maxHeight:600,deferRequestBy:0,params:{},formatResult:function(t,s,i){if(!s)return t;i&&(t=e.highlight(t,s));return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/&lt;sup/g,"<sup").replace(/&lt;\/sup/g,"</sup").replace(/sup&gt;/g,"sup>").replace(/&lt;(\/?strong)&gt;/g,"<$1>")},delimiter:null,zIndex:999999999,type:"GET",noCache:!1,isRtl:!1,onSearchStart:c,onSearchComplete:c,onSearchError:c,preserveInput:!1,searchFormClass:"dgwt-wcas-search-wrapp",containerClass:"dgwt-wcas-suggestions-wrapp",containerDetailsClass:"dgwt-wcas-details-wrapp",searchInputClass:"dgwt-wcas-search-input",preloaderClass:"dgwt-wcas-preloader",closeTrigger:"dgwt-wcas-close",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,isPremium:!1,overlayMobile:!1,preventBadQueries:!0,lookupFilter:function(t,e,s){return-1!==t.value.toLowerCase().indexOf(s)},paramName:"query",transformResult:function(e){return"string"==typeof e?t.parseJSON(e):e},noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1,positionFixed:!1,debounceWaitMs:400,sendGAEvents:!0},d.prototype={initialize:function(){var e=this;e.element.setAttribute("autocomplete","off"),e.createContainers(),e.registerEventsSearchBar(),e.registerEventsSuggestions(),e.registerEventsDetailsPanel(),e.registerEventsFixedMenu(),e.fixPositionCapture=function(){e.adjustContainerWidth(),e.visible&&e.fixPosition()},t(window).on("resize.autocomplete",e.fixPositionCapture),e.initMobileMode(),e.hideAfterClickOutsideListener(),e.suggestionsContainer.addClass("js-dgwt-wcas-initialized"),e.detailsContainer&&e.detailsContainer.length>0&&e.detailsContainer.addClass("js-dgwt-wcas-initialized")},createContainers:function(e){var s=this.options;0==t("."+s.containerClass).length?(this.suggestionsContainer=t(d.utils.createNode(s.containerClass)),this.suggestionsContainer.appendTo(s.appendTo||"body"),this.suggestionsContainer.addClass("woocommerce"),!0===s.showImage&&this.suggestionsContainer.addClass("dgwt-wcas-has-img"),!0===s.showPrice&&this.suggestionsContainer.addClass("dgwt-wcas-has-price"),!0===s.showDescription&&this.suggestionsContainer.addClass("dgwt-wcas-has-desc"),!0===s.showSKU&&this.suggestionsContainer.addClass("dgwt-wcas-has-sku"),!0===s.showHeadings&&this.suggestionsContainer.addClass("dgwt-wcas-has-headings"),"auto"!==s.width&&this.suggestionsContainer.width(s.width)):this.suggestionsContainer=t("."+this.options.containerClass),this.canShowDetailsBox()&&(0==t("."+s.containerDetailsClass).length?(this.detailsContainer=t(d.utils.createNode(s.containerDetailsClass)),this.detailsContainer.appendTo(s.appendTo||"body"),this.detailsContainer.addClass("woocommerce")):this.detailsContainer=t("."+s.containerDetailsClass))},registerEventsSearchBar:function(){var s=this;t(document).on("click.autocomplete","."+s.options.closeTrigger,function(){var s=e.getActiveInstance();s.hide(),s.clear(!1),t(this).removeClass(s.options.closeTrigger),t(this).closest("."+s.options.searchFormClass).find("."+s.options.searchInputClass).val("").focus()}),s.el.on("keydown.autocomplete",function(t){s.onKeyPress(t)}),s.el.on("keyup.autocomplete",function(t){s.onKeyUp(t)}),s.el.on("blur.autocomplete",function(){s.onBlur()}),s.el.on("focus.autocomplete",function(){s.onFocus()}),s.el.on("change.autocomplete",function(t){s.onKeyUp(t)}),s.el.on("input.autocomplete",function(t){s.onKeyUp(t)})},registerEventsSuggestions:function(){var s="."+this.classes.suggestion;this.getSuggestionsContainer().hasClass("js-dgwt-wcas-initialized")||(t(document).on("mouseenter.autocomplete",s,function(){var s=e.getActiveInstance(),i=t(this).data("index"),a='.dgwt-wcas-suggestion[data-index="'+i+'"]';s.selectedIndex!=i&&e.mouseHoverDebounce(function(){s.selectedIndex!==i&&(s.getDetails(s.suggestions[i]),s.activate(i))},a,100)}),t(document).on("click.autocomplete",s,function(){e.getActiveInstance().select(t(this).data("index"))}),t(document).on("click.autocomplete","."+this.options.containerClass,function(){var t=e.getActiveInstance();clearTimeout(t.blurTimeoutId)}))},registerEventsDetailsPanel:function(){var s=this.getDetailsContainer();this.canShowDetailsBox()&&!s.hasClass("js-dgwt-wcas-initialized")&&(t(document).on("click.autocomplete","."+this.options.containerDetailsClass,function(){var t=e.getActiveInstance();clearTimeout(t.blurTimeoutId)}),t(document).on("change",'[name="js-dgwt-wcas-quantity"]',function(e){t(this).closest(".js-dgwt-wcas-pd-addtc").find("[data-quantity]").attr("data-quantity",t(this).val())}))},registerEventsFixedMenu:function(){var e=this;t(window).on("scroll",function(){if(e.suggestions.length>0&&e.elementOrParentIsFixed(e.getFormWrapper()))if(0===t(window).scrollTop()){[1,10,20,30,40,50,60,70,80,90,120,140,170,200,250,400,700,1e3,2e3].forEach(function(t){setTimeout(function(){e.fixHeight(),e.fixPositionCapture()},t)})}else e.fixHeight(),e.fixPositionCapture()})},initMobileMode:function(){var t=this;if(t.options.overlayMobile&&t.isMobileMode()){var e=t.getFormWrapper();e.hasClass("js-dgwt-wcas-icon-mobile")&&e.prepend('<div class="dgwt-wcas-icon-handler">'+dgwt_wcas.magnifier_icon+"</div>"),e.prepend('<div class="js-dgwt-wcas-enable-mobile-form dgwt-wcas-enable-mobile-form"></div>'),e.find(".js-dgwt-wcas-enable-mobile-form").on("click",function(e){t.enableOverlayMobile()})}},onFocus:function(){t("."+this.options.searchFormClass).removeClass("dgwt-wcas-active"),this.getFormWrapper().addClass("dgwt-wcas-active"),this.fixPositionCapture(),this.el.val().length>=this.options.minChars&&this.onValueChange()},onBlur:function(){var e=this,s=e.options,i=e.el.val(),a=e.getQuery(i);e.blurTimeoutId=setTimeout(function(){e.hide(),e.selection&&e.currentValue!==a&&(s.onInvalidateSelection||t.noop).call(e.element)},200)},abortAjax:function(){this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null)},setOptions:function(e){var s=this,i=s.getSuggestionsContainer(),a=t.extend({},s.options,e);(s.isLocal=Array.isArray(a.lookup),s.isLocal&&(a.lookup=s.verifySuggestionsFormat(a.lookup)),a.orientation=s.validateOrientation(a.orientation,"bottom"),i.css({"max-height":s.canShowDetailsBox()?"none":a.maxHeight+"px",width:a.width+"px","z-index":a.zIndex}),!0===a.showDetailsPanel)&&s.getDetailsContainer().css({"z-index":a.zIndex-1});a.onSearchComplete=function(){s.getFormWrapper().removeClass("dgwt-wcas-processing"),s.preloader("hide","form","dgwt-wcas-inner-preloader"),s.preloader("show","form",a.closeTrigger)},this.options=a},clearCache:function(){this.cachedResponse={},this.cachedDetails={},this.badQueries=[]},clear:function(t){t&&this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){this.disabled=!0,clearTimeout(this.onChangeTimeout),this.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var t=this.getFormOffset();this.getSuggestionsContainer().css(t),this.canShowDetailsBox()&&this.fixPositionDetailsBox()},fixPositionDetailsBox:function(){var e=this.getFormWrapper(),s=this.getSuggestionsContainer(),i=this.getDetailsContainer(),a=this.getFormOffset(),o=a.left;if(0==i.length)return!1;var n=!0===this.options.isRtl?1:2,r=Math.round(a.left);if(a.left=r+Math.round(s.width()+n),i.css(a),e.width()>=550)return t("body").removeClass("dgwt-wcas-details-outside"),t("body").removeClass("dgwt-wcas-details-right"),t("body").removeClass("dgwt-wcas-details-left"),void(!0===this.options.isRtl&&(s.css("left",r+Math.round(i.width()+n)+"px"),i.css("left",o+"px")));var l=t(window).width(),c=i.width(),d=i.offset();t("body").addClass("dgwt-wcas-details-outside"),!0===this.options.isRtl&&(a.left=a.left+1);var g=!1,u=!1;l<d.left+c&&(g=!0,t("body").removeClass("dgwt-wcas-details-right"),t("body").addClass("dgwt-wcas-details-left"),i.css("left",Math.round(parseFloat(s.css("left").replace("px","")))-i.outerWidth()+"px")),(d=i.offset()).left<1&&(u=!0,t("body").removeClass("dgwt-wcas-details-left"),t("body").addClass("dgwt-wcas-details-right")),u&&g?(t("body").removeClass("dgwt-wcas-details-left"),t("body").removeClass("dgwt-wcas-details-right"),t("body").addClass("dgwt-wcas-details-notfit")):t("body").removeClass("dgwt-wcas-details-notfit")},fixHeight:function(){if(1!=this.options.showDetailsPanel)return!1;var t=this.getSuggestionsContainer(),e=this.getDetailsContainer();t.css("height","auto"),e.css("height","auto");var s=t.outerHeight(),i=e.outerHeight();return t.find(".dgwt-wcas-suggestion:last-child").removeClass("dgwt-wcas-suggestion-no-border-bottom"),!(s<=340&&i<=340)&&(t.find(".dgwt-wcas-suggestion:last-child").addClass("dgwt-wcas-suggestion-no-border-bottom"),i<s&&e.css("height",s+"px"),s<i&&t.css("height",i+"px"),!1)},automaticAlignment:function(){var t=this,e=t.getFormWrapper().find(".dgwt-wcas-search-input"),s=t.getSuggestionsContainer(),i=t.getDetailsContainer();if(null==t.autoAligmentprocess){var a=[e.width(),s.height()];t.options.showDetailsPanel&&(a[2]=i.height()),t.autoAligmentprocess=setInterval(function(){var o=[e.width(),s.height()];t.options.showDetailsPanel&&(o[2]=i.height());for(var n=0;n<a.length;n++)if(a[n]!=o[n]){t.fixHeight(),t.fixPositionCapture(),a=o;break}t.options.showDetailsPanel&&(i.find(".dgwt-wcas-details-inner").height()-i.height()>2&&t.fixHeight())},10)}},getFormOffset:function(){var e=this.getFormWrapper(),s=this.getSuggestionsContainer(),i=this.options.orientation,a=e.outerHeight(),o=this.el.outerHeight(),n=this.el.offset(),r={top:n.top,left:n.left};if("auto"===i){var l=t(window).height(),c=t(window).scrollTop(),d=-c+n.top-a,g=c+l-(n.top+o+a);i=Math.max(d,g)===d?"top":"bottom"}if("top"===i){s[0].getBoundingClientRect().top;var u=e[0].getBoundingClientRect().top;s.css("height","auto"),u<s.height()&&s.height(u-10),r.top+=-s.outerHeight()}else r.top+=o;return r},getFormWrapper:function(){return this.el.closest("."+this.options.searchFormClass)},getSuggestionsContainer:function(){return t("."+this.options.containerClass)},getDetailsContainer:function(){return t("."+this.options.containerDetailsClass)},scrollDownSuggestions:function(){var t=this.getSuggestionsContainer();t[0].scrollTop=t[0].scrollHeight},isCursorAtEnd:function(){var t,e=this.el.val().length,s=this.element.selectionStart;return"number"==typeof s?s===e:!document.selection||((t=document.selection.createRange()).moveStart("character",-e),e===t.text.length)},onKeyPress:function(t){if(this.disabled||this.visible||t.which!==l||!this.currentValue){if(!this.disabled&&this.visible){switch(t.which){case i:this.el.val(this.currentValue),this.hide();break;case r:if(this.hint&&this.options.onHint&&this.isCursorAtEnd()){this.selectHint();break}return;case a:if(this.hint&&this.options.onHint)return void this.selectHint();if(-1===this.selectedIndex)return void this.hide();if(this.select(this.selectedIndex),!1===this.options.tabDisabled)return;break;case o:return void this.hide();case n:this.moveUp();break;case l:this.moveDown();break;default:return}t.stopImmediatePropagation(),t.preventDefault()}}else this.suggest()},onKeyUp:function(t){var e=this;if(!e.disabled){switch(t.which){case n:case l:return}clearTimeout(e.onChangeTimeout),e.currentValue!==e.el.val()&&(e.findBestHint(),e.options.deferRequestBy>0?e.onChangeTimeout=setTimeout(function(){e.onValueChange()},e.options.deferRequestBy):e.onValueChange())}},onValueChange:function(){if(this.ignoreValueChange)this.ignoreValueChange=!1;else{var e=this.options,s=this.el.val(),i=this.getQuery(s);this.selection&&this.currentValue!==i&&(this.selection=null,(e.onInvalidateSelection||t.noop).call(this.element)),clearTimeout(this.onChangeTimeout),this.currentValue=s,this.selectedIndex=-1,e.triggerSelectOnValidInput&&this.isExactMatch(i)?this.select(0):i.length<e.minChars?(t("."+this.options.closeTrigger).removeClass(this.options.closeTrigger),this.hide()):this.getSuggestions(i)}},isExactMatch:function(t){var e=this.suggestions;return 1===e.length&&e[0].value.toLowerCase()===t.toLowerCase()},canShowDetailsBox:function(){return 1==this.options.showDetailsPanel&&!this.isMobileMode()},isMobileMode:function(){return t(window).width()<this.options.mobileBreakpoint},getQuery:function(e){var s,i=this.options.delimiter;return i?(s=e.split(i),t.trim(s[s.length-1])):e},getSuggestionsLocal:function(e){var s,i=this.options,a=e.toLowerCase(),o=i.lookupFilter,n=parseInt(i.lookupLimit,10);return s={suggestions:t.grep(i.lookup,function(t){return o(t,e,a)})},n&&s.suggestions.length>n&&(s.suggestions=s.suggestions.slice(0,n)),s},getSuggestions:function(i){var a,o,n,r,l=this,c=l.options,d=c.serviceUrl,g=l.getFormWrapper();c.params[c.paramName]=i,void 0!==dgwt_wcas.current_lang&&(c.params.l=dgwt_wcas.current_lang),l.preloader("show","form","dgwt-wcas-inner-preloader"),g.addClass("dgwt-wcas-processing"),!1!==c.onSearchStart.call(l.element,c.params)&&(o=c.ignoreParams?null:c.params,t.isFunction(c.lookup)?c.lookup(i,function(t){l.suggestions=t.suggestions,l.suggest(),l.selectFirstSuggestion(t.suggestions),c.onSearchComplete.call(l.element,i,t.suggestions)}):(l.isLocal?a=l.getSuggestionsLocal(i):(t.isFunction(d)&&(d=d.call(l.element,i)),n=d+"?"+t.param(o||{}),a=l.cachedResponse[n]),a&&Array.isArray(a.suggestions)?(l.suggestions=a.suggestions,l.suggest(),l.selectFirstSuggestion(a.suggestions),c.onSearchComplete.call(l.element,i,a.suggestions)):l.isBadQuery(i)?c.onSearchComplete.call(l.element,i,[]):(l.abortAjax(),r={url:d,data:o,type:c.type,dataType:c.dataType},t.extend(r,c.ajaxSettings),s.object=l,s.ajaxSettings=r,e.debounce(function(){var e=s.object,a=s.ajaxSettings;e.currentRequest=t.ajax(a).done(function(t){var s;e.currentRequest=null,void 0!==(s=e.options.transformResult(t,i)).suggestions&&(e.processResponse(s,i,n),e.selectFirstSuggestion(s.suggestions),1===s.suggestions.length&&void 0!==s.suggestions[0].type&&"no-results"===s.suggestions[0].type?e.gaEvent(i,"Autocomplete Search without results"):e.gaEvent(i,"Autocomplete Search with results")),e.fixPositionCapture(),e.options.onSearchComplete.call(e.element,i,s.suggestions)}).fail(function(t,s,a){e.options.onSearchError.call(e.element,i,t,s,a)})},c.debounceWaitMs))))},getDetails:function(e){var s=this;if(!s.canShowDetailsBox())return!1;if(null!=e&&void 0!==e.type&&("string"!=typeof e.more_products||"more_products"!==e.more_products)){s.fixHeight();var i,a=s.getDetailsContainer(),o=s.prepareSuggestionObjectID(e);if(null!=(i=s.cachedDetails[o]))a.html(i.html),s.fixHeight(),s.fixPositionCapture();else{var n={action:dgwt_wcas.action_result_details,items:[]};if(t.each(s.suggestions,function(t,e){if(void 0!==e.type&&"more_products"!=e.type&&"headline"!=e.type){var i={objectID:s.prepareSuggestionObjectID(e),value:null!=e.value?e.value:""};n.items.push(i)}}),a.html(""),s.preloader("show","details","",!0),-1!=t.inArray(o,s.detailsRequestsSent))return;s.detailsRequestsSent.push(o),t.ajax({data:n,type:"post",url:dgwt_wcas.ajax_details_endpoint,success:function(t){var e="string"==typeof t?jQuery.parseJSON(t):t;if(void 0!==e.items)for(var i=0;i<e.items.length;i++){var o=e.items[i].objectID;if(s.cachedDetails[o]={html:e.items[i].html},void 0!==e.items[i].imageSrc&&e.items[i].imageSrc.length>0)(new Image).src=e.items[i].imageSrc}s.preloader("hide","details","",!0);var n=s.prepareSuggestionObjectID(s.suggestions[s.selectedIndex]);null!=s.cachedDetails[n]?a.html(s.cachedDetails[n].html):a.html(""),s.fixPositionCapture(),s.fixHeight()},error:function(t,e){s.preloader("hide","details","",!0),a.html(t),s.fixPositionCapture(),s.fixHeight()}})}t(document).trigger("dgwtWcasDetailsPanelLoaded",s)}},prepareSuggestionObjectID:function(t){var e="";return void 0!==t&&void 0!==t.type&&(null!=t.post_id&&(e=t.type+"__"+t.post_id,"product_variation"===t.type&&(e+="__"+t.variation_id),void 0!==t.post_type&&(e=t.type+"__"+t.post_id+"__"+t.post_type)),null!=t.term_id&&null!=t.taxonomy&&(e=t.type+"__"+t.term_id+"__"+t.taxonomy)),e},selectFirstSuggestion:function(e){var s=0,i=!1;this.canShowDetailsBox()&&("undefined"!=e&&e.length>0&&t.each(this.suggestions,function(t,e){if(void 0!==e.type&&"more_products"!=e.type&&"headline"!=e.type&&"no-results"!=e.type)return s=t,!1;void 0!==e.type&&"no-results"!==e.type||(i=!0)}),i||(this.getDetails(e[s]),this.activate(s)))},isBadQuery:function(t){if(!this.options.preventBadQueries)return!1;for(var e=this.badQueries,s=e.length;s--;)if(0===t.indexOf(e[s]))return!0;return!1},hide:function(){var e=this.getSuggestionsContainer(),s=this.getDetailsContainer();t.isFunction(this.options.onHide)&&this.visible&&this.options.onHide.call(this.element,container),this.visible=!1,this.selectedIndex=-1,clearTimeout(this.onChangeTimeout),e.hide(),e.removeClass(this.classes.suggestionsContainerOrientTop),s.hide(),t("body").removeClass("dgwt-wcas-open"),t("body").removeClass("dgwt-wcas-block-scroll"),t("body").removeClass("dgwt-wcas-is-details"),t("body").removeClass("dgwt-wcas-full-width"),t("body").removeClass("dgwt-wcas-nores"),t("body").removeClass("dgwt-wcas-details-outside"),t("body").removeClass("dgwt-wcas-details-right"),t("body").removeClass("dgwt-wcas-details-left"),null!=this.autoAligmentprocess&&(clearInterval(this.autoAligmentprocess),this.autoAligmentprocess=null),this.signalHint(null)},hideAfterClickOutsideListener:function(){var e=this;e.isMobileMode()||t(document).mouseup(function(s){if(e.visible){e.getSuggestionsContainer(),e.getDetailsContainer();var i=!(t(s.target).closest("."+e.options.searchFormClass).length>0||t(s.target).hasClass(e.options.searchFormClass)),a=!(t(s.target).closest("."+e.options.containerClass).length>0||t(s.target).hasClass(e.options.containerClass));if(e.canShowDetailsBox()){var o=!(t(s.target).closest("."+e.options.containerDetailsClass).length>0||t(s.target).hasClass(e.options.containerDetailsClass));i&&a&&o&&e.hide()}else i&&a&&e.hide()}})},suggest:function(){if(this.suggestions.length){var e,s=this,i=s.options,a=i.groupBy,o=i.formatResult,n=s.getQuery(s.currentValue),r=s.classes.suggestion,l=s.classes.selected,c=s.getSuggestionsContainer(),d=s.getDetailsContainer(),g=t(s.noSuggestionsContainer),u=i.beforeRender,h="";i.triggerSelectOnValidInput&&s.isExactMatch(n)?s.select(0):(t("body").removeClass("dgwt-wcas-nores"),t.each(s.suggestions,function(s,l){var c="",g=!1;if(a&&(h+=function(t,s){var i=t.data[a];return e===i?"":'<div class="autocomplete-group"><strong>'+(e=i)+"</strong></div>"}(l,0)),void 0===l.type||"product"!=l.type&&"product_variation"!=l.type){var u=r,w="dgwt-wcas-st",p="",m="",f="",v=!0;"product_cat"===l.taxonomy?(u+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-cat",i.showHeadings||(p+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.category+"</span>"),void 0!==l.breadcrumbs&&l.breadcrumbs&&(f=l.breadcrumbs+" &gt; "+l.value,m+='<span class="dgwt-wcas-st-breadcrumbs">'+dgwt_wcas.labels.in+" "+l.breadcrumbs+"</span>")):"product_tag"===l.taxonomy?(u+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-tag",i.showHeadings||(p+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.tag+"</span>")):i.isPremium&&l.taxonomy===i.taxonomyBrands?(u+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-brand",i.showHeadings||(p+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.brand+"</span>")):i.isPremium&&"post"===l.type?(u+=" dgwt-wcas-suggestion-pt dgwt-wcas-suggestion-tp-post",i.showHeadings||(p+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.post+"</span>")):i.isPremium&&"page"===l.type?(u+=" dgwt-wcas-suggestion-pt dgwt-wcas-suggestion-pt-page",i.showHeadings||(p+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.page+"</span>")):"more_products"===l.type?(u+=" js-dgwt-wcas-suggestion-more dgwt-wcas-suggestion-more",w="dgwt-wcas-st-more",l.value=dgwt_wcas.labels.show_more+" ("+l.total+")",v=!1):i.showHeadings&&"headline"===l.type?(u+=" js-dgwt-wcas-suggestion-headline dgwt-wcas-suggestion-headline",void 0!==dgwt_wcas.labels[l.value+"_plu"]&&(l.value=dgwt_wcas.labels[l.value+"_plu"]),v=!1):(u+=" dgwt-wcas-suggestion-nores",l.value=dgwt_wcas.labels.no_results,v=!1,!0===i.showDetailsPanel&&d.html(""),t("body").addClass("dgwt-wcas-nores")),f=f.length>0?' title="'+f+'"':"",h+='<div class="'+u+'" data-index="'+s+'">',h+="<span"+f+' class="'+w+'">'+p+o(l.value,n,v)+m+"</span>",h+="</div>"}else!0===i.showImage&&void 0!==l.thumb_html&&(g=!0),c+=void 0!==l.post_id?'data-post-id="'+l.post_id+'" ':"",c+=void 0!==l.taxonomy?'data-taxonomy="'+l.taxonomy+'" ':"",c+=void 0!==l.term_id?'data-term-id="'+l.term_id+'" ':"",h+='<div class="'+r+' dgwt-wcas-suggestion-product" data-index="'+s+'" '+c+">",g&&(h+='<span class="dgwt-wcas-si">'+l.thumb_html+"</span>"),h+=g?'<div class="dgwt-wcas-content-wrapp">':"",h+='<span class="dgwt-wcas-st">',h+='<span class="dgwt-wcas-st-title">'+o(l.value,n,!0)+"</span>",!0===i.showSKU&&void 0!==l.sku&&l.sku.length>0&&(h+='<span class="dgwt-wcas-sku">('+dgwt_wcas.labels.sku_label+" "+o(l.sku,n,!0)+")</span>"),!0===i.showDescription&&void 0!==l.desc&&l.desc&&(h+='<span class="dgwt-wcas-sd">'+o(l.desc,n,!0)+"</span>"),h+="</span>",!0===i.showPrice&&void 0!==l.price&&(h+='<span class="dgwt-wcas-sp">'+l.price+"</span>"),!0===i.showFeaturedBadge&&!0===l.on_sale&&(h+='<span class="dgwt-wcas-badge dgwt-wcas-badge-os">'+i.saleBadgeText+"</span>"),!0===i.showFeaturedBadge&&!0===l.featured&&(h+='<span class="dgwt-wcas-badge dgwt-wcas-badge-f">'+i.featuredBadgeText+"</span>"),h+=g?"</div>":"",h+="</div>"}),this.adjustContainerWidth(),g.detach(),c.html(h),t.isFunction(u)&&u.call(s.element,c,s.suggestions),c.show(),t("body").addClass("dgwt-wcas-open"),s.automaticAlignment(),!0===i.showDetailsPanel&&(t("body").addClass("dgwt-wcas-is-details"),d.show(),s.fixHeight()),i.autoSelectFirst&&(s.selectedIndex=0,c.scrollTop(0),c.children("."+r).first().addClass(l)),s.visible=!0,s.fixPositionCapture(),"top"===s.options.orientation&&(s.getSuggestionsContainer().addClass(s.classes.suggestionsContainerOrientTop),t("body").addClass("dgwt-wcas-block-scroll"),setTimeout(function(){s.scrollDownSuggestions()},300)),s.findBestHint())}else this.hide()},adjustContainerWidth:function(){var e,s=this.options,i=t("body"),a=this.getFormWrapper(),o=this.getSuggestionsContainer(),n=this.getDetailsContainer(),r=this.getFormOffset();if(a.length){var l=getComputedStyle(a[0]).width;if(l=Math.round(parseFloat(l.replace("px",""))),"auto"===s.width&&(e=this.el.outerWidth(),o.css("width",e+"px")),this.canShowDetailsBox()){if(a.width()>=550)return i.addClass("dgwt-wcas-full-width"),l%2==0?(o.css("width",Math.round(l/2)),n.css("width",Math.round(l/2))):(o.css("width",Math.floor(l/2)),n.css("width",Math.ceil(l/2))),i.removeClass("dgwt-wcas-details-left"),i.removeClass("dgwt-wcas-details-right"),void(!0===s.isRtl?n.css("left","0"):o.css("left",l/2+r.left+"px"));i.addClass("dgwt-wcas-details-right")}}},findBestHint:function(){var e=this.el.val().toLowerCase(),s=null;e&&(t.each(this.suggestions,function(t,i){var a=0===i.value.toLowerCase().indexOf(e);return a&&(s=i),!a}),this.signalHint(s))},signalHint:function(e){var s="";e&&(s=this.currentValue+e.value.substr(this.currentValue.length)),this.hintValue!==s&&(this.hintValue=s,this.hint=e,(this.options.onHint||t.noop)(s))},preloader:function(e,s,i,a){var o,n,r="dgwt-wcas-preloader-wrapp",l=null==i?r:r+" "+i;if("form"===s?n=this.getFormWrapper().find(".dgwt-wcas-preloader"):"details"===s&&(n=this.getDetailsContainer()),1==dgwt_wcas.show_preloader&&0!=n.length)if(!0===a)if("hide"!==e){if("show"===e){var c=this.options.isRtl?"-rtl":"";o='<div class="'+l+'"><img class="dgwt-wcas-placeholder-preloader" src="'+dgwt_wcas.img_url+"placeholder"+c+'.png" /></div>',n.html(o)}}else t(r).remove();else"hide"===e?n.removeClass(i):n.addClass(i)},verifySuggestionsFormat:function(e){return e.length&&"string"==typeof e[0]?t.map(e,function(t){return{value:t,data:null}}):e},validateOrientation:function(e,s){return e=t.trim(e||"").toLowerCase(),-1===t.inArray(e,["auto","bottom","top"])&&(e=s),e},processResponse:function(t,e,s){var i=this.options;t.suggestions=this.verifySuggestionsFormat(t.suggestions),i.noCache||(this.cachedResponse[s]=t,i.preventBadQueries&&!t.suggestions.length&&this.badQueries.push(e)),e===this.getQuery(this.currentValue)&&("top"===this.options.orientation&&t.suggestions.reverse(),this.suggestions=t.suggestions,this.suggest())},activate:function(e){var s,i=this.classes.selected,a=this.getSuggestionsContainer(),o=a.find("."+this.classes.suggestion);return a.find("."+i).removeClass(i),this.selectedIndex=e,-1!==this.selectedIndex&&o.length>this.selectedIndex?(s=o.get(this.selectedIndex),t(s).addClass(i),s):null},selectHint:function(){var e=t.inArray(this.hint,this.suggestions);this.select(e)},select:function(t){this.hide(),this.onSelect(t)},moveUp:function(){if(-1!==this.selectedIndex)return 0===this.selectedIndex?(this.getSuggestionsContainer().children("."+this.classes.suggestion).first().removeClass(this.classes.selected),this.selectedIndex=-1,this.ignoreValueChange=!1,this.el.val(this.currentValue),void this.findBestHint()):void this.adjustScroll(this.selectedIndex-1)},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(e){var s=this.activate(e);if(this.getDetails(this.suggestions[e]),s&&!this.canShowDetailsBox()){var i,a,o,n=this.getSuggestionsContainer(),r=t(s).outerHeight();i=s.offsetTop,o=(a=n.scrollTop())+this.options.maxHeight-r,i<a?n.scrollTop(i):i>o&&n.scrollTop(i-this.options.maxHeight+r),this.options.preserveInput||(this.ignoreValueChange=!0,this.el.val(this.getValue(this.suggestions[e].value))),this.signalHint(null)}},onSelect:function(e){var s=this.options.onSelect,i=this.suggestions[e];void 0===i.type||"more_products"!==i.type?(this.currentValue=this.getValue(i.value),this.currentValue===this.el.val()||this.options.preserveInput||this.el.val(this.currentValue),i.url.length>0&&(window.location.href=i.url),this.signalHint(null),this.suggestions=[],this.selection=i,t.isFunction(s)&&s.call(this.element,i)):this.el.closest("form").trigger("submit")},getValue:function(t){var e,s,i=this.options.delimiter;return i?1===(s=(e=this.currentValue).split(i)).length?t:e.substr(0,e.length-s[s.length-1].length)+t:t},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete"),t(window).off("resize.autocomplete",this.fixPositionCapture),t("."+this.options.containerClass).remove(),t("."+this.options.containerDetailsClass).remove()},enableOverlayMobile:function(){var e=this;if("on"!==e.overlayMobileState){e.overlayMobileState="on";var s,i=e.getFormWrapper(),a=e.getSuggestionsContainer();t("html").addClass("dgwt-wcas-overlay-mobile-on"),'<div class="js-dgwt-wcas-overlay-mobile dgwt-wcas-overlay-mobile">','<div class="dgwt-wcas-om-bar js-dgwt-wcas-om-bar">','<span class="dgwt-wcas-om-return js-dgwt-wcas-om-return">','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" color="#FFF">','<path fill="#FFF" d="M14 6.125H3.351l4.891-4.891L7 0 0 7l7 7 1.234-1.234L3.35 7.875H14z" fill-rule="evenodd"></path>',"</svg>","</span>","</div>","</div>",t(e.options.mobileOverlayWrapper).append('<div class="js-dgwt-wcas-overlay-mobile dgwt-wcas-overlay-mobile"><div class="dgwt-wcas-om-bar js-dgwt-wcas-om-bar"><span class="dgwt-wcas-om-return js-dgwt-wcas-om-return"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" color="#FFF"><path fill="#FFF" d="M14 6.125H3.351l4.891-4.891L7 0 0 7l7 7 1.234-1.234L3.35 7.875H14z" fill-rule="evenodd"></path></svg></span></div></div>'),(s=t(".js-dgwt-wcas-overlay-mobile")).css("zIndex",999999),i.after('<span class="js-dgwt-wcas-om-hook"></span>'),i.appendTo(".js-dgwt-wcas-om-bar"),a.appendTo(".js-dgwt-wcas-om-bar"),i.addClass("dgwt-wcas-search-wrapp-mobile"),i.hasClass("dgwt-wcas-has-submit")&&(i.addClass("dgwt-wcas-has-submit-off"),i.removeClass("dgwt-wcas-has-submit")),i.find("."+e.options.searchInputClass).focus(),t(document).on("click",".js-dgwt-wcas-om-return",function(t){e.disableOverlayMobile(s)})}},disableOverlayMobile:function(e){var s=this,i=s.getSuggestionsContainer(),a=t(".js-dgwt-wcas-om-bar").find("."+s.options.searchFormClass);a.hasClass("dgwt-wcas-has-submit-off")&&(a.removeClass("dgwt-wcas-has-submit-off"),a.addClass("dgwt-wcas-has-submit")),a.removeClass("dgwt-wcas-search-wrapp-mobile"),t("html").removeClass("dgwt-wcas-overlay-mobile-on"),i.appendTo("body"),i.removeAttr("body-scroll-lock-ignore"),t(".js-dgwt-wcas-om-hook").after(a),t(".js-dgwt-wcas-overlay-mobile").remove(),t(".js-dgwt-wcas-om-hook").remove(),setTimeout(function(){a.find("."+s.options.searchInputClass).val("");var t=a.find(".dgwt-wcas-close");a.length>0&&t.removeClass("dgwt-wcas-close")},150),s.overlayMobileState="off"},elementOrParentIsFixed:function(e){var s=e.add(e.parents()),i=!1;return s.each(function(){if("fixed"===t(this).css("position"))return i=!0,!1}),i},gaEvent:function(t,e){if(this.options.sendGAEvents)try{if("undefined"!=typeof gtag)return void gtag("event","autocomplete_search",{event_label:t,event_category:e});"undefined"!=typeof ga&&ga("send",{hitType:"event",eventCategory:e,eventAction:"autocomplete_search",eventLabel:t})}catch(t){}}},t.fn.dgwtWcasAutocomplete=function(e,s){return arguments.length?this.each(function(){var i=t(this),a=i.data("autocomplete");"string"==typeof e?a&&"function"==typeof a[e]&&a[e](s):(a&&a.dispose&&a.dispose(),a=new d(this,e),i.data("autocomplete",a))}):this.first().data("autocomplete")},t.fn.autocomplete||(t.fn.autocomplete=t.fn.dgwtWcasAutocomplete),function(){function e(){var e=t(".dgwt-wcas-search-input"),s=[];e.length>1&&e.each(function(){var e=t(this).attr("id");if(-1==t.inArray(e,s))s.push(e);else{var i=Math.random().toString(36).substring(2,6);i="dgwt-wcas-search-input-"+i,t(this).attr("id",i),t(this).closest("form").find("label").attr("for",i)}})}function s(){var e=t(".dgwt-wcas-search-input");e.length>0&&e.each(function(){"object"!=typeof t(this).data("autocomplete")&&t(this).dgwtWcasAutocomplete(window.dgwt_wcas.config)})}t(window).on("load",function(){t(".dgwt-wcas-search-submit").length>0&&t(".dgwt-wcas-search-submit").each(function(){var e=t(this).closest(".dgwt-wcas-search-wrapp").find(".dgwt-wcas-preloader");1==dgwt_wcas.is_rtl?e.css("left",6+t(this).outerWidth()+"px"):e.css("right",t(this).outerWidth()+"px")})}),t(document).ready(function(){var e=1==dgwt_wcas.show_details_box,s=dgwt_wcas.mobile_breakpoint;(jQuery(window).width()<s||"ontouchend"in document)&&(e=!1),window.dgwt_wcas.config={minChars:dgwt_wcas.min_chars,width:dgwt_wcas.sug_width,autoSelectFirst:!1,triggerSelectOnValidInput:!1,serviceUrl:dgwt_wcas.ajax_search_endpoint,paramName:"s",showDetailsPanel:e,showImage:1==dgwt_wcas.show_images,showPrice:1==dgwt_wcas.show_price,showDescription:1==dgwt_wcas.show_desc,showSKU:1==dgwt_wcas.show_sku,showSaleBadge:1==dgwt_wcas.show_sale_badge,showFeaturedBadge:1==dgwt_wcas.show_featured_badge,saleBadgeText:dgwt_wcas.labels.sale_badge,featuredBadgeText:dgwt_wcas.labels.featured_badge,isRtl:1==dgwt_wcas.is_rtl,showHeadings:1==dgwt_wcas.show_headings,isPremium:1==dgwt_wcas.is_premium,taxonomyBrands:dgwt_wcas.taxonomy_brands,overlayMobile:1==dgwt_wcas.overlay_mobile,mobileBreakpoint:s,mobileOverlayWrapper:dgwt_wcas.mobile_overlay_wrapper,debounceWaitMs:dgwt_wcas.debounce_wait_ms,sendGAEvents:dgwt_wcas.send_ga_events},t(".dgwt-wcas-search-input").dgwtWcasAutocomplete(window.dgwt_wcas.config)}),t(document).ready(function(){setTimeout(function(){e(),s()},500)}),t(window).on("load",function(){setTimeout(function(){e(),s()},500),void 0!==window.elementorFrontend&&void 0!==window.elementorFrontend.documentsManager&&void 0!==window.elementorFrontend.documentsManager.documents&&t.each(elementorFrontend.documentsManager.documents,function(t,e){void 0!==e.getModal&&e.getModal&&e.getModal().on("show",function(){setTimeout(function(){s()},300)})})})}()});
1
+ !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"function"==typeof require?t(require("jquery")):t(jQuery)}(function(t){"use strict";var e={escapeRegExChars:function(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(t){var e=document.createElement("div");return e.className=t,e.style.position="absolute",e.style.display="none",e.setAttribute("unselectable","on"),e},highlight:function(t,s){if(dgwt_wcas.is_premium){var i,o=s.split(/ /),a=!1;if(o)for(o=o.sort(function(t,e){return e.length-t.length}),i=0;i<o.length;i++)if(o[i]&&o[i].length>1){var n=o[i].replace(/[\^\@]/g,"");if(n.length>0){var r="("+e.escapeRegExChars(n.trim())+")";t=t.replace(new RegExp(r,"gi"),"^^$1@@"),a=!0}}a&&(t=(t=t.replace(/\^\^/g,"<strong>")).replace(/@@/g,"</strong>"))}else r="("+e.escapeRegExChars(s)+")",t=t.replace(new RegExp(r,"gi"),"<strong>$1</strong>");return t},debounce:function(t,e){var i,o=(new Date).getUTCMilliseconds();if(0===s.id.length)return s.id=o,void t();s.id=o,i=setTimeout(function(){o===s.id?(t(),s.id=""):clearTimeout(i)},e)},mouseHoverDebounce:function(e,s,i){var o;o=setTimeout(function(){t(s+":hover").length>0?e():clearTimeout(o)},i)},getActiveInstance:function(){var e,s=t(".dgwt-wcas-search-wrapp.dgwt-wcas-active");return s.length>0&&s.each(function(){var s=t(this).find(".dgwt-wcas-search-input");if("object"==typeof s.data("autocomplete"))return e=s.data("autocomplete"),!1}),e}},s={id:"",callback:null,ajaxSettings:null,object:null},i=27,o=9,a=13,n=38,r=39,l=40,c=t.noop;function d(e,s){this.element=e,this.el=t(e),this.suggestions=[],this.badQueries=[],this.selectedIndex=-1,this.currentValue=this.element.value,this.timeoutId=null,this.cachedResponse={},this.cachedDetails={},this.cachedPrices={},this.detailsRequestsSent=[],this.onChangeTimeout=null,this.onChange=null,this.isLocal=!1,this.suggestionsContainer=null,this.detailsContainer=null,this.autoAligmentprocess=null,this.noSuggestionsContainer=null,this.latestActivateSource="",this.options=t.extend(!0,{},d.defaults,s),this.classes={selected:"dgwt-wcas-suggestion-selected",suggestion:"dgwt-wcas-suggestion",suggestionsContainerOrientTop:"dgwt-wcas-suggestions-wrapp--top"},this.hint=null,this.hintValue="",this.selection=null,this.overlayMobileState="off",this.initialize(),this.setOptions(s)}d.utils=e,t.DgwtWcasAutocompleteSearch=d,d.defaults={ajaxSettings:{},autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",containerDetailsWidth:"auto",showDetailsPanel:!1,showImage:!1,showPrice:!1,showSKU:!1,showDescription:!1,showSaleBadge:!1,showFeaturedBadge:!1,dynamicPrices:!1,saleBadgeText:"sale",featuredBadgeText:"featured",minChars:3,maxHeight:600,deferRequestBy:0,params:{},formatResult:function(t,s,i){if(!s)return t;i&&(t=e.highlight(t,s));return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/&lt;sup/g,"<sup").replace(/&lt;\/sup/g,"</sup").replace(/sup&gt;/g,"sup>").replace(/&lt;(\/?strong)&gt;/g,"<$1>")},delimiter:null,zIndex:999999999,type:"GET",noCache:!1,isRtl:!1,onSearchStart:c,onSearchComplete:c,onSearchError:c,preserveInput:!1,searchFormClass:"dgwt-wcas-search-wrapp",containerClass:"dgwt-wcas-suggestions-wrapp",containerDetailsClass:"dgwt-wcas-details-wrapp",searchInputClass:"dgwt-wcas-search-input",preloaderClass:"dgwt-wcas-preloader",closeTrigger:"dgwt-wcas-close",formClass:"dgwt-wcas-search-form",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,isPremium:!1,overlayMobile:!1,preventBadQueries:!0,lookupFilter:function(t,e,s){return-1!==t.value.toLowerCase().indexOf(s)},paramName:"query",transformResult:function(e){return"string"==typeof e?t.parseJSON(e):e},noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1,positionFixed:!1,debounceWaitMs:400,sendGAEvents:!0},d.prototype={initialize:function(){var e=this;e.element.setAttribute("autocomplete","off"),e.createContainers(),e.registerEventsSearchBar(),e.registerEventsSuggestions(),e.registerEventsDetailsPanel(),e.registerIconHandler(),e.registerEventsFixedMenu(),e.fixPositionCapture=function(){e.adjustContainerWidth(),e.visible&&e.fixPosition()},t(window).on("resize.autocomplete",e.fixPositionCapture),e.initMobileMode(),e.hideAfterClickOutsideListener(),e.suggestionsContainer.addClass("js-dgwt-wcas-initialized"),e.detailsContainer&&e.detailsContainer.length>0&&e.detailsContainer.addClass("js-dgwt-wcas-initialized")},createContainers:function(e){var s=this.options;0==t("."+s.containerClass).length?(this.suggestionsContainer=t(d.utils.createNode(s.containerClass)),this.suggestionsContainer.appendTo(s.appendTo||"body"),this.suggestionsContainer.addClass("woocommerce"),!0===s.showImage&&this.suggestionsContainer.addClass("dgwt-wcas-has-img"),!0===s.showPrice&&this.suggestionsContainer.addClass("dgwt-wcas-has-price"),!0===s.showDescription&&this.suggestionsContainer.addClass("dgwt-wcas-has-desc"),!0===s.showSKU&&this.suggestionsContainer.addClass("dgwt-wcas-has-sku"),!0===s.showHeadings&&this.suggestionsContainer.addClass("dgwt-wcas-has-headings"),"auto"!==s.width&&this.suggestionsContainer.width(s.width)):this.suggestionsContainer=t("."+this.options.containerClass),this.canShowDetailsBox()&&(0==t("."+s.containerDetailsClass).length?(this.detailsContainer=t(d.utils.createNode(s.containerDetailsClass)),this.detailsContainer.appendTo(s.appendTo||"body"),this.detailsContainer.addClass("woocommerce")):this.detailsContainer=t("."+s.containerDetailsClass))},registerEventsSearchBar:function(){var s=this;t(document).on("click.autocomplete","."+s.options.closeTrigger,function(){var s=e.getActiveInstance();s.hide(),s.clear(!1),t(this).removeClass(s.options.closeTrigger),t(this).closest("."+s.options.searchFormClass).find("."+s.options.searchInputClass).val("").focus()}),s.el.closest("."+s.options.formClass).on("submit.autocomplete",function(e){s.suggestions.length>0&&t.each(s.suggestions,function(t,i){if(void 0!==i.type&&"product_variation"==i.type)return s.select(t),e.preventDefault(),!1})}),t(window).on("load",function(){s.positionPreloader()}),s.el.on("keydown.autocomplete",function(t){s.onKeyPress(t)}),s.el.on("keyup.autocomplete",function(t){s.onKeyUp(t)}),s.el.on("blur.autocomplete",function(){s.onBlur()}),s.el.on("focus.autocomplete",function(){s.onFocus()}),s.el.on("change.autocomplete",function(t){s.onKeyUp(t)}),s.el.on("input.autocomplete",function(t){s.onKeyUp(t)})},registerEventsSuggestions:function(){var s="."+this.classes.suggestion;this.getSuggestionsContainer().hasClass("js-dgwt-wcas-initialized")||(t(document).on("mouseenter.autocomplete",s,function(){var s=e.getActiveInstance();if(void 0!==s){var i=t(this).data("index"),o='.dgwt-wcas-suggestion[data-index="'+i+'"]',a=s.canShowDetailsBox()?100:1;s.selectedIndex!=i&&e.mouseHoverDebounce(function(){s.selectedIndex!==i&&(s.latestActivateSource="mouse",s.getDetails(s.suggestions[i]),s.activate(i))},o,a)}}),t(document).on("click.autocomplete",s,function(){e.getActiveInstance().select(t(this).data("index"))}),t(document).on("click.autocomplete","."+this.options.containerClass,function(){var t=e.getActiveInstance();clearTimeout(t.blurTimeoutId)}))},registerEventsDetailsPanel:function(){var s=this.getDetailsContainer();this.canShowDetailsBox()&&!s.hasClass("js-dgwt-wcas-initialized")&&(t(document).on("click.autocomplete","."+this.options.containerDetailsClass,function(){var t=e.getActiveInstance();clearTimeout(t.blurTimeoutId)}),t(document).on("change",'[name="js-dgwt-wcas-quantity"]',function(e){t(this).closest(".js-dgwt-wcas-pd-addtc").find("[data-quantity]").attr("data-quantity",t(this).val())}))},registerIconHandler:function(){var s=this,i=s.getFormWrapper(),o=i.find("."+s.options.formClass);i.on("click",".js-dgwt-wcas-search-icon-handler",function(t){var e=i.find("."+s.options.searchInputClass);if(i.hasClass("dgwt-wcas-layout-icon-open"))s.hide(),o.hide(!0),i.removeClass("dgwt-wcas-layout-icon-open");else{var a=i.find(".dgwt-wcas-search-icon-arrow");o.hide(),a.hide(),i.addClass("dgwt-wcas-layout-icon-open"),s.positionIconSearchMode(i),o.fadeIn(200,function(){a.show(),s.positionPreloader(i),e.focus()})}}),0==t(".js-dgwt-wcas-initialized").length&&t(".js-dgwt-wcas-search-icon-handler").length>0&&t(document).click(function(i){if(t(".dgwt-wcas-layout-icon-open").length){var o=t(i.target);if(!(o.closest("."+s.options.searchFormClass).length>0||o.closest("."+s.options.containerClass).length>0||o.closest("."+s.options.containerDetailsClass).length>0)){var a=e.getActiveInstance();if(void 0!==a){var n=a.getFormWrapper().find("."+s.options.formClass);n.hide(),a.hide(!0),n.css({left:"0"})}s.hideIconModeSearch()}}}),t(window).on("resize.autocomplete",function(){s.applyFlexibleMode()}),t(window).on("load",function(){s.applyFlexibleMode()})},registerEventsFixedMenu:function(){var e=this;t(window).on("scroll",function(){if(e.suggestions.length>0&&e.elementOrParentIsFixed(e.getFormWrapper()))if(0===t(window).scrollTop()){[1,10,20,30,40,50,60,70,80,90,120,140,170,200,250,400,700,1e3,2e3].forEach(function(t){setTimeout(function(){e.fixHeight(),e.fixPositionCapture()},t)})}else e.fixHeight(),e.fixPositionCapture()})},initMobileMode:function(){var t=this;if(t.options.overlayMobile&&t.isMobileMode()){var e=t.getFormWrapper();e.prepend('<div class="js-dgwt-wcas-enable-mobile-form dgwt-wcas-enable-mobile-form"></div>'),e.find(".js-dgwt-wcas-enable-mobile-form").on("click",function(e){t.enableOverlayMobile()})}},applyFlexibleMode:function(){var e=t(".js-dgwt-wcas-layout-icon-flexible");e.length&&(this.isMobileMode()?(e.addClass("js-dgwt-wcas-layout-icon"),e.addClass("dgwt-wcas-layout-icon")):(e.removeClass("js-dgwt-wcas-layout-icon"),e.removeClass("dgwt-wcas-layout-icon")),e.addClass("dgwt-wcas-layout-icon-flexible-loaded"))},onFocus:function(){t("."+this.options.searchFormClass).removeClass("dgwt-wcas-active"),this.getFormWrapper().addClass("dgwt-wcas-active"),this.fixPositionCapture(),this.el.val().length>=this.options.minChars&&this.onValueChange()},onBlur:function(){var e=this,s=e.options,i=e.el.val(),o=e.getQuery(i);e.isMobileMode()||(e.blurTimeoutId=setTimeout(function(){e.hide(),e.selection&&e.currentValue!==o&&(s.onInvalidateSelection||t.noop).call(e.element)},200))},abortAjax:function(){this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null)},setOptions:function(e){var s=this,i=s.getSuggestionsContainer(),o=t.extend({},s.options,e);(s.isLocal=Array.isArray(o.lookup),s.isLocal&&(o.lookup=s.verifySuggestionsFormat(o.lookup)),o.orientation=s.validateOrientation(o.orientation,"bottom"),i.css({"max-height":s.canShowDetailsBox()?"none":o.maxHeight+"px",width:o.width+"px","z-index":o.zIndex}),!0===o.showDetailsPanel)&&s.getDetailsContainer().css({"z-index":o.zIndex-1});o.onSearchComplete=function(){s.getFormWrapper().removeClass("dgwt-wcas-processing"),s.preloader("hide","form","dgwt-wcas-inner-preloader"),s.preloader("show","form",o.closeTrigger)},this.options=o},clearCache:function(){this.cachedResponse={},this.cachedDetails={},this.cachedPrices={},this.badQueries=[]},clear:function(t){t&&this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){this.disabled=!0,clearTimeout(this.onChangeTimeout),this.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var t=this.getFormOffset();this.getSuggestionsContainer().css(t),this.canShowDetailsBox()&&this.fixPositionDetailsBox()},fixPositionDetailsBox:function(){var e=this.getFormWrapper(),s=this.getSuggestionsContainer(),i=this.getDetailsContainer(),o=this.getFormOffset(),a=o.left;if(0==i.length)return!1;var n=!0===this.options.isRtl?1:2,r=Math.round(o.left);if(o.left=r+Math.round(s.width()+n),i.css(o),e.width()>=550)return t("body").removeClass("dgwt-wcas-details-outside"),t("body").removeClass("dgwt-wcas-details-right"),t("body").removeClass("dgwt-wcas-details-left"),void(!0===this.options.isRtl&&(s.css("left",r+Math.round(i.width()+n)+"px"),i.css("left",a+"px")));var l=t(window).width(),c=i.width(),d=i.offset();t("body").addClass("dgwt-wcas-details-outside"),!0===this.options.isRtl&&(o.left=o.left+1);var g=!1,u=!1;l<d.left+c&&(g=!0,t("body").removeClass("dgwt-wcas-details-right"),t("body").addClass("dgwt-wcas-details-left"),i.css("left",Math.round(parseFloat(s.css("left").replace("px","")))-i.outerWidth()+"px")),(d=i.offset()).left<1&&(u=!0,t("body").removeClass("dgwt-wcas-details-left"),t("body").addClass("dgwt-wcas-details-right")),u&&g?(t("body").removeClass("dgwt-wcas-details-left"),t("body").removeClass("dgwt-wcas-details-right"),t("body").addClass("dgwt-wcas-details-notfit")):t("body").removeClass("dgwt-wcas-details-notfit")},fixHeight:function(){if(1!=this.options.showDetailsPanel)return!1;var t=this.getSuggestionsContainer(),e=this.getDetailsContainer();t.css("height","auto"),e.css("height","auto");var s=t.outerHeight(),i=e.outerHeight();return t.find(".dgwt-wcas-suggestion:last-child").removeClass("dgwt-wcas-suggestion-no-border-bottom"),!(s<=340&&i<=340)&&(t.find(".dgwt-wcas-suggestion:last-child").addClass("dgwt-wcas-suggestion-no-border-bottom"),i<s&&e.css("height",s+"px"),s<i&&t.css("height",i+"px"),!1)},automaticAlignment:function(){var t=this,e=t.getFormWrapper().find(".dgwt-wcas-search-input"),s=t.getSuggestionsContainer(),i=t.getDetailsContainer();if(null==t.autoAligmentprocess){var o=[e.width(),s.height()];t.options.showDetailsPanel&&(o[2]=i.height()),t.autoAligmentprocess=setInterval(function(){var a=[e.width(),s.height()];t.options.showDetailsPanel&&(a[2]=i.height());for(var n=0;n<o.length;n++)if(o[n]!=a[n]){t.fixHeight(),t.fixPositionCapture(),o=a;break}t.options.showDetailsPanel&&(i.find(".dgwt-wcas-details-inner").height()-i.height()>2&&t.fixHeight())},10)}},getFormOffset:function(){var e=this.getFormWrapper(),s=this.getSuggestionsContainer(),i=this.options.orientation,o=e.outerHeight(),a=this.el.outerHeight(),n=this.el.offset(),r={top:n.top,left:n.left};if("auto"===i){var l=t(window).height(),c=t(window).scrollTop(),d=-c+n.top-o,g=c+l-(n.top+a+o);i=Math.max(d,g)===d?"top":"bottom"}if("top"===i){s[0].getBoundingClientRect().top;var u=e[0].getBoundingClientRect().top;s.css("height","auto"),u<s.height()&&s.height(u-10),r.top+=-s.outerHeight()}else r.top+=a;return r},getFormWrapper:function(){return this.el.closest("."+this.options.searchFormClass)},getSuggestionsContainer:function(){return t("."+this.options.containerClass)},getDetailsContainer:function(){return t("."+this.options.containerDetailsClass)},scrollDownSuggestions:function(){var t=this.getSuggestionsContainer();t[0].scrollTop=t[0].scrollHeight},isCursorAtEnd:function(){var t,e=this.el.val().length,s=this.element.selectionStart;return"number"==typeof s?s===e:!document.selection||((t=document.selection.createRange()).moveStart("character",-e),e===t.text.length)},onKeyPress:function(t){if(this.disabled||this.visible||t.which!==l||!this.currentValue){if(!this.disabled&&this.visible){switch(t.which){case i:this.el.val(this.currentValue),this.hide();break;case r:if(this.hint&&this.options.onHint&&this.isCursorAtEnd()){this.selectHint();break}return;case o:if(this.hint&&this.options.onHint)return void this.selectHint();if(-1===this.selectedIndex)return void this.hide();if(this.select(this.selectedIndex),!1===this.options.tabDisabled)return;break;case a:if(-1===this.selectedIndex)return void this.hide();this.select(this.selectedIndex);break;case n:this.moveUp();break;case l:this.moveDown();break;default:return}t.stopImmediatePropagation(),t.preventDefault()}}else this.suggest()},onKeyUp:function(t){var e=this;if(!e.disabled){switch(t.which){case n:case l:return}clearTimeout(e.onChangeTimeout),e.currentValue!==e.el.val()&&(e.findBestHint(),e.options.deferRequestBy>0?e.onChangeTimeout=setTimeout(function(){e.onValueChange()},e.options.deferRequestBy):e.onValueChange())}},onValueChange:function(){if(this.ignoreValueChange)this.ignoreValueChange=!1;else{var e=this.options,s=this.el.val(),i=this.getQuery(s);this.selection&&this.currentValue!==i&&(this.selection=null,(e.onInvalidateSelection||t.noop).call(this.element)),clearTimeout(this.onChangeTimeout),this.currentValue=s,this.selectedIndex=-1,e.triggerSelectOnValidInput&&this.isExactMatch(i)?this.select(0):i.length<e.minChars?(t("."+this.options.closeTrigger).removeClass(this.options.closeTrigger),this.hide()):this.getSuggestions(i)}},isExactMatch:function(t){var e=this.suggestions;return 1===e.length&&e[0].value.toLowerCase()===t.toLowerCase()},canShowDetailsBox:function(){return 1==this.options.showDetailsPanel&&!this.isMobileMode()},isMobileMode:function(){return t(window).width()<this.options.mobileBreakpoint},getQuery:function(e){var s,i=this.options.delimiter;return i?(s=e.split(i),t.trim(s[s.length-1])):e},getSuggestionsLocal:function(e){var s,i=this.options,o=e.toLowerCase(),a=i.lookupFilter,n=parseInt(i.lookupLimit,10);return s={suggestions:t.grep(i.lookup,function(t){return a(t,e,o)})},n&&s.suggestions.length>n&&(s.suggestions=s.suggestions.slice(0,n)),s},getSuggestions:function(i){var o,a,n,r,l=this,c=l.options,d=c.serviceUrl,g=l.getFormWrapper();c.params[c.paramName]=i,void 0!==dgwt_wcas.current_lang&&(c.params.l=dgwt_wcas.current_lang),c.params=l.applyCustomParams(c.params),l.preloader("show","form","dgwt-wcas-inner-preloader"),g.addClass("dgwt-wcas-processing"),!1!==c.onSearchStart.call(l.element,c.params)&&(a=c.ignoreParams?null:c.params,t.isFunction(c.lookup)?c.lookup(i,function(t){l.suggestions=t.suggestions,l.suggest(),l.selectFirstSuggestion(t.suggestions),c.onSearchComplete.call(l.element,i,t.suggestions)}):(l.isLocal?o=l.getSuggestionsLocal(i):(t.isFunction(d)&&(d=d.call(l.element,i)),n=d+"?"+t.param(a||{}),o=l.cachedResponse[n]),o&&Array.isArray(o.suggestions)?(l.suggestions=o.suggestions,l.suggest(),l.selectFirstSuggestion(o.suggestions),c.onSearchComplete.call(l.element,i,o.suggestions)):l.isBadQuery(i)?c.onSearchComplete.call(l.element,i,[]):(l.abortAjax(),r={url:d,data:a,type:c.type,dataType:c.dataType},t.extend(r,c.ajaxSettings),s.object=l,s.ajaxSettings=r,e.debounce(function(){var e=s.object,o=s.ajaxSettings;e.currentRequest=t.ajax(o).done(function(t){var s;e.currentRequest=null,void 0!==(s=e.options.transformResult(t,i)).suggestions&&(e.processResponse(s,i,n),e.selectFirstSuggestion(s.suggestions),1===s.suggestions.length&&void 0!==s.suggestions[0].type&&"no-results"===s.suggestions[0].type?e.gaEvent(i,"Autocomplete Search without results"):e.gaEvent(i,"Autocomplete Search with results")),e.fixPositionCapture(),e.options.onSearchComplete.call(e.element,i,s.suggestions),e.updatePrices()}).fail(function(t,s,o){e.options.onSearchError.call(e.element,i,t,s,o)})},c.debounceWaitMs))))},getDetails:function(e){var s=this;if(!s.canShowDetailsBox())return!1;if(null!=e&&void 0!==e.type&&("string"!=typeof e.more_products||"more_products"!==e.more_products)){s.fixHeight();var i,o=s.getDetailsContainer(),a=s.prepareSuggestionObjectID(e);if(null!=(i=s.cachedDetails[a]))o.html(i.html),s.fixHeight(),s.fixPositionCapture();else{var n={action:dgwt_wcas.action_result_details,items:[]};if(t.each(s.suggestions,function(t,e){if(void 0!==e.type&&"more_products"!=e.type&&"headline"!=e.type){var i={objectID:s.prepareSuggestionObjectID(e),value:null!=e.value?e.value:""};n.items.push(i)}}),o.html(""),s.preloader("show","details","",!0),-1!=t.inArray(a,s.detailsRequestsSent))return;s.detailsRequestsSent.push(a),t.ajax({data:n,type:"post",url:dgwt_wcas.ajax_details_endpoint,success:function(t){var e="string"==typeof t?jQuery.parseJSON(t):t;if(void 0!==e.items)for(var i=0;i<e.items.length;i++){var a=e.items[i].objectID;if(s.cachedDetails[a]={html:e.items[i].html},void 0!==e.items[i].price&&e.items[i].price.length>0&&(s.cachedPrices[a]=e.items[i].price),void 0!==e.items[i].imageSrc&&e.items[i].imageSrc.length>0)(new Image).src=e.items[i].imageSrc}s.preloader("hide","details","",!0);var n=s.prepareSuggestionObjectID(s.suggestions[s.selectedIndex]);null!=s.cachedDetails[n]?o.html(s.cachedDetails[n].html):o.html(""),s.fixPositionCapture(),s.fixHeight(),s.updatePrices(!0)},error:function(t,e){s.preloader("hide","details","",!0),o.html(t),s.fixPositionCapture(),s.fixHeight()}})}t(document).trigger("dgwtWcasDetailsPanelLoaded",s)}},updatePrices:function(e){var s,i,o=this,a=[];if(o.options.showPrice&&o.options.dynamicPrices&&0!=o.suggestions.length){for(s=0;s<o.suggestions.length;s++)if(void 0!==o.suggestions[s].type&&("product"==o.suggestions[s].type||"product_variation"==o.suggestions[s].type)){var n="product__"+o.suggestions[s].post_id;void 0!==o.cachedPrices[n]?o.updatePrice(s,o.cachedPrices[n]):(o.applyPreloaderForPrice(s),a.push(o.suggestions[s].post_id))}if(!e&&a.length>0){var r={action:void 0===dgwt_wcas.action_get_prices?"dgwt_wcas_get_prices":dgwt_wcas.action_get_prices,items:a};t.ajax({data:r,type:"post",url:dgwt_wcas.ajax_prices_endpoint,success:function(t){if(void 0!==t.success&&t.success&&t.data.length>0)for(s=0;s<t.data.length;s++){var e=t.data[s].id,a=t.data[s].price;if(o.suggestions.length>0)for(i=0;i<o.suggestions.length;i++)if(void 0!==o.suggestions[i].type&&("product"==o.suggestions[i].type||"product_variation"==o.suggestions[i].type)&&o.suggestions[i].post_id==e){var n="product__"+e;o.cachedPrices[n]=a,o.updatePrice(i,a)}}},error:function(t,e){}})}}},updatePrice:function(e,s){if(void 0!==this.suggestions[e]){this.suggestions[e].price=s;var i=t(".dgwt-wcas-suggestions-wrapp").find('[data-index="'+e+'"] .dgwt-wcas-sp');i.length&&i.html(s)}},applyCustomParams:function(t){if("object"==typeof dgwt_wcas.custom_params){var e=dgwt_wcas.custom_params;for(var s in e)t[s]=e[s]}var i=this.el.data("custom-params");if("object"==typeof i)for(var s in i)t[s]=i[s];return t},applyPreloaderForPrice:function(e){if(void 0!==this.suggestions[e]){var s=t(".dgwt-wcas-suggestions-wrapp").find('[data-index="'+e+'"] .dgwt-wcas-sp');s.length&&s.html('<div class="dgwt-wcas-preloader-price"><div class="dgwt-wcas-preloader-price-inner"> <div></div><div></div><div></div></div></div>')}},prepareSuggestionObjectID:function(t){var e="";return void 0!==t&&void 0!==t.type&&(null!=t.post_id&&(e=t.type+"__"+t.post_id,"product_variation"===t.type&&(e+="__"+t.variation_id),void 0!==t.post_type&&(e=t.type+"__"+t.post_id+"__"+t.post_type)),null!=t.term_id&&null!=t.taxonomy&&(e=t.type+"__"+t.term_id+"__"+t.taxonomy)),e},selectFirstSuggestion:function(e){var s=0,i=!1;this.canShowDetailsBox()&&("undefined"!=e&&e.length>0&&t.each(this.suggestions,function(t,e){if(void 0!==e.type&&"more_products"!=e.type&&"headline"!=e.type&&"no-results"!=e.type)return s=t,!1;void 0!==e.type&&"no-results"!==e.type||(i=!0)}),i||(this.latestActivateSource="system",this.getDetails(e[s]),this.activate(s)))},isBadQuery:function(t){if(!this.options.preventBadQueries)return!1;for(var e=this.badQueries,s=e.length;s--;)if(0===t.indexOf(e[s]))return!0;return!1},hide:function(e){var s=this.getFormWrapper(),i=this.getSuggestionsContainer(),o=this.getDetailsContainer();if(t.isFunction(this.options.onHide)&&this.visible&&this.options.onHide.call(this.element,container),this.visible=!1,this.selectedIndex=-1,clearTimeout(this.onChangeTimeout),i.hide(),i.removeClass(this.classes.suggestionsContainerOrientTop),o.hide(),t("body").removeClass("dgwt-wcas-open"),t("body").removeClass("dgwt-wcas-block-scroll"),t("body").removeClass("dgwt-wcas-is-details"),t("body").removeClass("dgwt-wcas-full-width"),t("body").removeClass("dgwt-wcas-nores"),t("body").removeClass("dgwt-wcas-details-outside"),t("body").removeClass("dgwt-wcas-details-right"),t("body").removeClass("dgwt-wcas-details-left"),null!=this.autoAligmentprocess&&(clearInterval(this.autoAligmentprocess),this.autoAligmentprocess=null),"boolean"==typeof e&&e){s.find("."+this.options.searchInputClass).val("");var a=s.find("."+this.options.closeTrigger);a.length&&a.removeClass(this.options.closeTrigger),this.currentValue="",this.suggestions=[]}this.signalHint(null)},positionIconSearchMode:function(e){var s,i=e.find("."+this.options.formClass),o=i.width(),a=t(window).width(),n=e[0].getBoundingClientRect().left;i[0].getBoundingClientRect().left;var r=(n+10)/a;s=Math.floor(o*r*-1),i.css({left:s+"px"})},hideIconModeSearch:function(){var e=t(".dgwt-wcas-layout-icon-open");e.length>0&&e.removeClass("dgwt-wcas-layout-icon-open")},hideAfterClickOutsideListener:function(){var e=this;e.isMobileMode()||t(document).mouseup(function(s){if(e.visible){e.getSuggestionsContainer(),e.getDetailsContainer();var i=!(t(s.target).closest("."+e.options.searchFormClass).length>0||t(s.target).hasClass(e.options.searchFormClass)),o=!(t(s.target).closest("."+e.options.containerClass).length>0||t(s.target).hasClass(e.options.containerClass));if(e.canShowDetailsBox()){var a=!(t(s.target).closest("."+e.options.containerDetailsClass).length>0||t(s.target).hasClass(e.options.containerDetailsClass));i&&o&&a&&e.hide()}else i&&o&&e.hide()}})},suggest:function(){if(this.suggestions.length){var e,s=this,i=s.options,o=i.groupBy,a=i.formatResult,n=s.getQuery(s.currentValue),r=s.classes.suggestion,l=s.classes.selected,c=s.getSuggestionsContainer(),d=s.getDetailsContainer(),g=t(s.noSuggestionsContainer),u=i.beforeRender,h="";i.triggerSelectOnValidInput&&s.isExactMatch(n)?s.select(0):(t("body").removeClass("dgwt-wcas-nores"),t.each(s.suggestions,function(s,l){var c="",g=!1;if(o&&(h+=function(t,s){var i=t.data[o];return e===i?"":'<div class="autocomplete-group"><strong>'+(e=i)+"</strong></div>"}(l,0)),void 0===l.type||"product"!=l.type&&"product_variation"!=l.type){var u=r,p="dgwt-wcas-st",w="",f="",m="",v=!0;"product_cat"===l.taxonomy?(u+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-cat",i.showHeadings||(w+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.category+"</span>"),void 0!==l.breadcrumbs&&l.breadcrumbs&&(m=l.breadcrumbs+" &gt; "+l.value,f+='<span class="dgwt-wcas-st-breadcrumbs">'+dgwt_wcas.labels.in+" "+l.breadcrumbs+"</span>")):"product_tag"===l.taxonomy?(u+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-tag",i.showHeadings||(w+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.tag+"</span>")):i.isPremium&&l.taxonomy===i.taxonomyBrands?(u+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-brand",i.showHeadings||(w+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.brand+"</span>")):i.isPremium&&"post"===l.type?(u+=" dgwt-wcas-suggestion-pt dgwt-wcas-suggestion-tp-post",i.showHeadings||(w+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.post+"</span>")):i.isPremium&&"page"===l.type?(u+=" dgwt-wcas-suggestion-pt dgwt-wcas-suggestion-pt-page",i.showHeadings||(w+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.page+"</span>")):"more_products"===l.type?(u+=" js-dgwt-wcas-suggestion-more dgwt-wcas-suggestion-more",p="dgwt-wcas-st-more",l.value=dgwt_wcas.labels.show_more+" ("+l.total+")",v=!1):i.showHeadings&&"headline"===l.type?(u+=" js-dgwt-wcas-suggestion-headline dgwt-wcas-suggestion-headline",void 0!==dgwt_wcas.labels[l.value+"_plu"]&&(l.value=dgwt_wcas.labels[l.value+"_plu"]),v=!1):(u+=" dgwt-wcas-suggestion-nores",l.value=dgwt_wcas.labels.no_results,v=!1,!0===i.showDetailsPanel&&d.html(""),t("body").addClass("dgwt-wcas-nores")),m=m.length>0?' title="'+m+'"':"",h+='<div class="'+u+'" data-index="'+s+'">',h+="<span"+m+' class="'+p+'">'+w+a(l.value,n,v)+f+"</span>",h+="</div>"}else!0===i.showImage&&void 0!==l.thumb_html&&(g=!0),c+=void 0!==l.post_id?'data-post-id="'+l.post_id+'" ':"",c+=void 0!==l.taxonomy?'data-taxonomy="'+l.taxonomy+'" ':"",c+=void 0!==l.term_id?'data-term-id="'+l.term_id+'" ':"",h+='<div class="'+r+' dgwt-wcas-suggestion-product" data-index="'+s+'" '+c+">",g&&(h+='<span class="dgwt-wcas-si">'+l.thumb_html+"</span>"),h+=g?'<div class="dgwt-wcas-content-wrapp">':"",h+='<span class="dgwt-wcas-st">',h+='<span class="dgwt-wcas-st-title">'+a(l.value,n,!0)+"</span>",!0===i.showSKU&&void 0!==l.sku&&l.sku.length>0&&(h+='<span class="dgwt-wcas-sku">('+dgwt_wcas.labels.sku_label+" "+a(l.sku,n,!0)+")</span>"),!0===i.showDescription&&void 0!==l.desc&&l.desc&&(h+='<span class="dgwt-wcas-sd">'+a(l.desc,n,!0)+"</span>"),h+="</span>",!0===i.showPrice&&void 0!==l.price&&(h+='<span class="dgwt-wcas-sp">'+l.price+"</span>"),!0===i.showFeaturedBadge&&!0===l.on_sale&&(h+='<span class="dgwt-wcas-badge dgwt-wcas-badge-os">'+i.saleBadgeText+"</span>"),!0===i.showFeaturedBadge&&!0===l.featured&&(h+='<span class="dgwt-wcas-badge dgwt-wcas-badge-f">'+i.featuredBadgeText+"</span>"),h+=g?"</div>":"",h+="</div>"}),this.adjustContainerWidth(),g.detach(),c.html(h),t.isFunction(u)&&u.call(s.element,c,s.suggestions),c.show(),t("body").addClass("dgwt-wcas-open"),s.automaticAlignment(),!0===i.showDetailsPanel&&(t("body").addClass("dgwt-wcas-is-details"),d.show(),s.fixHeight()),i.autoSelectFirst&&(s.selectedIndex=0,c.scrollTop(0),c.children("."+r).first().addClass(l)),s.visible=!0,s.fixPositionCapture(),"top"===s.options.orientation&&(s.getSuggestionsContainer().addClass(s.classes.suggestionsContainerOrientTop),t("body").addClass("dgwt-wcas-block-scroll"),setTimeout(function(){s.scrollDownSuggestions()},300)),s.findBestHint())}else this.hide()},adjustContainerWidth:function(){var e,s=this.options,i=t("body"),o=this.getFormWrapper(),a=this.getSuggestionsContainer(),n=this.getDetailsContainer(),r=this.getFormOffset();if(o.length){var l=getComputedStyle(o[0]).width;if(l=Math.round(parseFloat(l.replace("px",""))),"auto"===s.width&&(e=this.el.outerWidth(),a.css("width",e+"px")),this.canShowDetailsBox()){if(o.width()>=550)return i.addClass("dgwt-wcas-full-width"),l%2==0?(a.css("width",Math.round(l/2)),n.css("width",Math.round(l/2))):(a.css("width",Math.floor(l/2)),n.css("width",Math.ceil(l/2))),i.removeClass("dgwt-wcas-details-left"),i.removeClass("dgwt-wcas-details-right"),void(!0===s.isRtl?n.css("left","0"):a.css("left",l/2+r.left+"px"));i.addClass("dgwt-wcas-details-right")}}},positionPreloader:function(e){var s="object"==typeof e?e.find(".dgwt-wcas-search-submit"):t(".dgwt-wcas-search-submit");s.length>0&&s.each(function(){var e=t(this).closest(".dgwt-wcas-search-wrapp").find(".dgwt-wcas-preloader");1==dgwt_wcas.is_rtl?e.css("left",6+t(this).outerWidth()+"px"):e.css("right",t(this).outerWidth()+"px")})},findBestHint:function(){var e=this.el.val().toLowerCase(),s=null;e&&(t.each(this.suggestions,function(t,i){var o=0===i.value.toLowerCase().indexOf(e);return o&&(s=i),!o}),this.signalHint(s))},signalHint:function(e){var s="";e&&(s=this.currentValue+e.value.substr(this.currentValue.length)),this.hintValue!==s&&(this.hintValue=s,this.hint=e,(this.options.onHint||t.noop)(s))},preloader:function(e,s,i,o){var a,n,r="dgwt-wcas-preloader-wrapp",l=null==i?r:r+" "+i;if("form"===s?n=this.getFormWrapper().find(".dgwt-wcas-preloader"):"details"===s&&(n=this.getDetailsContainer()),1==dgwt_wcas.show_preloader&&0!=n.length)if(!0===o)if("hide"!==e){if("show"===e){var c=this.options.isRtl?"-rtl":"";a='<div class="'+l+'"><img class="dgwt-wcas-placeholder-preloader" src="'+dgwt_wcas.img_url+"placeholder"+c+'.png" /></div>',n.html(a)}}else t(r).remove();else"hide"===e?n.removeClass(i):n.addClass(i)},verifySuggestionsFormat:function(e){return e.length&&"string"==typeof e[0]?t.map(e,function(t){return{value:t,data:null}}):e},validateOrientation:function(e,s){return e=t.trim(e||"").toLowerCase(),-1===t.inArray(e,["auto","bottom","top"])&&(e=s),e},processResponse:function(t,e,s){var i=this.options;t.suggestions=this.verifySuggestionsFormat(t.suggestions),i.noCache||(this.cachedResponse[s]=t,i.preventBadQueries&&!t.suggestions.length&&this.badQueries.push(e)),e===this.getQuery(this.currentValue)&&("top"===this.options.orientation&&t.suggestions.reverse(),this.suggestions=t.suggestions,this.suggest())},activate:function(e){var s,i=this.classes.selected,o=this.getSuggestionsContainer(),a=o.find("."+this.classes.suggestion);return o.find("."+i).removeClass(i),this.selectedIndex=e,-1!==this.selectedIndex&&a.length>this.selectedIndex?(s=a.get(this.selectedIndex),t(s).addClass(i),s):null},selectHint:function(){var e=t.inArray(this.hint,this.suggestions);this.select(e)},select:function(t){this.hide(),this.onSelect(t)},moveUp:function(){if(-1!==this.selectedIndex){if(this.latestActivateSource="key",0===this.selectedIndex)return this.getSuggestionsContainer().children("."+this.classes.suggestion).first().removeClass(this.classes.selected),this.selectedIndex=-1,this.ignoreValueChange=!1,this.el.val(this.currentValue),void this.findBestHint();this.adjustScroll(this.selectedIndex-1,"up")}},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&(this.latestActivateSource="key",this.adjustScroll(this.selectedIndex+1,"down"))},adjustScroll:function(e,s){if("headline"===this.suggestions[e].type&&(e="down"===s?e+1:e-1),void 0!==this.suggestions[e]){var i=this.activate(e);if(this.getDetails(this.suggestions[e]),"more_products"!==this.suggestions[e].type&&i&&!this.canShowDetailsBox()){var o,a,n,r=this.getSuggestionsContainer(),l=t(i).outerHeight();o=i.offsetTop,n=(a=r.scrollTop())+this.options.maxHeight-l,o<a?r.scrollTop(o):o>n&&r.scrollTop(o-this.options.maxHeight+l),this.options.preserveInput||(this.ignoreValueChange=!0),this.signalHint(null)}}},onSelect:function(e){var s=this.options.onSelect,i=this.suggestions[e];void 0!==i.type&&"more_products"===i.type||"key"!=this.latestActivateSource?this.el.closest("form").trigger("submit"):(this.currentValue=this.getValue(i.value),this.currentValue===this.el.val()||this.options.preserveInput||this.el.val(this.currentValue),i.url.length>0&&(window.location.href=i.url),this.signalHint(null),this.suggestions=[],this.selection=i,t.isFunction(s)&&s.call(this.element,i))},getValue:function(t){var e,s,i=this.options.delimiter;return i?1===(s=(e=this.currentValue).split(i)).length?t:e.substr(0,e.length-s[s.length-1].length)+t:t},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete"),t(window).off("resize.autocomplete",this.fixPositionCapture),t("."+this.options.containerClass).remove(),t("."+this.options.containerDetailsClass).remove()},enableOverlayMobile:function(){var e=this;if("on"!==e.overlayMobileState){e.overlayMobileState="on";var s,i=e.getFormWrapper(),o=e.getSuggestionsContainer();t("html").addClass("dgwt-wcas-overlay-mobile-on"),'<div class="js-dgwt-wcas-overlay-mobile dgwt-wcas-overlay-mobile">','<div class="dgwt-wcas-om-bar js-dgwt-wcas-om-bar">','<span class="dgwt-wcas-om-return js-dgwt-wcas-om-return">','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" color="#FFF">','<path fill="#FFF" d="M14 6.125H3.351l4.891-4.891L7 0 0 7l7 7 1.234-1.234L3.35 7.875H14z" fill-rule="evenodd"></path>',"</svg>","</span>","</div>","</div>",t(e.options.mobileOverlayWrapper).append('<div class="js-dgwt-wcas-overlay-mobile dgwt-wcas-overlay-mobile"><div class="dgwt-wcas-om-bar js-dgwt-wcas-om-bar"><span class="dgwt-wcas-om-return js-dgwt-wcas-om-return"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" color="#FFF"><path fill="#FFF" d="M14 6.125H3.351l4.891-4.891L7 0 0 7l7 7 1.234-1.234L3.35 7.875H14z" fill-rule="evenodd"></path></svg></span></div></div>'),(s=t(".js-dgwt-wcas-overlay-mobile")).css("zIndex",999999),i.after('<span class="js-dgwt-wcas-om-hook"></span>'),i.appendTo(".js-dgwt-wcas-om-bar"),o.appendTo(".js-dgwt-wcas-om-bar"),i.addClass("dgwt-wcas-search-wrapp-mobile"),i.hasClass("dgwt-wcas-has-submit")&&(i.addClass("dgwt-wcas-has-submit-off"),i.removeClass("dgwt-wcas-has-submit")),i.find("."+e.options.searchInputClass).focus(),t(document).on("click",".js-dgwt-wcas-om-return",function(t){e.disableOverlayMobile(s)})}},disableOverlayMobile:function(e){var s=this,i=s.getSuggestionsContainer(),o=t(".js-dgwt-wcas-om-bar").find("."+s.options.searchFormClass);o.hasClass("dgwt-wcas-has-submit-off")&&(o.removeClass("dgwt-wcas-has-submit-off"),o.addClass("dgwt-wcas-has-submit")),o.removeClass("dgwt-wcas-search-wrapp-mobile"),t("html").removeClass("dgwt-wcas-overlay-mobile-on"),i.appendTo("body"),i.removeAttr("body-scroll-lock-ignore"),t(".js-dgwt-wcas-om-hook").after(o),t(".js-dgwt-wcas-overlay-mobile").remove(),t(".js-dgwt-wcas-om-hook").remove(),setTimeout(function(){o.find("."+s.options.searchInputClass).val("");var t=o.find(".dgwt-wcas-close");o.length>0&&t.removeClass("dgwt-wcas-close"),s.hide()},150),s.overlayMobileState="off"},elementOrParentIsFixed:function(e){var s=e.add(e.parents()),i=!1;return s.each(function(){if("fixed"===t(this).css("position"))return i=!0,!1}),i},gaEvent:function(t,e){if(this.options.sendGAEvents)try{if("undefined"!=typeof gtag)return void gtag("event","autocomplete_search",{event_label:t,event_category:e});"undefined"!=typeof ga&&ga("send",{hitType:"event",eventCategory:e,eventAction:"autocomplete_search",eventLabel:t})}catch(t){}}},t.fn.dgwtWcasAutocomplete=function(e,s){return arguments.length?this.each(function(){var i=t(this),o=i.data("autocomplete");"string"==typeof e?o&&"function"==typeof o[e]&&o[e](s):(o&&o.dispose&&o.dispose(),o=new d(this,e),i.data("autocomplete",o))}):this.first().data("autocomplete")},t.fn.autocomplete||(t.fn.autocomplete=t.fn.dgwtWcasAutocomplete),function(){function e(){var e=t(".dgwt-wcas-search-input"),s=[];e.length>1&&e.each(function(){var e=t(this).attr("id");if(-1==t.inArray(e,s))s.push(e);else{var i=Math.random().toString(36).substring(2,6);i="dgwt-wcas-search-input-"+i,t(this).attr("id",i),t(this).closest("form").find("label").attr("for",i)}})}function s(){var e=t(".dgwt-wcas-search-input");e.length>0&&e.each(function(){"object"!=typeof t(this).data("autocomplete")&&t(this).dgwtWcasAutocomplete(window.dgwt_wcas.config)})}t(document).ready(function(){var e=1==dgwt_wcas.show_details_box,s=dgwt_wcas.mobile_breakpoint;(jQuery(window).width()<s||"ontouchend"in document)&&(e=!1),window.dgwt_wcas.config={minChars:dgwt_wcas.min_chars,width:dgwt_wcas.sug_width,autoSelectFirst:!1,triggerSelectOnValidInput:!1,serviceUrl:dgwt_wcas.ajax_search_endpoint,paramName:"s",showDetailsPanel:e,showImage:1==dgwt_wcas.show_images,showPrice:1==dgwt_wcas.show_price,showDescription:1==dgwt_wcas.show_desc,showSKU:1==dgwt_wcas.show_sku,showSaleBadge:1==dgwt_wcas.show_sale_badge,showFeaturedBadge:1==dgwt_wcas.show_featured_badge,dynamicPrices:!(void 0===dgwt_wcas.dynamic_prices||!dgwt_wcas.dynamic_prices),saleBadgeText:dgwt_wcas.labels.sale_badge,featuredBadgeText:dgwt_wcas.labels.featured_badge,isRtl:1==dgwt_wcas.is_rtl,showHeadings:1==dgwt_wcas.show_headings,isPremium:1==dgwt_wcas.is_premium,taxonomyBrands:dgwt_wcas.taxonomy_brands,overlayMobile:1==dgwt_wcas.overlay_mobile,mobileBreakpoint:s,mobileOverlayWrapper:dgwt_wcas.mobile_overlay_wrapper,debounceWaitMs:dgwt_wcas.debounce_wait_ms,sendGAEvents:dgwt_wcas.send_ga_events},t(".dgwt-wcas-search-input").dgwtWcasAutocomplete(window.dgwt_wcas.config)}),t(document).ready(function(){setTimeout(function(){e(),s()},500)}),t(window).on("load",function(){setTimeout(function(){e(),s()},500),void 0!==window.elementorFrontend&&void 0!==window.elementorFrontend.documentsManager&&void 0!==window.elementorFrontend.documentsManager.documents&&t.each(elementorFrontend.documentsManager.documents,function(t,e){void 0!==e.getModal&&e.getModal&&e.getModal().on("show",function(){setTimeout(function(){s()},300)})})})}()});
backward-compatibility/1-1-7/img/close.png DELETED
Binary file
backward-compatibility/1-1-7/img/preloader.gif DELETED
Binary file
backward-compatibility/1-1-7/img/preloader.png DELETED
Binary file
backward-compatibility/1-1-7/jquery.dgwt-wcas.min.js DELETED
@@ -1 +0,0 @@
1
- !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports&&"function"==typeof require?require("jquery"):jQuery)}(function(e){"use strict";function t(s,n){var i=e.noop,o=this,a={ajaxSettings:{},autoSelectFirst:!1,appendTo:document.body,serviceUrl:null,lookup:null,onSelect:null,onMouseOver:null,onMouseLeave:null,width:"auto",containerDetailsWidth:"auto",showDetailsPanel:!1,showImage:!1,showPrice:!1,showSKU:!1,showDescription:!1,showSaleBadge:!1,showFeaturedBadge:!1,saleBadgeText:"sale",featuredBadgeText:"featured",minChars:1,maxHeight:1e3,deferRequestBy:0,params:{},formatResult:t.formatResult,delimiter:null,zIndex:9999,type:"GET",noCache:!1,is_rtl:!1,onSearchStart:i,onSearchComplete:i,onSearchError:i,preserveInput:!1,wrapperaClass:"dgwt-wcas-search-wrapp",containerClass:"dgwt-wcas-suggestions-wrapp",containerDetailsClass:"dgwt-wcas-details-wrapp",cointainerDetailsPos:"right",preloaderClass:"dgwt-wcas-preloader",closeTrigger:"dgwt-wcas-close",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(e,t,s){return-1!==e.value.toLowerCase().indexOf(s)},paramName:"query",transformResult:function(t){return"string"==typeof t?e.parseJSON(t):t},showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1};o.element=s,o.el=e(s),o.suggestions=[],o.badQueries=[],o.selectedIndex=-1,o.currentValue=o.element.value,o.intervalId=0,o.cachedResponse={},o.cachedDetails={},o.detailsRequestsSent=[],o.onChangeInterval=null,o.onChange=null,o.isLocal=!1,o.suggestionsContainer=null,o.detailsContainer=null,o.noSuggestionsContainer=null,o.options=e.extend({},a,n),o.classes={selected:"dgwt-wcas-suggestion-selected",suggestion:"dgwt-wcas-suggestion"},o.hint=null,o.hintValue="",o.selection=null,o.initialize(),o.setOptions(n)}var s=function(){return{escapeRegExChars:function(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(e){var t=document.createElement("div");return t.className=e,t.style.position="absolute",t.style.display="none",t}}}(),n={ESC:27,TAB:9,RETURN:13,LEFT:37,UP:38,RIGHT:39,DOWN:40};t.utils=s,e.Autocomplete=t,t.formatResult=function(e,t){if(!t)return e;var n="("+s.escapeRegExChars(t)+")";return e.replace(new RegExp(n,"gi"),"<strong>$1</strong>").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/&lt;(\/?strong)&gt;/g,"<$1>")},t.prototype={killerFn:null,initialize:function(){var s,n=this,i="."+n.classes.suggestion,o=(n.classes.selected,n.options),a="."+o.closeTrigger;n.element.setAttribute("autocomplete","off"),n.killerFn=function(t){0===e(t.target).closest("."+n.options.containerClass).length&&0===e(t.target).closest("."+n.options.containerDetailsClass).length&&(n.killSuggestions(),n.disableKillerFn())},n.noSuggestionsContainer=e('<div class="dgwt-wcas-no-suggestion"></div>').html(this.options.noSuggestionNotice).get(0),n.suggestionsContainer=t.utils.createNode(o.containerClass),(s=e(n.suggestionsContainer)).appendTo(n.el.closest("."+o.wrapperaClass)),!0===o.showImage&&s.addClass("dgwt-wcas-has-img"),!0===o.showPrice&&s.addClass("dgwt-wcas-has-price"),!0===o.showDescription&&s.addClass("dgwt-wcas-has-desc"),!0===o.showSKU&&s.addClass("dgwt-wcas-has-sku"),"auto"!==o.width&&s.width(o.width),!0===o.showDetailsPanel&&(n.detailsContainer=t.utils.createNode(o.containerDetailsClass),e(n.detailsContainer).appendTo(n.el.closest("."+o.wrapperaClass))),s.on("mouseover.autocomplete",i,function(){n.onMouseOver(e(this).data("index")),n.activate(e(this).data("index"))}),s.on("mouseout.autocomplete",function(){}),e(document).on("click.autocomplete",a,function(t){n.killerFn(t),n.clear(t),e(this).removeClass(o.closeTrigger),n.el.val("").focus()}),s.on("click.autocomplete",i,function(){return n.select(e(this).data("index")),!1}),n.fixPositionCapture=function(){n.visible&&n.fixPosition()},e(window).on("resize.autocomplete",n.fixPositionCapture),n.el.on("keydown.autocomplete",function(e){n.onKeyPress(e)}),n.el.on("keyup.autocomplete",function(e){n.onKeyUp(e)}),n.el.on("blur.autocomplete",function(){n.onBlur()}),n.el.on("focus.autocomplete",function(){n.onFocus()}),n.el.on("change.autocomplete",function(e){n.onKeyUp(e)}),n.el.on("input.autocomplete",function(e){n.onKeyUp(e)})},onFocus:function(){var e=this;e.fixPosition(),e.el.val().length>=e.options.minChars&&e.onValueChange()},onBlur:function(){this.enableKillerFn()},abortAjax:function(){var e=this;e.currentRequest&&(e.currentRequest.abort(),e.currentRequest=null)},setOptions:function(t){var s=this,n=s.options;e.extend(n,t),s.isLocal=e.isArray(n.lookup),s.isLocal&&(n.lookup=s.verifySuggestionsFormat(n.lookup)),n.orientation=s.validateOrientation(n.orientation,"bottom"),e(s.suggestionsContainer).css({"max-height":n.maxHeight+"px",width:n.width+"px","z-index":n.zIndex}),!0===n.showDetailsPanel&&jQuery(s.suggestionsContainer).parent().addClass("dgwt-wcas-is-details"),s.options.onSearchComplete=function(){s.preloader("hide",e("."+n.preloaderClass),"dgwt-wcas-inner-preloader"),s.preloader("show",e("."+n.preloaderClass),n.closeTrigger)}},clearCache:function(){this.cachedResponse={},this.cachedDetails={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){var e=this;e.disabled=!0,clearInterval(e.onChangeInterval),e.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var t=this,s=(t.options,e(t.suggestionsContainer)),n=(e(t.detailsContainer),s.parent().get(0));if(n===document.body||t.options.forceFixPosition){var i=t.options.orientation,o=s.outerHeight(),a=t.el.outerHeight(),l=t.el.offset(),r={top:l.top,left:l.left};if("auto"===i){var u=e(window).height(),c=e(window).scrollTop(),d=-c+l.top-o,g=c+u-(l.top+a+o);i=Math.max(d,g)===d?"top":"bottom"}if(r.top+="top"===i?-o:a,n!==document.body){var h,p=s.css("opacity");t.visible||s.css("opacity",0).show(),h=s.offsetParent().offset(),r.top-=h.top,r.left-=h.left,t.visible||s.css("opacity",p).hide()}"auto"===t.options.width&&(r.width=t.el.outerWidth()-2+"px"),s.css(r)}},fixPositionDetailsBox:function(){var t=e(this.detailsContainer);if(0==t.length)return!1;var s=e(window).width(),n=t.parent(),i=t.prev(),o=t.width(),a=t.offset();n.width()>=550||(s<a.left+o&&(n.removeClass("dgwt-wcas-details-right"),n.addClass("dgwt-wcas-details-left"),t.css("left","-"+t.outerWidth()+"px")),a.left<1&&(n.removeClass("dgwt-wcas-details-left"),n.addClass("dgwt-wcas-details-right"),t.css("left",i.outerWidth()+"px")))},fixHeight:function(t,s){var n=this,i=n.options;if(1!=i.showDetailsPanel)return!1;var s,o=e("."+i.containerClass),a=e("."+i.containerDetailsClass),l=0,r=0;e("."+i.containerClass+"> *").each(function(){l+=e(this).outerHeight()}),e("."+i.containerDetailsClass+"> *").each(function(){r+=e(this).outerHeight()}),((s=l>=r?l:r)>l||s>r)&&(o.css("height",s+"px"),a.css("height",s+"px")),void 0===t&&(t=0),t<5?setTimeout(function(){n.fixHeight(t+1,s)},30):t=0},enableKillerFn:function(){var t=this;e(document).on("click.autocomplete",t.killerFn)},disableKillerFn:function(){var t=this;e(document).off("click.autocomplete",t.killerFn)},killSuggestions:function(){var t=this;e(t.suggestionsContainer).parent();t.stopKillSuggestions(),t.intervalId=window.setInterval(function(){t.visible&&(t.options.preserveInput||t.el.val(t.currentValue),t.hide()),t.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var e,t=this,s=t.el.val().length,n=t.element.selectionStart;return"number"==typeof n?n===s:!document.selection||((e=document.selection.createRange()).moveStart("character",-s),s===e.text.length)},onKeyPress:function(e){var t=this;if(t.disabled||t.visible||e.which!==n.DOWN||!t.currentValue){if(!t.disabled&&t.visible){switch(e.which){case n.ESC:t.el.val(t.currentValue),t.hide();break;case n.RIGHT:if(t.hint&&t.options.onHint&&t.isCursorAtEnd()){t.selectHint();break}return;case n.TAB:if(t.hint&&t.options.onHint)return void t.selectHint();if(-1===t.selectedIndex)return void t.hide();if(t.select(t.selectedIndex),!1===t.options.tabDisabled)return;break;case n.RETURN:if(-1===t.selectedIndex)return void t.hide();t.select(t.selectedIndex);break;case n.UP:t.moveUp();break;case n.DOWN:t.moveDown();break;default:return}e.stopImmediatePropagation(),e.preventDefault()}}else t.suggest()},onKeyUp:function(e){var t=this;if(!t.disabled){switch(e.which){case n.UP:case n.DOWN:return}clearInterval(t.onChangeInterval),t.currentValue!==t.el.val()&&(t.findBestHint(),t.options.deferRequestBy>0?t.onChangeInterval=setInterval(function(){t.onValueChange()},t.options.deferRequestBy):t.onValueChange())}},onValueChange:function(){var t=this,s=t.options,n=t.el.val(),i=t.getQuery(n);t.selection&&t.currentValue!==i&&(t.selection=null,(s.onInvalidateSelection||e.noop).call(t.element)),clearInterval(t.onChangeInterval),t.currentValue=n,t.selectedIndex=-1,s.triggerSelectOnValidInput&&t.isExactMatch(i)?t.select(0):i.length<s.minChars?(e("."+t.options.closeTrigger).removeClass(t.options.closeTrigger),t.hide()):t.getSuggestions(i)},isExactMatch:function(e){var t=this.suggestions;return 1===t.length&&t[0].value.toLowerCase()===e.toLowerCase()},getQuery:function(t){var s,n=this.options.delimiter;return n?(s=t.split(n),e.trim(s[s.length-1])):t},getSuggestionsLocal:function(t){var s,n=this.options,i=t.toLowerCase(),o=n.lookupFilter,a=parseInt(n.lookupLimit,10);return s={suggestions:e.grep(n.lookup,function(e){return o(e,t,i)})},a&&s.suggestions.length>a&&(s.suggestions=s.suggestions.slice(0,a)),s},getSuggestions:function(t){var s,n,i,o,a=this,l=a.options,r=l.serviceUrl;l.params[l.paramName]=t,n=l.ignoreParams?null:l.params,a.preloader("show",e("."+l.preloaderClass),"dgwt-wcas-inner-preloader"),!1!==l.onSearchStart.call(a.element,l.params)&&(e.isFunction(l.lookup)?l.lookup(t,function(e){a.suggestions=e.suggestions,a.suggest(),a.getDetails(e.suggestions[0]),l.onSearchComplete.call(a.element,t,e.suggestions)}):(a.isLocal?s=a.getSuggestionsLocal(t):(e.isFunction(r)&&(r=r.call(a.element,t)),i=r+"?"+e.param(n||{}),s=a.cachedResponse[i]),s&&e.isArray(s.suggestions)?(a.suggestions=s.suggestions,a.suggest(),a.getDetails(s.suggestions[0]),l.onSearchComplete.call(a.element,t,s.suggestions)):a.isBadQuery(t)?l.onSearchComplete.call(a.element,t,[]):(a.abortAjax(),o={url:r,data:n,type:l.type,dataType:l.dataType},e.extend(o,l.ajaxSettings),a.currentRequest=e.ajax(o).done(function(e){var s;a.currentRequest=null,void 0!==(s=l.transformResult(e,t)).suggestions&&(a.processResponse(s,t,i),a.getDetails(s.suggestions[0])),l.onSearchComplete.call(a.element,t,s.suggestions)}).fail(function(e,s,n){l.onSearchError.call(a.element,t,e,s,n)}))))},getDetails:function(t){var s=this,n=s.options;if(1!=n.showDetailsPanel||e(window).width()<992||"ontouchend"in document)return!1;if(null!=t){var i,o,a=e("."+n.containerDetailsClass);s.fixHeight();var l={action:dgwt_wcas.action_result_details,post_id:null!=t.post_id?t.post_id:0,term_id:null!=t.term_id?t.term_id:0,taxonomy:null!=t.taxonomy?t.taxonomy:"",value:null!=t.value?t.value:""};if(i=l.action+l.post_id+l.term_id+l.taxonomy,null!=(o=s.cachedDetails[i]))a.html(o.details),s.fixHeight(),s.fixPositionDetailsBox();else{if(a.html(""),s.preloader("show",a,"",!0),-1!=e.inArray(i,s.detailsRequestsSent))return;s.detailsRequestsSent.push(i),e.ajax({data:l,type:"post",url:dgwt_wcas.ajax_details_endpoint,success:function(e){var t="string"==typeof e?jQuery.parseJSON(e):e;s.cachedDetails[i]=t,s.preloader("hide",a,"",!0),null!=t.details?a.html(t.details):a.html(""),s.fixPositionDetailsBox(),s.fixHeight()},error:function(e,t){s.preloader("hide",a,"",!0),a.html(e),s.fixPositionDetailsBox(),s.fixHeight()}})}}},isBadQuery:function(e){if(!this.options.preventBadQueries)return!1;for(var t=this.badQueries,s=t.length;s--;)if(0===e.indexOf(t[s]))return!0;return!1},hide:function(){var t=this,s=e(t.suggestionsContainer),n=(e(t.detailsContainer),e(t.suggestionsContainer).parent());e.isFunction(t.options.onHide)&&t.visible&&t.options.onHide.call(t.element,s),t.visible=!1,t.selectedIndex=-1,clearInterval(t.onChangeInterval),e(t.suggestionsContainer).hide(),e(t.detailsContainer).hide(),n.removeClass("dgwt-wcas-open"),t.signalHint(null)},suggest:function(){if(this.suggestions.length){var t,s=this,n=s.options,i=n.groupBy,o=n.formatResult,a=s.getQuery(s.currentValue),l=s.classes.suggestion,r=s.classes.selected,u=e(s.suggestionsContainer),c=e(s.detailsContainer),d=e(s.noSuggestionsContainer),g=n.beforeRender,h="",p=function(e,s){var n=e.data[i];return t===n?"":'<div class="autocomplete-group"><strong>'+(t=n)+"</strong></div>"};n.triggerSelectOnValidInput&&s.isExactMatch(a)?s.select(0):(e.each(s.suggestions,function(e,t){var s="",r="",u=!1;i&&(h+=p(t,0)),void 0===t.post_id?(h+='<div class="'+l+' dgwt-wcas-nores" data-index="'+e+'">',h+='<span class="dgwt-wcas-st">'+t.value+"</span>",h+="</div>"):(void 0!==t.parents&&(s=t.parents),!0===n.showImage&&void 0!==t.thumb_html&&(u=!0),r+=void 0!==t.post_id?'data-post-id="'+t.post_id+'" ':"",r+=void 0!==t.taxonomy?'data-taxonomy="'+t.taxonomy+'" ':"",r+=void 0!==t.term_id?'data-term-id="'+t.term_id+'" ':"",h+='<div class="'+l+'" data-index="'+e+'" '+r+">",u&&(h+='<span class="dgwt-wcas-si">'+t.thumb_html+"</span>"),h+=u?'<div class="dgwt-wcas-content-wrapp">':"",h+='<span class="dgwt-wcas-st">',h+="<span>"+o(t.value,a)+s+"</span>",!0===n.showSKU&&void 0!==t.sku&&t.sku.length>0&&(h+='<span class="dgwt-wcas-sku">(SKU: '+o(t.sku,a)+")</span>"),h+="</span>",!0===n.showPrice&&void 0!==t.price&&(h+='<span class="dgwt-wcas-sp">'+t.price+"</span>"),!0===n.showDescription&&void 0!==t.desc&&(h+='<span class="dgwt-wcas-sd">'+o(t.desc,a)+"</span>"),!0===n.showFeaturedBadge&&!0===t.on_sale&&(h+='<span class="dgwt-wcas-badge dgwt-wcas-badge-os">'+n.saleBadgeText+"</span>"),!0===n.showFeaturedBadge&&!0===t.featured&&(h+='<span class="dgwt-wcas-badge dgwt-wcas-badge-f">'+n.featuredBadgeText+"</span>"),h+=u?"</div>":"",h+="</div>")}),this.adjustContainerWidth(),d.detach(),u.html(h),e.isFunction(g)&&g.call(s.element,u,s.suggestions),s.fixPosition(),u.show(),u.parent().addClass("dgwt-wcas-open"),!0===n.showDetailsPanel&&c.show(),n.autoSelectFirst&&(s.selectedIndex=0,u.scrollTop(0),u.children("."+l).first().addClass(r)),s.visible=!0,s.findBestHint())}else this.options.showNoSuggestionNotice?this.noSuggestions():this.hide()},noSuggestions:function(){var t=this,s=e(t.suggestionsContainer),n=e(t.noSuggestionsContainer);this.adjustContainerWidth(),n.detach(),s.empty(),s.append(n),t.fixPosition(),s.show(),t.visible=!0},adjustContainerWidth:function(){var t,s=this,n=s.options,i=e(s.suggestionsContainer).parent(),o=e(s.suggestionsContainer),a=e(s.detailsContainer);if("auto"===n.width&&(t=s.el.outerWidth(),o.css("width",t+"px")),i.width()>=550&&!0===n.showDetailsPanel)return i.addClass("dgwt-wcas-full-width"),o.outerWidth(300),a.innerWidth(i.width()-300),i.removeClass("dgwt-wcas-details-left"),i.removeClass("dgwt-wcas-details-right"),void(!0===n.is_rtl?(a.css("left","0"),o.css("right","0")):(a.css("right","0"),o.css("left","0")));"left"===n.cointainerDetailsPos?(a.parent().addClass("dgwt-wcas-details-left"),a.css("left","-"+a.outerWidth()+"px")):(a.parent().addClass("dgwt-wcas-details-right"),a.css("left",i.outerWidth()+"px"))},findBestHint:function(){var t=this,s=t.el.val().toLowerCase(),n=null;s&&(e.each(t.suggestions,function(e,t){var i=0===t.value.toLowerCase().indexOf(s);return i&&(n=t),!i}),t.signalHint(n))},signalHint:function(t){var s="",n=this;t&&(s=n.currentValue+t.value.substr(n.currentValue.length)),n.hintValue!==s&&(n.hintValue=s,n.hint=t,(this.options.onHint||e.noop)(s))},preloader:function(t,s,n,i){var o,a="dgwt-wcas-preloader-wrapp",l=null==n?a:a+" "+n;1==dgwt_wcas.show_preloader&&0!=s.length&&(!0===i?"hide"!==t?"show"===t&&(o='<div class="'+l+'"><div class="dgwt-wcas-default-preloader"></div></div>',s.html(o)):e(a).remove():"hide"===t?s.removeClass(n):s.addClass(n))},verifySuggestionsFormat:function(t){return t.length&&"string"==typeof t[0]?e.map(t,function(e){return{value:e,data:null}}):t},validateOrientation:function(t,s){return t=e.trim(t||"").toLowerCase(),-1===e.inArray(t,["auto","bottom","top"])&&(t=s),t},processResponse:function(e,t,s){var n=this,i=n.options;e.suggestions=n.verifySuggestionsFormat(e.suggestions),i.noCache||(n.cachedResponse[s]=e,i.preventBadQueries&&!e.suggestions.length&&n.badQueries.push(t)),t===n.getQuery(n.currentValue)&&(n.suggestions=e.suggestions,n.suggest())},activate:function(t){var s,n=this,i=n.classes.selected,o=e(n.suggestionsContainer),a=o.find("."+n.classes.suggestion);return o.find("."+i).removeClass(i),n.selectedIndex=t,-1!==n.selectedIndex&&a.length>n.selectedIndex?(s=a.get(n.selectedIndex),e(s).addClass(i),s):null},selectHint:function(){var t=this,s=e.inArray(t.hint,t.suggestions);t.select(s)},select:function(e){var t=this;t.hide(),t.onSelect(e),t.disableKillerFn()},moveUp:function(){var t=this;if(-1!==t.selectedIndex)return 0===t.selectedIndex?(e(t.suggestionsContainer).children().first().removeClass(t.classes.selected),t.selectedIndex=-1,t.el.val(t.currentValue),void t.findBestHint()):void t.adjustScroll(t.selectedIndex-1)},moveDown:function(){var e=this;e.selectedIndex!==e.suggestions.length-1&&e.adjustScroll(e.selectedIndex+1)},adjustScroll:function(t){var s=this,n=s.activate(t);if(n){var i,o,a,l=e(n).outerHeight();i=n.offsetTop,a=(o=e(s.suggestionsContainer).scrollTop())+s.options.maxHeight-l,i<o?e(s.suggestionsContainer).scrollTop(i):i>a&&e(s.suggestionsContainer).scrollTop(i-s.options.maxHeight+l),s.options.preserveInput||s.el.val(s.getValue(s.suggestions[t].value)),s.signalHint(null)}},onSelect:function(t){var s=this,n=s.options.onSelect,i=s.suggestions[t];s.currentValue=s.getValue(i.value),s.currentValue===s.el.val()||s.options.preserveInput||s.el.val(s.currentValue),-1!=i.id&&(window.location.href=i.url),s.signalHint(null),s.suggestions=[],s.selection=i,e.isFunction(n)&&n.call(s.element,i)},onMouseOver:function(t){var s=this,n=s.options.onMouseOver,i=s.suggestions[t];s.selectedIndex!==t&&s.getDetails(i),e.isFunction(n)&&n.call(s.element,i)},onMouseLeave:function(t){var s=this,n=s.options.onMouseLeave,i=s.suggestions[t];e.isFunction(n)&&n.call(s.element,i)},getValue:function(e){var t,s,n=this,i=n.options.delimiter;return i?(t=n.currentValue,s=t.split(i),1===s.length?e:t.substr(0,t.length-s[s.length-1].length)+e):e},dispose:function(){var t=this;t.el.off(".autocomplete").removeData("autocomplete"),t.disableKillerFn(),e(window).off("resize.autocomplete",t.fixPositionCapture),e(t.suggestionsContainer).remove()}},e.fn.dgwtWcasAutocomplete=function(s,n){return arguments.length?this.each(function(){var i=e(this),o=i.data("autocomplete");"string"==typeof s?o&&"function"==typeof o[s]&&o[s](n):(o&&o.dispose&&o.dispose(),o=new t(this,s),i.data("autocomplete",o))}):this.first().data("autocomplete")},function(){e(document).ready(function(){e(".dgwt-wcas-search-submit").length>0&&e(".dgwt-wcas-preloader").css("right",e(".dgwt-wcas-search-submit").outerWidth()+"px");var t=1==dgwt_wcas.show_details_box;(jQuery(window).width()<992||"ontouchend"in document)&&(t=!1),e(".dgwt-wcas-search-input").dgwtWcasAutocomplete({minChars:dgwt_wcas.min_chars,width:dgwt_wcas.sug_width,autoSelectFirst:!1,triggerSelectOnValidInput:!1,serviceUrl:dgwt_wcas.ajax_search_endpoint,paramName:"dgwt_wcas_keyword",showDetailsPanel:t,showImage:1==dgwt_wcas.show_images,showPrice:1==dgwt_wcas.show_price,showDescription:1==dgwt_wcas.show_desc,showSKU:1==dgwt_wcas.show_sku,showSaleBadge:1==dgwt_wcas.show_sale_badge,showFeaturedBadge:1==dgwt_wcas.show_featured_badge,saleBadgeText:dgwt_wcas.t.sale_badge,featuredBadgeText:dgwt_wcas.t.featured_badge,cointainerDetailsPos:dgwt_wcas.details_box_pos,is_rtl:1==dgwt_wcas.is_rtl})})}()});
 
backward-compatibility/1-1-7/search-form.php DELETED
@@ -1,97 +0,0 @@
1
- <?php
2
-
3
- use DgoraWcas\Helpers;
4
-
5
- // Exit if accessed directly
6
- if ( !defined( 'DGWT_WCAS_FILE' ) ) {
7
- exit;
8
- }
9
-
10
- /*
11
- * Add css classes to search form
12
- *
13
- * @param array $args (shortcode args)
14
- * @return string
15
- */
16
- if(!function_exists('dgwt_wcas_search_css_classes_1_1_7')) {
17
- function dgwt_wcas_search_css_classes_1_1_7($args = array())
18
- {
19
-
20
- $classes = array();
21
-
22
- if (DGWT_WCAS()->settings->getOption('show_details_box') === 'on') {
23
- $classes[] = 'dgwt-wcas-is-detail-box';
24
- }
25
-
26
- if (DGWT_WCAS()->settings->getOption('show_submit_button') !== 'on') {
27
- $classes[] = 'dgwt-wcas-no-submit';
28
- }
29
-
30
- if (isset($args['class']) && ! empty($args['class'])) {
31
- $classes[] = esc_html($args['class']);
32
- }
33
-
34
- if (is_rtl()) {
35
- $classes[] = 'dgwt_wcas_rtl';
36
- }
37
-
38
- return implode(' ', $classes);
39
- }
40
- }
41
-
42
- if(!function_exists('dgwt_wcas_print_ico_loupe_1_1_7')) {
43
- function dgwt_wcas_print_ico_loupe_1_1_7()
44
- {
45
- ?>
46
- <svg version="1.1" class="dgwt-wcas-ico-loupe" xmlns="http://www.w3.org/2000/svg"
47
- xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
48
- viewBox="0 0 51.539 51.361" enable-background="new 0 0 51.539 51.361" xml:space="preserve">
49
- <path d="M51.539,49.356L37.247,35.065c3.273-3.74,5.272-8.623,5.272-13.983c0-11.742-9.518-21.26-21.26-21.26
50
- S0,9.339,0,21.082s9.518,21.26,21.26,21.26c5.361,0,10.244-1.999,13.983-5.272l14.292,14.292L51.539,49.356z M2.835,21.082
51
- c0-10.176,8.249-18.425,18.425-18.425s18.425,8.249,18.425,18.425S31.436,39.507,21.26,39.507S2.835,31.258,2.835,21.082z"/>
52
- </svg>
53
- <?php
54
- }
55
- }
56
-
57
- $submit_text = Helpers::getLabel('submit');
58
- $has_submit = DGWT_WCAS()->settings->getOption( 'show_submit_button' );
59
-
60
- ?>
61
- <div class="dgwt-wcas-search-wrapp <?php echo dgwt_wcas_search_css_classes_1_1_7( $args ); ?>">
62
- <form class="dgwt-wcas-search-form" role="search" action="<?php echo esc_url( home_url( '/' ) ) ?>" method="get">
63
- <div class="dgwt-wcas-sf-wrapp">
64
-
65
- <?php
66
- if($has_submit !== 'on'){
67
- dgwt_wcas_print_ico_loupe_1_1_7();
68
- }
69
- ?>
70
- <label class="screen-reader-text" for="dgwt-wcas-search"><?php _e( 'Products search', 'ajax-search-for-woocommerce' ) ?></label>
71
-
72
- <input
73
- type="search"
74
- class="dgwt-wcas-search-input"
75
- name="s"
76
- value="<?php echo get_search_query() ?>"
77
- placeholder="<?php echo Helpers::getLabel('search_placeholder'); ?>"
78
- />
79
- <div class="dgwt-wcas-preloader"></div>
80
-
81
- <?php if($has_submit === 'on'): ?>
82
- <button type="submit" class="dgwt-wcas-search-submit"><?php echo empty( $submit_text ) ? dgwt_wcas_print_ico_loupe_1_1_7() : esc_html( $submit_text ); ?></button>
83
- <?php endif; ?>
84
-
85
- <input type="hidden" name="post_type" value="product" />
86
- <input type="hidden" name="dgwt_wcas" value="1" />
87
-
88
- <?php
89
- // WPML compatible
90
- if ( defined( 'ICL_LANGUAGE_CODE' ) ):
91
- ?>
92
- <input type="hidden" name="lang" value="<?php echo( ICL_LANGUAGE_CODE ); ?>" />
93
- <?php endif ?>
94
-
95
- </div>
96
- </form>
97
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backward-compatibility/1-1-7/style.css DELETED
@@ -1,825 +0,0 @@
1
-
2
-
3
- .dgwt-wcas-search-wrapp {
4
- position: relative;
5
- display: inline-block;
6
- color: #444;
7
- min-width: 300px;
8
- max-width: 600px;
9
- width: 100%;
10
- text-align: left;
11
- }
12
- .widget .dgwt-wcas-search-wrapp {
13
- display: block;
14
- }
15
-
16
- .dgwt-wcas-search-wrapp .product-title{
17
- color: #333;
18
- display: block;
19
- line-height: 110%;
20
- margin: 0;
21
- }
22
- .dgwt-wcas-tpd-image img{
23
- margin: 0 15px 0 0!important;
24
- display: block;
25
- }
26
- .dgwt_wcas_rtl .dgwt-wcas-tpd-image img {
27
- margin: 0 0 0 15px!important;
28
- }
29
-
30
-
31
- .dgwt-wcas-default-preloader * {
32
- box-sizing: border-box;
33
- -o-box-sizing: border-box;
34
- -ms-box-sizing: border-box;
35
- -webkit-box-sizing: border-box;
36
- -moz-box-sizing: border-box;
37
- }
38
-
39
- .dgwt-wcas-default-preloader {
40
- width: 1em;
41
- height: 1em;
42
- font-size: 169px;
43
- position: relative;
44
- display:block;
45
- margin: 56px auto;
46
- }
47
-
48
- .dgwt-wcas-default-preloader:before, .dgwt-wcas-default-preloader:after {
49
- content: "";
50
- top: 0;
51
- display: block;
52
- width: 1em;
53
- height: 1em;
54
- position: absolute;
55
- border-width: 0.503em;
56
- border-style: double;
57
- border-color: transparent;
58
- border-radius: 1em;
59
- box-sizing: border-box;
60
- -o-box-sizing: border-box;
61
- -ms-box-sizing: border-box;
62
- -webkit-box-sizing: border-box;
63
- -moz-box-sizing: border-box;
64
- animation: dgwt-wcas-spin 0.8s infinite;
65
- -o-animation: dgwt-wcas-spin 0.8s infinite;
66
- -ms-animation: dgwt-wcas-spin 0.8s infinite;
67
- -webkit-animation: dgwt-wcas-spin 0.8s infinite;
68
- -moz-animation: dgwt-wcas-spin 0.8s infinite;
69
- }
70
- .dgwt-wcas-default-preloader:after {
71
- left: 0;
72
- border-left-color: rgba(0,0,0,0.05);
73
- }
74
- .dgwt-wcas-default-preloader:before {
75
- right: 0;
76
- border-right-color: rgba(0,0,0,0.02);
77
- animation-delay: -0.2025s;
78
- -o-animation-delay: -0.2025s;
79
- -ms-animation-delay: -0.2025s;
80
- -webkit-animation-delay: -0.2025s;
81
- -moz-animation-delay: -0.2025s;
82
- }
83
-
84
- @keyframes dgwt-wcas-spin {
85
- from {
86
- transform: rotate(360deg);
87
- }
88
- }
89
-
90
- @-o-keyframes dgwt-wcas-spin {
91
- from {
92
- -o-transform: rotate(360deg);
93
- }
94
- }
95
-
96
- @-ms-keyframes dgwt-wcas-spin {
97
- from {
98
- -ms-transform: rotate(360deg);
99
- }
100
- }
101
-
102
- @-webkit-keyframes dgwt-wcas-spin {
103
- from {
104
- -webkit-transform: rotate(360deg);
105
- }
106
- }
107
-
108
- @-moz-keyframes dgwt-wcas-spin {
109
- from {
110
- -moz-transform: rotate(360deg);
111
- }
112
- }
113
- .dgwt-wcas-preloader-wrapp img {
114
- margin: 10px auto 0 auto;
115
- display: block;
116
- max-width: 200px;
117
- }
118
-
119
- .dgwt-wcas-suggestions-wrapp {
120
- background: #fff none repeat scroll 0 0;
121
- border: 1px solid #ddd;
122
- border-top: none;
123
- padding: 0;
124
- -webkit-box-sizing: border-box;
125
- -moz-box-sizing: border-box;
126
- box-sizing: border-box;
127
- overflow-y: auto;
128
- }
129
-
130
- .dgwt-wcas-is-detail-box .dgwt-wcas-suggestions-wrapp {
131
- max-width: 550px;
132
- }
133
- .dgwt-wcas-full-width.dgwt-wcas-is-detail-box .dgwt-wcas-suggestion{
134
- padding: 8px 15px;
135
- }
136
-
137
- .dgwt-wcas-details-left .dgwt-wcas-suggestions-wrapp {
138
- border-radius: 0 0 5px 0;
139
- border-left-color: #eee;
140
- }
141
-
142
- .dgwt-wcas-details-right .dgwt-wcas-suggestions-wrapp {
143
- border-radius: 5px 0 0 5px;
144
- border-right-color: #eee;
145
- }
146
-
147
-
148
- .dgwt-wcas-suggestion {
149
- cursor: pointer;
150
- font-size: 12px;
151
- line-height: 110%;
152
- text-align: left;
153
- padding: 7px 0;
154
- position: relative;
155
- border-bottom: 1px solid #dfdfdf;
156
- display: flex;
157
- flex-direction: column;
158
- justify-content: center;
159
- resize: vertical;
160
- }
161
- .dgwt-wcas-suggestion:after {
162
- clear: both;
163
- display: block;
164
- content: '';
165
- }
166
-
167
- .dgwt-wcas-suggestion.dgwt-wcas-nores {
168
- cursor: default;
169
- opacity: 0.5;
170
- }
171
-
172
- .dgwt-wcas-has-img .dgwt-wcas-suggestion {
173
- padding: 12px 0;
174
- }
175
-
176
- .dgwt-wcas-st {
177
- padding-left: 10px;
178
- display: block;
179
- color: #444;
180
- font-size: 15px;
181
- }
182
- .dgwt-wcas-has-price .dgwt-wcas-st {
183
- padding-right: 80px;
184
- }
185
-
186
- .dgwt-wcas-sku {
187
- font-size: 80%;
188
- margin-left: 6px;
189
- }
190
- .dgwt-wcas-st > span {
191
- display: inline-block;
192
- vertical-align: middle;
193
- }
194
-
195
- .dgwt-wcas-si {
196
- position: absolute;
197
- left: 10px;
198
- top: 0;
199
- width: 50px;
200
- display: block;
201
- height: 100%;
202
- min-height: 50px;
203
- }
204
-
205
- .dgwt-wcas-si img {
206
- background: #fff none repeat scroll 0 0;
207
- border: 1px solid #e8e8e8;
208
- border-radius: 3px;
209
- bottom: 0;
210
- display: block;
211
- margin: auto;
212
- padding: 2px;
213
- position: absolute;
214
- top: 0;
215
- width: 50px;
216
- }
217
- .dgwt-wcas-content-wrapp {
218
- padding-left: 60px;
219
- }
220
-
221
-
222
- .dgwt-wcas-sp {
223
- color: #555;
224
- font-size: 14px;
225
- position: absolute;
226
- right: 10px;
227
- top: 5px;
228
- vertical-align: middle;
229
- line-height: 120%;
230
- text-align: right;
231
- }
232
-
233
- .dgwt-wcas-search-form {
234
- margin: 0;
235
- padding: 0;
236
- }
237
-
238
- .dgwt-wcas-sp del {
239
- opacity: 0.5;
240
- font-size: 12px;
241
- }
242
-
243
- .dgwt-wcas-sd {
244
- color: #777;
245
- display: block;
246
- padding-left: 15px;
247
- line-height: 14px;
248
- padding-right: 60px;
249
- margin-top: 5px;
250
- }
251
-
252
- .dgwt-wcas-suggestion-selected {
253
- background-color: #e9e9e9;
254
- }
255
- .dgwt-wcas-suggestion-selected:first-child {
256
- border-top:none;
257
- }
258
-
259
- .dgwt_wcas_rtl .dgwt-wcas-suggestion {
260
- padding-left: 0;
261
- padding-right: 15px;
262
- text-align: right;
263
- }
264
-
265
- .dgwt-wcas-full-width .dgwt-wcas-suggestion{
266
- font-size: 15px;
267
- padding: 5px 15px;
268
- }
269
-
270
- .dgwt-wcas-details-wrapp {
271
- background: #fff none repeat scroll 0 0;
272
- border: 1px solid #ddd;
273
- border-top: none;
274
- padding: 0;
275
- width: 300px;
276
- height: 340px;
277
- -webkit-box-sizing: border-box;
278
- -moz-box-sizing: border-box;
279
- box-sizing: border-box;
280
- z-index: 100;
281
- min-height: 340px;
282
- }
283
-
284
- .dgwt-wcas-details-right .dgwt-wcas-details-wrapp {
285
- border-left: none;
286
- border-radius: 0 5px 5px 0;
287
- }
288
-
289
- .dgwt-wcas-details-left .dgwt-wcas-details-wrapp {
290
- border-right: none;
291
- border-radius: 5px 0 0 5px;
292
- }
293
-
294
-
295
- .dgwt-wcas-full-width .dgwt-wcas-suggestions-wrapp {
296
- border-radius: 0 0 0 5px;
297
- }
298
- .dgwt-wcas-full-width .dgwt-wcas-details-wrapp {
299
- border-radius: 0 0 5px 0;
300
- }
301
-
302
- .dgwt-wcas-details-inner {
303
- padding: 15px 10px;
304
- }
305
-
306
-
307
- .woocommerce .dgwt-wcas-pd-rating .star-rating {
308
- float: left;
309
- margin-right: 5px;
310
- font-size: 12px;
311
- color: #CCAE72;
312
- }
313
- .woocommerce.dgwt_wcas_rtl .dgwt-wcas-pd-rating .star-rating {
314
- float: right;
315
- margin-left: 5px;
316
- margin-right: 0;
317
- }
318
-
319
- .dgwt-wcas-datails-title{
320
- border-bottom: 1px dashed #eee;
321
- display: block;
322
- margin-bottom: 15px;
323
- padding-bottom: 5px;
324
- font-size: 14px;
325
- }
326
- .dgwt-wcas-pd-title {
327
- border-bottom: 1px dashed #eee;
328
- margin-bottom: 15px;
329
- padding-bottom: 5px;
330
- display: block;
331
- color: #202020;
332
- text-decoration: none;
333
- }
334
- .dgwt-wcas-pd-title .product-title {
335
- font-weight: 900;
336
- color: #202020;
337
- text-transform: uppercase;
338
- letter-spacing: -1px;
339
- margin: 0;
340
- }
341
-
342
-
343
- .dgwt-wcas-details-title-tax {
344
- text-transform: uppercase;
345
- font-weight: 900;
346
- letter-spacing: -1px;
347
- margin-right: 3px;
348
- }
349
-
350
- .dgwt-wcas-tax-product-details {
351
- margin-bottom: 15px;
352
- display: block;
353
- text-decoration: none;
354
- }
355
-
356
- .dgwt-wcas-tax-product-details:after {
357
- content: '';
358
- clear: both;
359
- display: block;
360
- }
361
-
362
- .dgwt-wcas-details-wrapp .dgwt-wcas-pd-title {
363
- margin-bottom: 8px;
364
- }
365
- .dgwt-wcas-pd-rest {
366
- display: flex;
367
- flex-direction: column;
368
- float: left;
369
- height: 68px;
370
- justify-content: center;
371
- width: 190px;
372
- }
373
- .dgwt-wcas-tpd-image {
374
- float: left;
375
- width: 60px;
376
- margin-right: 15px;
377
- }
378
- .dgwt-wcas-tpd-rest {
379
- float: left;
380
- max-width: 200px;
381
- }
382
-
383
- .dgwt-wcas-tpd-rest .product-title{
384
- display: block;
385
- line-height: 13px;
386
- font-size: 13px;
387
- font-weight: 500;
388
- letter-spacing: 0;
389
- margin: 0 0 8px;
390
- overflow: hidden;
391
- text-overflow: ellipsis;
392
- text-transform: uppercase;
393
- white-space: nowrap;
394
- width: 145px;
395
- }
396
-
397
-
398
- .dgwt-wcas-pd-price {
399
- margin-top: 10px;
400
- font-size: 14px;
401
- line-height: 13px;
402
- overflow: hidden;
403
- text-overflow: ellipsis;
404
- white-space: nowrap;
405
- width: 145px;
406
- color: #777;
407
- margin-top: 5px;
408
- font-weight: lighter;
409
- }
410
-
411
- .dgwt-wcas-pd-price del .amount {
412
- font-weight: lighter;
413
- background: transparent;
414
- font-size: 90%;
415
- opacity: 0.6;
416
- }
417
- .dgwt-wcas-pd-price ins {
418
- background: transparent;
419
- text-decoration: none;
420
- }
421
- .dgwt-wcas-pd-rating {
422
- font-size: 13px;
423
- line-height: 13px;
424
- }
425
- .dgwt-wcas-pd-rating:after {
426
- content: '';
427
- clear: both;
428
- display: block;
429
- }
430
-
431
- .dgwt-wcas-pd-review {
432
- color: #777;
433
- font-size: 11px;
434
- line-height: 11px;
435
- }
436
-
437
- .dgwt-wcas-datails-title{
438
- border-bottom: 1px dashed #eee;
439
- display: block;
440
- margin:5px 0 15px 0;
441
- padding-bottom: 5px;
442
- }
443
- .dgwt-wcas-pd-title {
444
- border-bottom: 1px dashed #eee;
445
- margin-bottom: 15px;
446
- padding-bottom: 5px;
447
- display: block;
448
-
449
- text-decoration: none;
450
- }
451
- .dgwt-wcas-pd-title .product-title {
452
- font-weight: 900;
453
-
454
- text-transform: uppercase;
455
- letter-spacing: -1px;
456
- }
457
-
458
-
459
- .dgwt-wcas-details-title-tax {
460
- text-transform: uppercase;
461
- font-weight: 900;
462
- letter-spacing: -1px;
463
- margin-right: 3px;
464
-
465
- }
466
- .dgwt_wcas_rtl .dgwt-wcas-details-title-tax {
467
- margin: 0 0 0 3px;
468
- float: right;
469
- }
470
-
471
- .dgwt-wcas-tax-product-details {
472
- margin-bottom: 15px;
473
- display: block;
474
- }
475
-
476
- .dgwt-wcas-tax-product-details:after, .dgwt-wcas-pd-details:after {
477
- content: '';
478
- clear: both;
479
- display: block;
480
- }
481
-
482
- .dgwt-wcas-tpd-image, .dgwt-wcas-pd-image {
483
- float: left;
484
- width: 70px;
485
- margin-right: 15px;
486
- padding: 4px;
487
- background-color: #fff;
488
- border:1px solid #e8e8e8;
489
- border-radius: 4px;
490
- }
491
- .dgwt-wcas-tpd-image img, .dgwt-wcas-pd-image img{
492
- display: block;
493
- max-width: 100%;
494
- }
495
-
496
- .dgwt_wcas_rtl .dgwt-wcas-tpd-image, .dgwt_wcas_rtl .dgwt-wcas-pd-image{
497
- float: right;
498
- margin-right: 0;
499
- margin-left: 15px;
500
- }
501
-
502
- .dgwt_wcas_rtl .dgwt-wcas-tpd-rest, .dgwt_wcas_rtl .dgwt-wcas-pd-rest {
503
- float: right;
504
- max-width: 200px;
505
- }
506
-
507
- input[type="search"].dgwt-wcas-search-input,
508
- input[type="text"].dgwt-cas-search-input {
509
- -webkit-transition: none;
510
- -moz-transition: none;
511
- -ms-transition: none;
512
- -o-transition: none;
513
- transition: none;
514
- -webkit-box-shadow: none;
515
- box-shadow: none;
516
- margin: 0;
517
- }
518
-
519
- .dgwt-wcas-pd-desc {
520
- font-size: 13px;
521
- line-height: 130%;
522
- margin: 12px 0;
523
- }
524
-
525
- .dgwt-wcas-pd-addtc {
526
- margin: 10px;
527
- text-align: right;
528
- }
529
-
530
- .dgwt-wcas-pd-addtc a {
531
- margin-bottom: 5px;
532
- }
533
-
534
-
535
- input[type="submit"].dgwt-wcas-search-submit, button.dgwt-wcas-search-submit{
536
- position: relative;
537
- }
538
-
539
-
540
- .dgwt-wcas-ico-loupe {
541
- bottom: 0;
542
- left: 0;
543
- margin: auto;
544
- position: absolute;
545
- right: 0;
546
- top: 0;
547
- height: 65%;
548
- display: block;
549
- }
550
- .dgwt-wcas-preloader {
551
- cursor: pointer;
552
- height: 100%;
553
- position: absolute;
554
- right: 0;
555
- top: 0;
556
- width: 40px;
557
- z-index: 1;
558
- background-repeat: no-repeat;
559
- background-position: right 15px center;
560
- background-size: auto 44%;
561
- }
562
- .dgwt-wcas-inner-preloader {
563
- background-image: url('img/preloader.png');
564
- background-repeat: no-repeat;
565
- background-position: right 15px center;
566
- background-size: auto 22px;
567
- }
568
-
569
- .dgwt-wcas-close{
570
- background-image: url('img/close.png');
571
- background-repeat: no-repeat;
572
- background-position: right 15px center;
573
- background-size: auto 18px;
574
- opacity: 0.6;
575
- -webkit-transition: all 160ms ease-in-out;
576
- -moz-transition: all 160ms ease-in-out;
577
- -ms-transition: all 160ms ease-in-out;
578
- -o-transition: all 160ms ease-in-out;
579
- transition: all 160ms ease-in-out;
580
- }
581
-
582
- .dgwt-wcas-close:hover {
583
- opacity: 0.3;
584
- }
585
-
586
- @media screen and (max-width: 992px) {
587
- .dgwt-wcas-is-detail-box .dgwt-wcas-suggestions-wrapp {
588
- max-width: none;
589
- }
590
- }
591
-
592
- .dgwt-wcas-suggestion strong{
593
- font-weight: bold;
594
- }
595
-
596
- .screen-reader-text {
597
- clip: rect(1px, 1px, 1px, 1px);
598
- height: 1px;
599
- overflow: hidden;
600
- position: absolute !important;
601
- width: 1px;
602
- }
603
- .dgwt-wcas-sf-wrapp:before, .dgwt-wcas-sf-wrapp:after {
604
- content:"";
605
- display:table;
606
- }
607
- .dgwt-wcas-sf-wrapp:after {
608
- clear:both;
609
- }
610
- .dgwt-wcas-sf-wrapp {
611
- zoom:1;
612
- width: 100%;
613
- margin: 0;
614
- position: relative;
615
- background: #444;
616
- background: rgba(0,0,0,.2);
617
- }
618
-
619
- .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input{
620
- width: 100%;
621
- height: 40px;
622
- padding: 10px 15px;
623
- border: 0;
624
- background: #fff;
625
- border:1px solid #ddd;
626
- border-radius: 3px;
627
- -webkit-border-radius:3px;
628
- -webkit-appearance: none;
629
- }
630
- .dgwt-wcas-open .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
631
- border-radius: 3px 3px 0 0;
632
- }
633
-
634
- .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:focus {
635
- outline: 0;
636
- background: #fff;
637
- box-shadow: 0 0 8px 1px rgba(0,0,0,.1);
638
- }
639
-
640
- .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input::-webkit-input-placeholder {
641
- color: #999;
642
- font-weight: normal;
643
- font-style: italic;
644
- }
645
- .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:-moz-placeholder {
646
- color: #999;
647
- font-weight: normal;
648
- font-style: italic;
649
- }
650
-
651
- .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input::-moz-placeholder {
652
- color: #999;
653
- font-weight: normal;
654
- font-style: italic;
655
- }
656
-
657
- .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:-ms-input-placeholder {
658
- color: #999;
659
- font-weight: normal;
660
- font-style: italic;
661
- }
662
-
663
- /* Form submit button */
664
- .dgwt-wcas-sf-wrapp button.dgwt-wcas-search-submit {
665
- overflow: visible;
666
- position: absolute;
667
- border: 0;
668
- padding: 0;
669
- margin: 0;
670
- cursor: pointer;
671
- height: 40px;
672
- min-width: 50px;
673
- right: 0;
674
- top: 0;
675
- padding: 0 15px;
676
- color: #fff;
677
- -webkit-transition: all 250ms ease-in-out;
678
- -moz-transition: all 250ms ease-in-out;
679
- -ms-transition: all 250ms ease-in-out;
680
- -o-transition: all 250ms ease-in-out;
681
- transition: all 250ms ease-in-out;
682
- text-transform: uppercase;
683
- background-color: #96588A;
684
- border-radius: 0 2px 2px 0;
685
- -webkit-border-radius:0 2px 2px 0;
686
- text-shadow: 0 -1px 0 rgba(0, 0 ,0, .3);
687
- -webkit-box-shadow: none;
688
- box-shadow: none;
689
- -webkit-appearance: none;
690
- }
691
- .dgwt-wcas-open .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit{
692
- border-radius: 0 2px 0 0;
693
- }
694
-
695
- .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:hover{
696
- opacity: 0.7;
697
- }
698
-
699
- .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:active,
700
- .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:focus{
701
- opacity: 0.7;
702
- outline: 0;
703
- }
704
-
705
- .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:before { /* left arrow */
706
- content: '';
707
- position: absolute;
708
- border-width: 8px 8px 8px 0;
709
- border-style: solid solid solid none;
710
- border-color: transparent #96588A transparent;
711
- top: 12px;
712
- left: -6px;
713
- -webkit-transition: all 250ms ease-in-out;
714
- -moz-transition: all 250ms ease-in-out;
715
- -ms-transition: all 250ms ease-in-out;
716
- -o-transition: all 250ms ease-in-out;
717
- transition: all 250ms ease-in-out;
718
- }
719
-
720
- .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:hover:before{
721
- border-right-color: #96588A;
722
- }
723
-
724
- .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:focus:before,
725
- .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:active:before{
726
- border-right-color: #96588A;
727
- }
728
-
729
- .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit::-moz-focus-inner { /* remove extra button spacing for Mozilla Firefox */
730
- border: 0;
731
- padding: 0;
732
- }
733
-
734
- .dgwt-wcas-ico-loupe {
735
- fill:#fff;
736
- }
737
-
738
- .dgwt-wcas-has-img .dgwt-wcas-suggestion {
739
- min-height: 60px;
740
- }
741
- .dgwt-wcas-details-inner .added_to_cart {
742
- display: block;
743
- }
744
-
745
- /*------------------------------------------------------
746
- Has image
747
- ---------------------------------------------------------*/
748
- .dgwt-wcas-has-img .dgwt-wcas-sp > *,
749
- .dgwt-wcas-has-desc .dgwt-wcas-sp > *{
750
- display: block;
751
- }
752
- .dgwt-wcas-has-img .dgwt-wcas-sp,
753
- .dgwt-wcas-has-desc .dgwt-wcas-sp{
754
- top: 12px;
755
- }
756
-
757
- /*------------------------------------------------------
758
- Specific styles for Details panel
759
- ---------------------------------------------------------*/
760
- .dgwt-wcas-is-details .dgwt-wcas-content-wrapp{
761
- display: flex;
762
- flex-direction: column;
763
- height: 100%;
764
- justify-content: center;
765
- resize: vertical;
766
- padding-left: 20px;
767
- }
768
-
769
- .dgwt-wcas-is-details .dgwt-wcas-suggestions-wrapp {
770
- min-height: 340px;
771
- }
772
-
773
- .dgwt-wcas-is-details .dgwt-wcas-has-img .dgwt-wcas-suggestion {
774
- min-height: 40px;
775
- }
776
- .dgwt-wcas-is-details .dgwt-wcas-suggestions-wrapp {
777
- overflow: visible;
778
- }
779
- .dgwt-wcas-is-details .dgwt-wcas-si{
780
- min-height: 40px;
781
- }
782
-
783
- .dgwt-wcas-is-details .dgwt-wcas-si img {
784
- width: 30px;
785
- max-width: 100%;
786
- }
787
- .dgwt-wcas-is-details .dgwt-wcas-sp {
788
- display: flex;
789
- top: 0;
790
- flex-direction: column;
791
- height: 100%;
792
- justify-content: center;
793
- resize: vertical;
794
- }
795
- .dgwt-wcas-is-details .dgwt-wcas-sd {
796
- color: #777;
797
- font-size: 11px;
798
- line-height: 100%;
799
- }
800
- .dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy='product_cat'],
801
- .dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy='product_tag']{
802
- padding-left: 15px;
803
- min-height: 0;
804
- }
805
- .dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy='product_cat'] .dgwt-wcas-st,
806
- .dgwt-wcas-has-img .dgwt-wcas-suggestion[data-taxonomy='product_tag'] .dgwt-wcas-st{
807
- padding-left: 0;
808
- }
809
-
810
- .dgwt-wcas-no-submit .dgwt-wcas-ico-loupe {
811
- height: 50%;
812
- left: 12px;
813
- right: auto;
814
- opacity: 0.5;
815
- max-height: 22px;
816
- fill:#000;
817
- }
818
-
819
- .dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
820
- padding: 10px 15px 10px 40px;
821
- }
822
-
823
- .dgwt-wcas-pd-addtc .quantity {
824
- display: none;
825
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fs/config.php CHANGED
@@ -1,5 +1,9 @@
1
  <?php
2
 
 
 
 
 
3
  // Create a helper function for easy SDK access.
4
  function dgoraAsfwFs()
5
  {
1
  <?php
2
 
3
+ // Exit if accessed directly
4
+ if ( !defined( 'ABSPATH' ) ) {
5
+ exit;
6
+ }
7
  // Create a helper function for easy SDK access.
8
  function dgoraAsfwFs()
9
  {
includes/Admin/Install.php CHANGED
@@ -33,7 +33,6 @@ class Install
33
  }
34
  self::saveActivationDate();
35
  self::createOptions();
36
- self::backwardCompatibility();
37
  // Update plugin version
38
  update_option( 'dgwt_wcas_version', DGWT_WCAS_VERSION );
39
  }
@@ -77,50 +76,6 @@ class Install
77
  }
78
  }
79
 
80
- /**
81
- * Set options for backward compatibility
82
- *
83
- * @return void
84
- */
85
- private static function backwardCompatibility()
86
- {
87
- $lastVersion = get_option( 'dgwt_wcas_version' );
88
- // New install? stop it
89
- if ( empty($lastVersion) ) {
90
- return;
91
- }
92
- $bcVersion = get_option( 'dgwt_wcas_backward_compatibility_version' );
93
- $backwardCompatibility = get_option( 'dgwt_wcas_backward_compatibility' );
94
- if ( DGWT_WCAS_VERSION === $bcVersion ) {
95
- return;
96
- }
97
- // If backward compatibility version is not set, last plugin version should be last stable version.
98
-
99
- if ( empty($bcVersion) ) {
100
- $lastStableVersion = $lastVersion;
101
- } else {
102
- $lastStableVersion = $bcVersion;
103
- }
104
-
105
- // Current version is larger that 1.1.7? Update options
106
-
107
- if ( version_compare( $lastStableVersion, '1.1.7', '<=' ) ) {
108
- if ( empty($bcVersion) ) {
109
- update_option( 'dgwt_wcas_backward_compatibility_version', '1.1.7' );
110
- }
111
- if ( empty($backwardCompatibility) ) {
112
- update_option( 'dgwt_wcas_backward_compatibility', 'on' );
113
- }
114
- }
115
-
116
- // For the next backward compatibility
117
- // if(
118
- // version_compare($lastStableVersion, 'x.x.x', '<=')
119
- // && version_compare($lastStableVersion, 'x.x.x', '>')
120
- // ) {
121
- // }
122
- }
123
-
124
  /**
125
  * Compare plugin version and install if a new version is available
126
  *
33
  }
34
  self::saveActivationDate();
35
  self::createOptions();
 
36
  // Update plugin version
37
  update_option( 'dgwt_wcas_version', DGWT_WCAS_VERSION );
38
  }
76
  }
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  /**
80
  * Compare plugin version and install if a new version is available
81
  *
includes/Admin/Promo/FeedbackNotice.php CHANGED
@@ -3,7 +3,7 @@
3
  namespace DgoraWcas\Admin\Promo;
4
 
5
  // Exit if accessed directly
6
- if ( !defined( 'ABSPATH' ) ) {
7
  exit;
8
  }
9
 
@@ -24,72 +24,68 @@ class FeedbackNotice {
24
  */
25
  private $offset;
26
 
27
- function __construct()
28
- {
29
 
30
- $this->offset = strtotime('-7 days');
31
 
32
- add_action('admin_init', array($this, 'checkInstallationDate'));
33
 
34
  add_action( 'wp_ajax_' . self::DISMISS_AJAX_ACTION, array( $this, 'dismissNotice' ) );
35
 
36
- add_action('admin_head', array($this, 'loadStyle'));
37
 
38
- add_action('admin_footer', array($this, 'printDismissJS'));
39
 
40
  }
41
 
42
- /**
43
- * Check if is possible to display admin notice on the current screen
44
- * @return bool
45
- */
46
- private function allowDisplay()
47
- {
48
- $currentScreen = get_current_screen();
49
- if (
50
- ! empty($currentScreen)
51
- && (
52
- in_array($currentScreen->base, array('dashboard', 'post', 'edit'))
53
- || strpos($currentScreen->base, DGWT_WCAS_SETTINGS_KEY) !== false
54
- )
55
- ) {
56
- return true;
57
- }
58
-
59
- return false;
60
-
61
- }
62
 
63
  /**
64
  * Display feedback notice
65
  * @return null | echo HTML
66
  */
67
- public function displayNotice()
68
- {
69
- global $current_user;
70
 
71
- if ($this->allowDisplay())
72
- {
73
  ?>
74
 
75
  <div class="notice-info notice dgwt-wcas-notice dgwt-wcas-review-notice">
76
  <div class="dgwt-wcas-review-notice-logo"></div>
77
- <?php printf( __( "Hey %s, it's Damian Góra from %s. You have used this free plugin for some time now, and I hope you like it!", 'ajax-search-for-woocommerce' ),
78
- '<strong>' . $current_user->display_name . '</strong>',
79
- '<strong>' . DGWT_WCAS_NAME . '</strong>'
80
- ); ?>
81
- <br />
82
- <?php printf(__("I have spent countless hours developing it, and it would mean a lot to me if you %ssupport it with a quick review on WordPress.org.%s", 'ajax-search-for-woocommerce'),
83
- '<strong><a target="_blank" href="' . self::REVIEW_URL . '">', '</a></strong>'
84
- ); ?>
85
  <div class="button-container">
86
  <a href="<?php echo self::REVIEW_URL; ?>" target="_blank" data-link="follow" class="button-secondary dgwt-review-notice-dismiss">
87
  <span class="dashicons dashicons-star-filled"></span>
88
- <?php printf(__("Review %s", 'ajax-search-for-woocommerce'),DGWT_WCAS_NAME); ?>
89
  </a>
90
  <a href="#" class="button-secondary dgwt-review-notice-dismiss">
91
  <span class="dashicons dashicons-no-alt"></span>
92
- <?php _e("No thanks", 'ajax-search-for-woocommerce'); ?>
93
  </a>
94
  </div>
95
  </div>
@@ -102,22 +98,20 @@ class FeedbackNotice {
102
  * Check instalation date
103
  * @return null
104
  */
105
- public function checkInstallationDate()
106
- {
107
 
108
- $date = get_option(self::ACTIVATION_DATE_OPT);
109
- if (empty($date)) {
110
- add_option(self::ACTIVATION_DATE_OPT, time());
111
  }
112
 
113
- $notice_closed = get_option(self::HIDE_NOTICE_OPT);
114
 
115
- if (empty($notice_closed)) {
116
- $install_date = get_option(self::ACTIVATION_DATE_OPT);
117
 
118
- if ($this->offset >= $install_date && current_user_can('install_plugins'))
119
- {
120
- add_action('admin_notices', array($this, 'displayNotice'));
121
  }
122
  }
123
 
@@ -141,53 +135,52 @@ class FeedbackNotice {
141
  */
142
  public function printDismissJS() {
143
 
144
- if(!$this->allowDisplay()){
145
- return false;
146
- }
147
  ?>
148
- <script>
149
- (function ($) {
150
 
151
- $( document ).on( 'click', '.dgwt-review-notice-dismiss', function () {
152
- var $box = $( this ).closest( '.dgwt-wcas-review-notice' ),
153
- isLink = $( this ).attr('data-link') === 'follow' ? true : false;
154
 
155
- $box.fadeOut( 700 );
156
 
157
- $.ajax( {
158
- url: ajaxurl,
159
- data: {
160
- action: '<?php echo self::DISMISS_AJAX_ACTION; ?>',
161
- }
162
- } ).done( function ( data ) {
163
 
164
- setTimeout(function(){
165
- $box.remove();
166
- }, 700);
167
 
168
- } );
169
 
170
- if(!isLink) {
171
- return false;
172
- }
173
- } );
174
 
175
- }(jQuery));
176
- </script>
177
 
178
  <?php
179
  }
180
 
181
- /**
182
- * Load the necessary CSS
183
- * @return void
184
- */
185
- public function loadStyle()
186
- {
187
- if($this->allowDisplay()){
188
- wp_enqueue_style('dgwt-wcas-admin-style');
189
- }
190
 
191
- }
192
 
193
- }
3
  namespace DgoraWcas\Admin\Promo;
4
 
5
  // Exit if accessed directly
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
  exit;
8
  }
9
 
24
  */
25
  private $offset;
26
 
27
+ function __construct() {
 
28
 
29
+ $this->offset = strtotime( '-7 days' );
30
 
31
+ add_action( 'admin_init', array( $this, 'checkInstallationDate' ) );
32
 
33
  add_action( 'wp_ajax_' . self::DISMISS_AJAX_ACTION, array( $this, 'dismissNotice' ) );
34
 
35
+ add_action( 'admin_head', array( $this, 'loadStyle' ) );
36
 
37
+ add_action( 'admin_footer', array( $this, 'printDismissJS' ) );
38
 
39
  }
40
 
41
+ /**
42
+ * Check if is possible to display admin notice on the current screen
43
+ * @return bool
44
+ */
45
+ private function allowDisplay() {
46
+ $currentScreen = get_current_screen();
47
+ if (
48
+ ! empty( $currentScreen )
49
+ && (
50
+ in_array( $currentScreen->base, array( 'dashboard', 'post', 'edit' ) )
51
+ || strpos( $currentScreen->base, DGWT_WCAS_SETTINGS_KEY ) !== false
52
+ )
53
+ ) {
54
+ return true;
55
+ }
56
+
57
+ return false;
58
+
59
+ }
 
60
 
61
  /**
62
  * Display feedback notice
63
  * @return null | echo HTML
64
  */
65
+ public function displayNotice() {
66
+ global $current_user;
 
67
 
68
+ if ( $this->allowDisplay() ) {
 
69
  ?>
70
 
71
  <div class="notice-info notice dgwt-wcas-notice dgwt-wcas-review-notice">
72
  <div class="dgwt-wcas-review-notice-logo"></div>
73
+ <?php printf( __( "Hey %s, it's Damian Góra from %s. You have used this free plugin for some time now, and I hope you like it!", 'ajax-search-for-woocommerce' ),
74
+ '<strong>' . $current_user->display_name . '</strong>',
75
+ '<strong>' . DGWT_WCAS_NAME . '</strong>'
76
+ ); ?>
77
+ <br/>
78
+ <?php printf( __( "I have spent countless hours developing it, and it would mean a lot to me if you %ssupport it with a quick review on WordPress.org.%s", 'ajax-search-for-woocommerce' ),
79
+ '<strong><a target="_blank" href="' . self::REVIEW_URL . '">', '</a></strong>'
80
+ ); ?>
81
  <div class="button-container">
82
  <a href="<?php echo self::REVIEW_URL; ?>" target="_blank" data-link="follow" class="button-secondary dgwt-review-notice-dismiss">
83
  <span class="dashicons dashicons-star-filled"></span>
84
+ <?php printf( __( "Review %s", 'ajax-search-for-woocommerce' ), DGWT_WCAS_NAME ); ?>
85
  </a>
86
  <a href="#" class="button-secondary dgwt-review-notice-dismiss">
87
  <span class="dashicons dashicons-no-alt"></span>
88
+ <?php _e( "No thanks", 'ajax-search-for-woocommerce' ); ?>
89
  </a>
90
  </div>
91
  </div>
98
  * Check instalation date
99
  * @return null
100
  */
101
+ public function checkInstallationDate() {
 
102
 
103
+ $date = get_option( self::ACTIVATION_DATE_OPT );
104
+ if ( empty( $date ) ) {
105
+ add_option( self::ACTIVATION_DATE_OPT, time() );
106
  }
107
 
108
+ $notice_closed = get_option( self::HIDE_NOTICE_OPT );
109
 
110
+ if ( empty( $notice_closed ) ) {
111
+ $install_date = get_option( self::ACTIVATION_DATE_OPT );
112
 
113
+ if ( $this->offset >= $install_date && current_user_can( 'install_plugins' ) ) {
114
+ add_action( 'admin_notices', array( $this, 'displayNotice' ) );
 
115
  }
116
  }
117
 
135
  */
136
  public function printDismissJS() {
137
 
138
+ if ( ! $this->allowDisplay() ) {
139
+ return false;
140
+ }
141
  ?>
142
+ <script>
143
+ (function ($) {
144
 
145
+ $(document).on('click', '.dgwt-review-notice-dismiss', function () {
146
+ var $box = $(this).closest('.dgwt-wcas-review-notice'),
147
+ isLink = $(this).attr('data-link') === 'follow' ? true : false;
148
 
149
+ $box.fadeOut(700);
150
 
151
+ $.ajax({
152
+ url: ajaxurl,
153
+ data: {
154
+ action: '<?php echo self::DISMISS_AJAX_ACTION; ?>',
155
+ }
156
+ }).done(function (data) {
157
 
158
+ setTimeout(function () {
159
+ $box.remove();
160
+ }, 700);
161
 
162
+ });
163
 
164
+ if (!isLink) {
165
+ return false;
166
+ }
167
+ });
168
 
169
+ }(jQuery));
170
+ </script>
171
 
172
  <?php
173
  }
174
 
175
+ /**
176
+ * Load the necessary CSS
177
+ * @return void
178
+ */
179
+ public function loadStyle() {
180
+ if ( $this->allowDisplay() ) {
181
+ wp_enqueue_style( 'dgwt-wcas-admin-style' );
182
+ }
 
183
 
184
+ }
185
 
186
+ }
includes/Admin/Promo/Upgrade.php CHANGED
@@ -3,115 +3,118 @@
3
  namespace DgoraWcas\Admin\Promo;
4
 
5
  // Exit if accessed directly
6
- if ( ! defined('ABSPATH')) {
7
- exit;
8
  }
9
 
10
 
11
- class Upgrade
12
- {
13
-
14
- function __construct()
15
- {
16
-
17
- add_action('current_screen', array($this, 'printScripts'));
18
-
19
- }
20
-
21
-
22
- public function printScripts()
23
- {
24
-
25
- if (dgoraAsfwFs()->is_premium()) {
26
- return;
27
- }
28
-
29
- $cs = get_current_screen();
30
-
31
- if ( ! empty($cs->base) && strpos($cs->base, 'dgwt_wcas') !== false) {
32
-
33
- add_thickbox();
34
- add_action('admin_footer', array($this, 'renderUpgradeModal'), 10);
35
- add_action('admin_footer', array($this, 'upgradeModalHandler'), 20);
36
-
37
- }
38
-
39
- }
40
-
41
- /**
42
- * Render plugin upgrade modal
43
- *
44
- * @return void
45
- */
46
- public function renderUpgradeModal()
47
- {
48
- $utmLink = 'https://ajaxsearch.pro/?utm_source=wp-admin&utm_medium=referral&utm_campaign=upgrade-popup&utm_content=features&utm_gen=utmdc#features-comparsion';
49
-
50
- $features = array(
51
- __('Speed up search! (even 10x faster) - users love it!', 'ajax-search-for-woocommerce'),
52
- __('New modern search engine based on bm25 ranking algorithm', 'ajax-search-for-woocommerce'),
53
- __('Fuzzy search', 'ajax-search-for-woocommerce'),
54
- __('Search in attributes and variation products SKUs (option)', 'ajax-search-for-woocommerce'),
55
- __('Individual customization of the search form (simple CSS improvements)', 'ajax-search-for-woocommerce'),
56
- __('Individual tips and support by Damian Góra - the author of the plugin', 'ajax-search-for-woocommerce')
57
- );
58
- echo '<a style="display:none;" class="thickbox js-dgwt-wcas-modal-pro-handler" href="#TB_inline?width=600&height=380&inlineId=dgwt-wcas-modal" title="' . __('Ajax Search for WooCommerce PRO - Upgrade Now', 'ajax-search-for-woocommerce') . '"></a>';
59
- echo '<div id="dgwt-wcas-modal" class="dgwt-wcas-modal-upgrade" style="display:none;">';
60
- echo '<img class="dgwt-wcas-modal-logo" src="' . DGWT_WCAS_URL . 'assets/img/logo-128.png" width="128" height="128" />';
61
- echo '
62
- <h2 class="dgwt-wcas-modal-title">' . __('Update now and increase your sales. You will receive 14-day satisfaction guarantee. A return on investment will come very quickly.', 'ajax-search-for-woocommerce') . '</h2>';
63
- echo '<ul>';
64
- foreach ($features as $feature) {
65
- echo '<li><strong>+ ' . $feature . '</strong></li>';
66
- }
67
- echo '<li><strong>+ '. __('and more...', 'ajax-search-for-woocommerce') .' <a target="_blank" href="' . $utmLink . '">' . __('See a comparison of all free and premium features!', 'ajax-search-for-woocommerce') . '</a></strong></li>';
68
- echo '</ul>';
69
- echo '<p>' . __('You can upgrade without leaving the admin panel by clicking below.', 'ajax-search-for-woocommerce');
70
- echo '<br />' . __('Free updates and email support included.', 'ajax-search-for-woocommerce') . '</p>';
71
- echo '<p><a class="button-primary" target="_blank" href="' . self::getUpgradeUrl() . '">' . __('Upgrade Now', 'ajax-search-for-woocommerce') . '</a>';
72
- //echo '<a href="" class="button-secondary js-cas-pro-read-more" target="_blank" href="">'.__('Read More','ajax-search-for-woocommerce').'</a>';
73
- echo '</p>';
74
- echo '</div>';
75
- }
76
-
77
- /**
78
- * JS for the upgrade modal
79
- *
80
- * @return void
81
- */
82
- public function upgradeModalHandler()
83
- {
84
- ?>
85
- <script>
86
- (function ($) {
87
- var $handler = $('.dgwt-wcas-premium-only label, .dgwt-wcas-premium-only input, .dgwt-wcas-premium-only button, .dgwt-wcas-premium-only--trigger');
88
-
89
- $handler.on('click', function (e) {
90
- triggerModal(e);
91
- });
92
-
93
- $('.dgwt-wcas-premium-only select').on('change', function (e) {
94
- $(this).val($(this).attr('data-default'));
95
- triggerModal(e);
96
- });
97
-
98
- function triggerModal(e) {
99
- e.preventDefault();
100
- $('.js-dgwt-wcas-modal-pro-handler').trigger('click');
101
- }
102
- })(jQuery);
103
- </script>
104
- <?php
105
- }
106
-
107
- /**
108
- * Ge upgrade URL
109
- *
110
- * @return string
111
- */
112
- public static function getUpgradeUrl()
113
- {
114
- return esc_url(dgoraAsfwFs()->get_upgrade_url());
115
- }
116
-
117
- }
 
 
 
3
  namespace DgoraWcas\Admin\Promo;
4
 
5
  // Exit if accessed directly
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
  }
9
 
10
 
11
+ class Upgrade {
12
+
13
+ function __construct() {
14
+
15
+ add_action( 'current_screen', array( $this, 'printScripts' ) );
16
+
17
+ }
18
+
19
+
20
+ public function printScripts() {
21
+
22
+ if ( dgoraAsfwFs()->is_premium() ) {
23
+ return;
24
+ }
25
+
26
+ $cs = get_current_screen();
27
+
28
+ if ( ! empty( $cs->base ) && strpos( $cs->base, 'dgwt_wcas' ) !== false ) {
29
+
30
+ add_thickbox();
31
+ add_action( 'admin_footer', array( $this, 'renderUpgradeModal' ), 10 );
32
+ add_action( 'admin_footer', array( $this, 'upgradeModalHandler' ), 20 );
33
+
34
+ }
35
+
36
+ }
37
+
38
+ /**
39
+ * Render plugin upgrade modal
40
+ *
41
+ * @return void
42
+ */
43
+ public function renderUpgradeModal() {
44
+ $utmLink = 'https://ajaxsearch.pro/?utm_source=wp-admin&utm_medium=referral&utm_campaign=upgrade-popup&utm_content=features&utm_gen=utmdc#features-comparsion';
45
+
46
+ $features = array(
47
+ __( 'Speed up search! (even 10x faster) - users love it!', 'ajax-search-for-woocommerce' ),
48
+ __( 'New modern search engine based on bm25 ranking algorithm', 'ajax-search-for-woocommerce' ),
49
+ __( 'Fuzzy search', 'ajax-search-for-woocommerce' ),
50
+ __( 'Search in attributes and variation products SKUs (option)', 'ajax-search-for-woocommerce' ),
51
+ __( 'Individual customization of the search form (simple CSS improvements)', 'ajax-search-for-woocommerce' ),
52
+ __( 'Individual tips and support by Damian Góra - the author of the plugin', 'ajax-search-for-woocommerce' )
53
+ );
54
+ echo '<a style="display:none;" class="thickbox js-dgwt-wcas-modal-pro-handler" href="#TB_inline?width=600&height=380&inlineId=dgwt-wcas-modal" title="' . __( 'Ajax Search for WooCommerce PRO - Upgrade Now', 'ajax-search-for-woocommerce' ) . '"></a>';
55
+ echo '<div id="dgwt-wcas-modal" class="dgwt-wcas-modal-upgrade" style="display:none;">';
56
+ echo '<img class="dgwt-wcas-modal-logo" src="' . DGWT_WCAS_URL . 'assets/img/logo-128.png" width="128" height="128" />';
57
+ echo '
58
+ <h2 class="dgwt-wcas-modal-title">' . __( 'Update now and increase your sales. You will receive 14-day satisfaction guarantee. A return on investment will come very quickly.', 'ajax-search-for-woocommerce' ) . '</h2>';
59
+ echo '<ul>';
60
+ foreach ( $features as $feature ) {
61
+ echo '<li><strong>+ ' . $feature . '</strong></li>';
62
+ }
63
+ echo '<li><strong>+ ' . __( 'and more...', 'ajax-search-for-woocommerce' ) . ' <a target="_blank" href="' . $utmLink . '">' . __( 'See a comparison of all free and premium features!', 'ajax-search-for-woocommerce' ) . '</a></strong></li>';
64
+ echo '</ul>';
65
+ echo '<p>' . __( 'You can upgrade without leaving the admin panel by clicking below.', 'ajax-search-for-woocommerce' );
66
+ echo '<br />' . __( 'Free updates and email support included.', 'ajax-search-for-woocommerce' ) . '</p>';
67
+ echo '<p><a class="button-primary" target="_blank" href="' . self::getUpgradeUrl() . '">' . __( 'Upgrade Now', 'ajax-search-for-woocommerce' ) . '</a>';
68
+ //echo '<a href="" class="button-secondary js-cas-pro-read-more" target="_blank" href="">'.__('Read More','ajax-search-for-woocommerce').'</a>';
69
+ echo '</p>';
70
+ echo '</div>';
71
+ }
72
+
73
+ /**
74
+ * JS for the upgrade modal
75
+ *
76
+ * @return void
77
+ */
78
+ public function upgradeModalHandler() {
79
+ ?>
80
+ <script>
81
+ (function ($) {
82
+ var $handler = $('.dgwt-wcas-premium-only label, .dgwt-wcas-premium-only input, .dgwt-wcas-premium-only button, .dgwt-wcas-premium-only--trigger');
83
+
84
+ $handler.on('click', function (e) {
85
+ triggerModal(e);
86
+ });
87
+
88
+ $('.dgwt-wcas-premium-only select').on('change', function (e) {
89
+ $(this).val($(this).attr('data-default'));
90
+ triggerModal(e);
91
+ });
92
+
93
+ function triggerModal(e) {
94
+ e.preventDefault();
95
+ $('.js-dgwt-wcas-modal-pro-handler').trigger('click');
96
+ }
97
+ })(jQuery);
98
+ </script>
99
+ <?php
100
+ }
101
+
102
+ /**
103
+ * Ge upgrade URL
104
+ *
105
+ * @param string $type
106
+ *
107
+ * @return string
108
+ */
109
+ public static function getUpgradeUrl( $type = 'external' ) {
110
+
111
+ $url = "https://ajaxsearch.pro/pricing/?utm_source=wp-admin&utm_medium=referral&utm_campaign=upgrade-link&utm_content=upgrade-now-btn";
112
+
113
+ if ( $type === 'internal' ) {
114
+ $url = esc_url( dgoraAsfwFs()->get_upgrade_url() );
115
+ }
116
+
117
+ return $url;
118
+ }
119
+
120
+ }
includes/Admin/RegenerateImages.php CHANGED
@@ -7,191 +7,182 @@ namespace DgoraWcas\Admin;
7
  use DgoraWcas\Admin\Promo\FeedbackNotice;
8
  use DgoraWcas\Helpers;
9
 
10
- class RegenerateImages
11
- {
12
 
13
- const ALREADY_REGENERATED_OPT_KEY = 'dgwt_wcas_images_regenerated';
14
- const REGENERATE_ACTION = 'dgwt_wcas_regenerate_images';
15
- const DISMISS_AJAX_ACTION = 'dgwt_wcas_dismiss_notice_regenerate_images';
16
 
17
- public function __construct()
18
- {
19
- }
20
 
21
- public function init()
22
- {
23
 
24
- $displayImages = DGWT_WCAS()->settings->getOption('show_product_image') === 'on';
25
 
26
- $regenerated = get_option(self::ALREADY_REGENERATED_OPT_KEY);
27
 
28
- add_action('wp_ajax_' . self::DISMISS_AJAX_ACTION, array($this, 'dismissNotice'));
29
- add_action('wp_ajax_' . self::REGENERATE_ACTION, array($this, 'regenerateImages'));
30
 
31
- add_filter('woocommerce_regenerate_images_intermediate_image_sizes', array($this, 'getImageSizes'), 10, 1);
32
 
33
- if (
34
- Helpers::isSettingsPage()
35
- && empty($regenerated)
36
- && $displayImages
37
- && $this->isTimeToDisplay()
38
- ) {
39
 
40
 
41
- add_action('admin_notices', array($this, 'adminNotice'));
42
 
43
- add_action('admin_footer', array($this, 'printJS'));
44
 
45
- }
46
 
47
- }
48
 
49
- /**
50
- * Regenerate images
51
- *
52
- * @return void
53
- */
54
- public function regenerateImages()
55
- {
56
- if (class_exists('WC_Regenerate_Images')) {
57
-
58
- if (method_exists('Jetpack', 'is_module_active') && \Jetpack::is_module_active('photon')) {
59
- return;
60
- }
61
 
62
- if (apply_filters('woocommerce_background_image_regeneration', true)) {
63
- \WC_Regenerate_Images::queue_image_regeneration();
64
- }
65
- }
66
-
67
- update_option(self::ALREADY_REGENERATED_OPT_KEY, true);
68
 
69
- wp_send_json_success();
70
- }
 
 
71
 
72
- /**
73
- * Images sizes to regenerate
74
- *
75
- * @param array $sizes
76
- *
77
- * @return array
78
- */
79
- public function getImageSizes($sizes)
80
- {
81
 
82
- array_push($sizes, 'dgwt-wcas-product-suggestion');
 
83
 
84
- return $sizes;
 
 
 
 
 
 
 
85
 
86
- }
87
 
88
- /**
89
- * Notice: Maybe regenerate images
90
- * @return void
91
- */
92
 
93
- public function adminNotice()
94
- {
95
- ?>
96
- <div class="notice notice-info dgwt-wcas-notice is-dismissible js-dgwt-wcas-notice-regenerate-images">
97
- <p>
98
- <?php
99
- $button = '<a href="#" class="button button-small js-dgwt-wcas-start-regenerate-images">' . __('Regenerate WooCommerce images') . '</a>';
100
- $pluginLink = '<a target="_blank" href="https://wordpress.org/plugins/regenerate-thumbnails/">Regenerate Thumbnails</a>';
101
- printf(__('<b>AJAX Search for WooCommerce</b>: It is recommended to generate a special small image size for existing products to ensure a better user experience. This is a one-time action. <br /><br />You can do it by clicking %s or use external plugin e.g. %s.',
102
- 'ajax-search-for-woocommerce'), $button, $pluginLink);
103
- ?>
104
- </p>
105
- </div>
106
- <?php
107
- }
108
 
 
 
 
 
109
 
110
- /**
111
- * Hide admin notice
112
- *
113
- * @return null
114
- */
115
- public function dismissNotice()
116
- {
 
 
 
 
 
 
 
117
 
118
- if ( ! current_user_can('administrator')) {
119
- return;
120
- }
121
 
122
- update_option(self::ALREADY_REGENERATED_OPT_KEY, true);
 
 
 
 
 
123
 
124
- wp_send_json_success();
125
- }
 
126
 
127
- /**
128
- * Check is is time to display
129
- *
130
- * @return void
131
- */
132
- public function isTimeToDisplay()
133
- {
134
 
135
- $isTime = false;
 
136
 
137
- $date = get_option(FeedbackNotice::ACTIVATION_DATE_OPT);
138
- $offset = strtotime('-2 days');
 
 
 
 
139
 
140
- if ( ! empty($date) && $offset >= $date) {
141
- $isTime = true;
142
- }
143
 
 
 
144
 
145
- return $isTime;
146
- }
147
-
148
- /**
149
- * Print JS for close admin notice
150
- *
151
- * @return void
152
- */
153
- public function printJS()
154
- {
155
- ?>
156
- <script>
157
- (function ($) {
158
-
159
- $(document).on('click', '.js-dgwt-wcas-notice-regenerate-images .notice-dismiss', function () {
160
 
161
- $.ajax({
162
- url: ajaxurl,
163
- data: {
164
- action: '<?php echo self::DISMISS_AJAX_ACTION; ?>',
165
- }
166
- });
167
 
168
- });
169
-
170
- $(document).on('click', '.js-dgwt-wcas-start-regenerate-images', function () {
171
 
172
- $('.js-dgwt-wcas-notice-regenerate-images p').html('<b>AJAX Search for WooCommerce</b>: (...)');
173
-
174
- $.ajax({
175
- url: ajaxurl,
176
- data: {
177
- action: '<?php echo self::REGENERATE_ACTION; ?>',
178
- }
179
- }).done(function (data) {
 
180
 
181
- setTimeout(function () {
182
- $('.js-dgwt-wcas-notice-regenerate-images p').html('<b>AJAX Search for WooCommerce</b>: <?php _e('Regeneration of images started. The process will continue in the background.'); ?>');
183
- }, 700);
184
 
185
- });
186
- ;
 
 
 
 
187
 
188
- });
189
-
190
- }(jQuery));
191
- </script>
192
 
193
- <?php
194
- }
195
 
 
196
 
197
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  use DgoraWcas\Admin\Promo\FeedbackNotice;
8
  use DgoraWcas\Helpers;
9
 
10
+ class RegenerateImages {
 
11
 
12
+ const ALREADY_REGENERATED_OPT_KEY = 'dgwt_wcas_images_regenerated';
13
+ const REGENERATE_ACTION = 'dgwt_wcas_regenerate_images';
14
+ const DISMISS_AJAX_ACTION = 'dgwt_wcas_dismiss_notice_regenerate_images';
15
 
16
+ public function __construct() {
17
+ }
 
18
 
19
+ public function init() {
 
20
 
21
+ $displayImages = DGWT_WCAS()->settings->getOption( 'show_product_image' ) === 'on';
22
 
23
+ $regenerated = get_option( self::ALREADY_REGENERATED_OPT_KEY );
24
 
25
+ add_action( 'wp_ajax_' . self::DISMISS_AJAX_ACTION, array( $this, 'dismissNotice' ) );
26
+ add_action( 'wp_ajax_' . self::REGENERATE_ACTION, array( $this, 'regenerateImages' ) );
27
 
28
+ add_filter( 'woocommerce_regenerate_images_intermediate_image_sizes', array( $this, 'getImageSizes' ), 10, 1 );
29
 
30
+ if (
31
+ Helpers::isSettingsPage()
32
+ && empty( $regenerated )
33
+ && $displayImages
34
+ && $this->isTimeToDisplay()
35
+ ) {
36
 
37
 
38
+ add_action( 'admin_notices', array( $this, 'adminNotice' ) );
39
 
40
+ add_action( 'admin_footer', array( $this, 'printJS' ) );
41
 
42
+ }
43
 
44
+ }
45
 
46
+ /**
47
+ * Regenerate images
48
+ *
49
+ * @return void
50
+ */
51
+ public function regenerateImages() {
52
+ if ( class_exists( 'WC_Regenerate_Images' ) ) {
 
 
 
 
 
53
 
54
+ if ( method_exists( 'Jetpack', 'is_module_active' ) && \Jetpack::is_module_active( 'photon' ) ) {
55
+ return;
56
+ }
 
 
 
57
 
58
+ if ( apply_filters( 'woocommerce_background_image_regeneration', true ) ) {
59
+ \WC_Regenerate_Images::queue_image_regeneration();
60
+ }
61
+ }
62
 
63
+ update_option( self::ALREADY_REGENERATED_OPT_KEY, true );
 
 
 
 
 
 
 
 
64
 
65
+ wp_send_json_success();
66
+ }
67
 
68
+ /**
69
+ * Images sizes to regenerate
70
+ *
71
+ * @param array $sizes
72
+ *
73
+ * @return array
74
+ */
75
+ public function getImageSizes( $sizes ) {
76
 
77
+ array_push( $sizes, 'dgwt-wcas-product-suggestion' );
78
 
79
+ return $sizes;
 
 
 
80
 
81
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
+ /**
84
+ * Notice: Maybe regenerate images
85
+ * @return void
86
+ */
87
 
88
+ public function adminNotice() {
89
+ ?>
90
+ <div class="notice notice-info dgwt-wcas-notice is-dismissible js-dgwt-wcas-notice-regenerate-images">
91
+ <p>
92
+ <?php
93
+ $button = '<a href="#" class="button button-small js-dgwt-wcas-start-regenerate-images">' . __( 'Regenerate WooCommerce images' ) . '</a>';
94
+ $pluginLink = '<a target="_blank" href="https://wordpress.org/plugins/regenerate-thumbnails/">Regenerate Thumbnails</a>';
95
+ printf( __( '<b>AJAX Search for WooCommerce</b>: It is recommended to generate a special small image size for existing products to ensure a better user experience. This is a one-time action. <br /><br />You can do it by clicking %s or use external plugin e.g. %s.',
96
+ 'ajax-search-for-woocommerce' ), $button, $pluginLink );
97
+ ?>
98
+ </p>
99
+ </div>
100
+ <?php
101
+ }
102
 
 
 
 
103
 
104
+ /**
105
+ * Hide admin notice
106
+ *
107
+ * @return null
108
+ */
109
+ public function dismissNotice() {
110
 
111
+ if ( ! current_user_can( 'administrator' ) ) {
112
+ return;
113
+ }
114
 
115
+ update_option( self::ALREADY_REGENERATED_OPT_KEY, true );
 
 
 
 
 
 
116
 
117
+ wp_send_json_success();
118
+ }
119
 
120
+ /**
121
+ * Check is is time to display
122
+ *
123
+ * @return void
124
+ */
125
+ public function isTimeToDisplay() {
126
 
127
+ $isTime = false;
 
 
128
 
129
+ $date = get_option( FeedbackNotice::ACTIVATION_DATE_OPT );
130
+ $offset = strtotime( '-2 days' );
131
 
132
+ if ( ! empty( $date ) && $offset >= $date ) {
133
+ $isTime = true;
134
+ }
 
 
 
 
 
 
 
 
 
 
 
 
135
 
 
 
 
 
 
 
136
 
137
+ return $isTime;
138
+ }
 
139
 
140
+ /**
141
+ * Print JS for close admin notice
142
+ *
143
+ * @return void
144
+ */
145
+ public function printJS() {
146
+ ?>
147
+ <script>
148
+ (function ($) {
149
 
150
+ $(document).on('click', '.js-dgwt-wcas-notice-regenerate-images .notice-dismiss', function () {
 
 
151
 
152
+ $.ajax({
153
+ url: ajaxurl,
154
+ data: {
155
+ action: '<?php echo self::DISMISS_AJAX_ACTION; ?>',
156
+ }
157
+ });
158
 
159
+ });
 
 
 
160
 
161
+ $(document).on('click', '.js-dgwt-wcas-start-regenerate-images', function () {
 
162
 
163
+ $('.js-dgwt-wcas-notice-regenerate-images p').html('<b>AJAX Search for WooCommerce</b>: (...)');
164
 
165
+ $.ajax({
166
+ url: ajaxurl,
167
+ data: {
168
+ action: '<?php echo self::REGENERATE_ACTION; ?>',
169
+ }
170
+ }).done(function (data) {
171
+
172
+ setTimeout(function () {
173
+ $('.js-dgwt-wcas-notice-regenerate-images p').html('<b>AJAX Search for WooCommerce</b>: <?php _e( 'Regeneration of images started. The process will continue in the background.' ); ?>');
174
+ }, 700);
175
+
176
+ });
177
+ ;
178
+
179
+ });
180
+
181
+ }(jQuery));
182
+ </script>
183
+
184
+ <?php
185
+ }
186
+
187
+
188
+ }
includes/Admin/Requirements.php CHANGED
@@ -19,7 +19,7 @@ class Requirements
19
  {
20
  $allow = false;
21
  $plugins = $this->getIncompatiblePlugins();
22
- if ( $this->checkPHPVersion() && $this->checkPHPExtensions() && empty($plugins['langs']) && empty($plugins['other']) && $this->checkMultisite() ) {
23
  $allow = true;
24
  }
25
  return $allow;
@@ -90,10 +90,6 @@ class Requirements
90
  if ( class_exists( 'GTranslate' ) ) {
91
  $plugins['langs'][] = 'GTranslate';
92
  }
93
- // Polylang
94
- if ( defined( 'POLYLANG_VERSION' ) ) {
95
- $plugins['langs'][] = 'Polylang';
96
- }
97
  if ( !empty($plugins['langs']) ) {
98
  foreach ( $plugins['langs'] as $plugin ) {
99
  $this->notices[] = sprintf( __( 'You use the %s plugin. The Ajax Search for WooCommerce PRO does not support multilingual yet.', 'ajax-search-for-woocommerce' ), $plugin );
@@ -106,23 +102,6 @@ class Requirements
106
  return $plugins;
107
  }
108
 
109
- /**
110
- * Check Multisite
111
- *
112
- * @return bool
113
- */
114
- private function checkMultisite()
115
- {
116
- $pass = true;
117
-
118
- if ( is_multisite() ) {
119
- $pass = false;
120
- $this->notices[] = __( 'Your WordPress use the multisite. The Ajax Search for WooCommerce PRO does not support multisite yet.', 'ajax-search-for-woocommerce' );
121
- }
122
-
123
- return $pass;
124
- }
125
-
126
  /**
127
  * Display error notice on pricing page if necessary
128
  *
19
  {
20
  $allow = false;
21
  $plugins = $this->getIncompatiblePlugins();
22
+ if ( $this->checkPHPVersion() && $this->checkPHPExtensions() && empty($plugins['langs']) && empty($plugins['other']) ) {
23
  $allow = true;
24
  }
25
  return $allow;
90
  if ( class_exists( 'GTranslate' ) ) {
91
  $plugins['langs'][] = 'GTranslate';
92
  }
 
 
 
 
93
  if ( !empty($plugins['langs']) ) {
94
  foreach ( $plugins['langs'] as $plugin ) {
95
  $this->notices[] = sprintf( __( 'You use the %s plugin. The Ajax Search for WooCommerce PRO does not support multilingual yet.', 'ajax-search-for-woocommerce' ), $plugin );
102
  return $plugins;
103
  }
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  /**
106
  * Display error notice on pricing page if necessary
107
  *
includes/Admin/SettingsAPI.php CHANGED
@@ -9,7 +9,7 @@ if ( !defined( 'ABSPATH' ) ) {
9
  }
10
  /**
11
  * Adapted from https://github.com/tareq1988/wordpress-settings-api-class
12
- *
13
  */
14
  /**
15
  * weDevs Settings API wrapper class
@@ -54,7 +54,7 @@ class SettingsAPI
54
  private $prefix ;
55
  /*
56
  * Constructor
57
- *
58
  * @param string $prefix - unique prefix for CSS classes and other names
59
  */
60
  public function __construct( $name = '' )
@@ -82,7 +82,7 @@ class SettingsAPI
82
  /**
83
  * Set settings sections
84
  *
85
- * @param array $sections setting sections array
86
  */
87
  function set_sections( $sections )
88
  {
@@ -93,7 +93,7 @@ class SettingsAPI
93
  /**
94
  * Add a single section
95
  *
96
- * @param array $section
97
  */
98
  function add_section( $section )
99
  {
@@ -104,7 +104,7 @@ class SettingsAPI
104
  /**
105
  * Set settings fields
106
  *
107
- * @param array $fields settings fields array
108
  */
109
  function set_fields( $fields )
110
  {
@@ -144,14 +144,10 @@ class SettingsAPI
144
  if ( isset( $section['desc'] ) && !empty($section['desc']) ) {
145
  $section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
146
  $callback = create_function( '', 'echo "' . str_replace( '"', '\\"', $section['desc'] ) . '";' );
 
 
147
  } else {
148
-
149
- if ( isset( $section['callback'] ) ) {
150
- $callback = $section['callback'];
151
- } else {
152
- $callback = null;
153
- }
154
-
155
  }
156
 
157
  add_settings_section(
@@ -196,7 +192,7 @@ class SettingsAPI
196
  /**
197
  * Get field description for display
198
  *
199
- * @param array $args settings field args
200
  */
201
  public function get_field_description( $args )
202
  {
@@ -222,7 +218,7 @@ class SettingsAPI
222
  /**
223
  * Displays a text field for a settings field
224
  *
225
- * @param array $args settings field args
226
  */
227
  function callback_text( $args )
228
  {
@@ -251,7 +247,7 @@ class SettingsAPI
251
  /**
252
  * Displays a url field for a settings field
253
  *
254
- * @param array $args settings field args
255
  */
256
  function callback_url( $args )
257
  {
@@ -261,7 +257,7 @@ class SettingsAPI
261
  /**
262
  * Displays a number field for a settings field
263
  *
264
- * @param array $args settings field args
265
  */
266
  function callback_number( $args )
267
  {
@@ -271,7 +267,7 @@ class SettingsAPI
271
  /**
272
  * Displays a checkbox for a settings field
273
  *
274
- * @param array $args settings field args
275
  */
276
  function callback_checkbox( $args )
277
  {
@@ -298,7 +294,7 @@ class SettingsAPI
298
  /**
299
  * Displays a multicheckbox a settings field
300
  *
301
- * @param array $args settings field args
302
  */
303
  function callback_multicheck( $args )
304
  {
@@ -334,7 +330,7 @@ class SettingsAPI
334
  /**
335
  * Displays a multicheckbox a settings field
336
  *
337
- * @param array $args settings field args
338
  */
339
  function callback_radio( $args )
340
  {
@@ -371,7 +367,7 @@ class SettingsAPI
371
  /**
372
  * Displays a selectbox for a settings field
373
  *
374
- * @param array $args settings field args
375
  */
376
  function callback_select( $args )
377
  {
@@ -404,7 +400,7 @@ class SettingsAPI
404
  /**
405
  * Displays a selectize multiple select for a settings field
406
  *
407
- * @param array $args settings field args
408
  */
409
  function callback_selectize( $args )
410
  {
@@ -415,12 +411,14 @@ class SettingsAPI
415
  $args
416
  );
417
  $options = ( !empty($args['options']) && is_array( $args['options'] ) ? $args['options'] : array() );
 
418
  $html = sprintf(
419
- '<input type="select-multiple" data-options="%4$s" class="dgwt-wcas-selectize" autocomplete="off" id="%1$s[%2$s]" name="%1$s[%2$s]" value="%3$s"/>',
420
  $this->name,
421
  $args['id'],
422
  $value,
423
- http_build_query( $options )
 
424
  );
425
  $html .= $this->get_field_description( $args );
426
  echo $html ;
@@ -429,7 +427,7 @@ class SettingsAPI
429
  /**
430
  * Displays a textarea for a settings field
431
  *
432
- * @param array $args settings field args
433
  */
434
  function callback_textarea( $args )
435
  {
@@ -454,7 +452,8 @@ class SettingsAPI
454
  /**
455
  * Displays a textarea for a settings field
456
  *
457
- * @param array $args settings field args
 
458
  * @return string
459
  */
460
  function callback_html( $args )
@@ -473,7 +472,7 @@ class SettingsAPI
473
  /**
474
  * Displays a rich text textarea for a settings field
475
  *
476
- * @param array $args settings field args
477
  */
478
  function callback_wysiwyg( $args )
479
  {
@@ -496,7 +495,7 @@ class SettingsAPI
496
  /**
497
  * Displays a file upload field for a settings field
498
  *
499
- * @param array $args settings field args
500
  */
501
  function callback_file( $args )
502
  {
@@ -520,7 +519,7 @@ class SettingsAPI
520
  /**
521
  * Displays a password field for a settings field
522
  *
523
- * @param array $args settings field args
524
  */
525
  function callback_password( $args )
526
  {
@@ -540,7 +539,7 @@ class SettingsAPI
540
  /**
541
  * Displays a color picker field for a settings field
542
  *
543
- * @param array $args settings field args
544
  */
545
  function callback_color( $args )
546
  {
@@ -561,7 +560,7 @@ class SettingsAPI
561
  /**
562
  * Displays a color picker field for a settings field
563
  *
564
- * @param array $args settings field args
565
  */
566
  function callback_desc( $args )
567
  {
@@ -579,7 +578,7 @@ class SettingsAPI
579
  /**
580
  * Displays a color picker field for a settings field
581
  *
582
- * @param array $args settings field args
583
  */
584
  function callback_datepicker( $args )
585
  {
@@ -645,9 +644,10 @@ class SettingsAPI
645
  /**
646
  * Get the value of a settings field
647
  *
648
- * @param string $option settings field name
649
- * @param string $default default text if it's not found
650
- * @param bool $not_empty allow empty value
 
651
  * @return string
652
  */
653
  function get_option( $option, $default = '', $allow_empty = true )
@@ -738,144 +738,149 @@ class SettingsAPI
738
  {
739
  ?>
740
  <script>
741
- jQuery( document ).ready( function ( $ ) {
742
 
743
- function markActiveGroup($group){
744
 
745
- var name = $group.attr('id').replace('dgwt_wcas_', '');
746
 
747
- $group.addClass( 'dgwt-wcas-group-active' );
748
- $group.closest('.js-dgwt-wcas-settings-body').attr('data-dgwt-wcas-active', name)
749
 
750
- }
751
 
752
- //Initiate Color Picker
753
- if ($('.wp-color-picker-field').length > 0) {
754
- $('.wp-color-picker-field').wpColorPicker({
755
- change: function (event, ui) {
756
- window.DGWT_WCAS_SEARCH_PREVIEW.onColorChangeHandler($(event.target), ui.color.toString());
757
- },
758
- });
759
- }
760
 
761
- // Switches option sections
762
- $( '.<?php
763
  echo $this->prefix ;
764
- ?>group' ).hide();
765
- var activetab = '';
766
- var maybe_active = '';
767
 
768
- if ( typeof ( localStorage ) != 'undefined' ) {
769
- maybe_active = localStorage.getItem( '<?php
770
  echo $this->prefix ;
771
- ?>settings-active-tab' );
772
 
773
- if ( maybe_active ) {
774
 
775
- // Check if tabs exists
776
- $( '.<?php
777
  echo $this->prefix ;
778
- ?>nav-tab-wrapper a:not(.js-nav-tab-minor)' ).each( function () {
779
 
780
- if ( $( this ).attr( 'href' ) === maybe_active ) {
781
- activetab = maybe_active;
782
- }
783
- } );
784
 
785
- }
786
- }
787
 
788
- if ( activetab != '' && $( activetab ).length ) {
789
- $( activetab ).fadeIn();
790
- markActiveGroup($( activetab ));
791
- } else {
792
- $( '.<?php
793
  echo $this->prefix ;
794
- ?>group:first' ).fadeIn();
795
- markActiveGroup($( '.<?php
796
  echo $this->prefix ;
797
- ?>group:first' ));
798
- }
799
- $( '.<?php
800
  echo $this->prefix ;
801
- ?>group .collapsed' ).each( function () {
802
- $( this ).find( 'input:checked' ).parent().parent().parent().nextAll().each(
803
- function () {
804
- if ( $( this ).hasClass( 'last' ) ) {
805
- $( this ).removeClass( 'hidden' );
806
- return false;
807
- }
808
- $( this ).filter( '.hidden' ).removeClass( 'hidden' );
809
- } );
810
- } );
811
 
812
- if ( activetab != '' && $( activetab + '-tab' ).length ) {
813
- $( activetab + '-tab' ).addClass( 'nav-tab-active' );
814
- } else {
815
- $( '.<?php
816
  echo $this->prefix ;
817
- ?>nav-tab-wrapper a:first' ).addClass( 'nav-tab-active' );
818
- }
819
- $( '.<?php
820
  echo $this->prefix ;
821
- ?>nav-tab-wrapper a:not(.js-nav-tab-minor)' ).click( function ( evt ) {
822
 
823
- if ( typeof ( localStorage ) != 'undefined' ) {
824
- localStorage.setItem( '<?php
825
  echo $this->prefix ;
826
- ?>settings-active-tab', $( this ).attr( 'href' ) );
827
- }
828
 
829
- $( '.<?php
830
  echo $this->prefix ;
831
- ?>nav-tab-wrapper a' ).removeClass( 'nav-tab-active' );
832
 
833
- $( this ).addClass( 'nav-tab-active' ).blur();
834
- var clicked_group = $( this ).attr( 'href' );
835
 
836
 
837
- $( '.<?php
838
  echo $this->prefix ;
839
- ?>group' ).hide();
840
- $( clicked_group ).fadeIn();
841
- markActiveGroup($( clicked_group ));
842
- evt.preventDefault();
843
- } );
844
 
845
- $( '.<?php
846
  echo $this->prefix ;
847
- ?>browse' ).on( 'click', function ( event ) {
848
- event.preventDefault();
849
 
850
- var self = $( this );
851
 
852
- // Create the media frame.
853
- var file_frame = wp.media.frames.file_frame = wp.media( {
854
- title: self.data( 'uploader_title' ),
855
- button: {
856
- text: self.data( 'uploader_button_text' ),
857
- },
858
- multiple: false
859
- } );
860
 
861
- file_frame.on( 'select', function () {
862
- attachment = file_frame.state().get( 'selection' ).first().toJSON();
863
 
864
- self.prev( '.<?php
865
  echo $this->prefix ;
866
- ?>url' ).val( attachment.url );
867
- } );
868
 
869
- // Finally, open the modal
870
- file_frame.open();
871
- } );
872
- } );
873
  </script>
874
 
875
  <style type="text/css">
876
  /** WordPress 3.8 Fix **/
877
- .form-table th { padding: 20px 10px; }
878
- #wpbody-content .metabox-holder { padding-top: 5px; }
 
 
 
 
 
879
  </style>
880
  <?php
881
  }
9
  }
10
  /**
11
  * Adapted from https://github.com/tareq1988/wordpress-settings-api-class
12
+ *
13
  */
14
  /**
15
  * weDevs Settings API wrapper class
54
  private $prefix ;
55
  /*
56
  * Constructor
57
+ *
58
  * @param string $prefix - unique prefix for CSS classes and other names
59
  */
60
  public function __construct( $name = '' )
82
  /**
83
  * Set settings sections
84
  *
85
+ * @param array $sections setting sections array
86
  */
87
  function set_sections( $sections )
88
  {
93
  /**
94
  * Add a single section
95
  *
96
+ * @param array $section
97
  */
98
  function add_section( $section )
99
  {
104
  /**
105
  * Set settings fields
106
  *
107
+ * @param array $fields settings fields array
108
  */
109
  function set_fields( $fields )
110
  {
144
  if ( isset( $section['desc'] ) && !empty($section['desc']) ) {
145
  $section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
146
  $callback = create_function( '', 'echo "' . str_replace( '"', '\\"', $section['desc'] ) . '";' );
147
+ } elseif ( isset( $section['callback'] ) ) {
148
+ $callback = $section['callback'];
149
  } else {
150
+ $callback = null;
 
 
 
 
 
 
151
  }
152
 
153
  add_settings_section(
192
  /**
193
  * Get field description for display
194
  *
195
+ * @param array $args settings field args
196
  */
197
  public function get_field_description( $args )
198
  {
218
  /**
219
  * Displays a text field for a settings field
220
  *
221
+ * @param array $args settings field args
222
  */
223
  function callback_text( $args )
224
  {
247
  /**
248
  * Displays a url field for a settings field
249
  *
250
+ * @param array $args settings field args
251
  */
252
  function callback_url( $args )
253
  {
257
  /**
258
  * Displays a number field for a settings field
259
  *
260
+ * @param array $args settings field args
261
  */
262
  function callback_number( $args )
263
  {
267
  /**
268
  * Displays a checkbox for a settings field
269
  *
270
+ * @param array $args settings field args
271
  */
272
  function callback_checkbox( $args )
273
  {
294
  /**
295
  * Displays a multicheckbox a settings field
296
  *
297
+ * @param array $args settings field args
298
  */
299
  function callback_multicheck( $args )
300
  {
330
  /**
331
  * Displays a multicheckbox a settings field
332
  *
333
+ * @param array $args settings field args
334
  */
335
  function callback_radio( $args )
336
  {
367
  /**
368
  * Displays a selectbox for a settings field
369
  *
370
+ * @param array $args settings field args
371
  */
372
  function callback_select( $args )
373
  {
400
  /**
401
  * Displays a selectize multiple select for a settings field
402
  *
403
+ * @param array $args settings field args
404
  */
405
  function callback_selectize( $args )
406
  {
411
  $args
412
  );
413
  $options = ( !empty($args['options']) && is_array( $args['options'] ) ? $args['options'] : array() );
414
+ $nonce = wp_create_nonce( 'dgwt_wcas_get_custom_fields' );
415
  $html = sprintf(
416
+ '<input type="select-multiple" data-options="%4$s" class="dgwt-wcas-selectize" autocomplete="off" id="%1$s[%2$s]" name="%1$s[%2$s]" value="%3$s" data-security="%5$s"/>',
417
  $this->name,
418
  $args['id'],
419
  $value,
420
+ http_build_query( $options ),
421
+ $nonce
422
  );
423
  $html .= $this->get_field_description( $args );
424
  echo $html ;
427
  /**
428
  * Displays a textarea for a settings field
429
  *
430
+ * @param array $args settings field args
431
  */
432
  function callback_textarea( $args )
433
  {
452
  /**
453
  * Displays a textarea for a settings field
454
  *
455
+ * @param array $args settings field args
456
+ *
457
  * @return string
458
  */
459
  function callback_html( $args )
472
  /**
473
  * Displays a rich text textarea for a settings field
474
  *
475
+ * @param array $args settings field args
476
  */
477
  function callback_wysiwyg( $args )
478
  {
495
  /**
496
  * Displays a file upload field for a settings field
497
  *
498
+ * @param array $args settings field args
499
  */
500
  function callback_file( $args )
501
  {
519
  /**
520
  * Displays a password field for a settings field
521
  *
522
+ * @param array $args settings field args
523
  */
524
  function callback_password( $args )
525
  {
539
  /**
540
  * Displays a color picker field for a settings field
541
  *
542
+ * @param array $args settings field args
543
  */
544
  function callback_color( $args )
545
  {
560
  /**
561
  * Displays a color picker field for a settings field
562
  *
563
+ * @param array $args settings field args
564
  */
565
  function callback_desc( $args )
566
  {
578
  /**
579
  * Displays a color picker field for a settings field
580
  *
581
+ * @param array $args settings field args
582
  */
583
  function callback_datepicker( $args )
584
  {
644
  /**
645
  * Get the value of a settings field
646
  *
647
+ * @param string $option settings field name
648
+ * @param string $default default text if it's not found
649
+ * @param bool $not_empty allow empty value
650
+ *
651
  * @return string
652
  */
653
  function get_option( $option, $default = '', $allow_empty = true )
738
  {
739
  ?>
740
  <script>
741
+ jQuery(document).ready(function ($) {
742
 
743
+ function markActiveGroup($group) {
744
 
745
+ var name = $group.attr('id').replace('dgwt_wcas_', '');
746
 
747
+ $group.addClass('dgwt-wcas-group-active');
748
+ $group.closest('.js-dgwt-wcas-settings-body').attr('data-dgwt-wcas-active', name)
749
 
750
+ }
751
 
752
+ //Initiate Color Picker
753
+ if ($('.wp-color-picker-field').length > 0) {
754
+ $('.wp-color-picker-field').wpColorPicker({
755
+ change: function (event, ui) {
756
+ window.DGWT_WCAS_SEARCH_PREVIEW.onColorChangeHandler($(event.target), ui.color.toString());
757
+ },
758
+ });
759
+ }
760
 
761
+ // Switches option sections
762
+ $('.<?php
763
  echo $this->prefix ;
764
+ ?>group').hide();
765
+ var activetab = '';
766
+ var maybe_active = '';
767
 
768
+ if (typeof (localStorage) != 'undefined') {
769
+ maybe_active = localStorage.getItem('<?php
770
  echo $this->prefix ;
771
+ ?>settings-active-tab');
772
 
773
+ if (maybe_active) {
774
 
775
+ // Check if tabs exists
776
+ $('.<?php
777
  echo $this->prefix ;
778
+ ?>nav-tab-wrapper a:not(.js-nav-tab-minor)').each(function () {
779
 
780
+ if ($(this).attr('href') === maybe_active) {
781
+ activetab = maybe_active;
782
+ }
783
+ });
784
 
785
+ }
786
+ }
787
 
788
+ if (activetab != '' && $(activetab).length) {
789
+ $(activetab).fadeIn();
790
+ markActiveGroup($(activetab));
791
+ } else {
792
+ $('.<?php
793
  echo $this->prefix ;
794
+ ?>group:first').fadeIn();
795
+ markActiveGroup($('.<?php
796
  echo $this->prefix ;
797
+ ?>group:first'));
798
+ }
799
+ $('.<?php
800
  echo $this->prefix ;
801
+ ?>group .collapsed').each(function () {
802
+ $(this).find('input:checked').parent().parent().parent().nextAll().each(
803
+ function () {
804
+ if ($(this).hasClass('last')) {
805
+ $(this).removeClass('hidden');
806
+ return false;
807
+ }
808
+ $(this).filter('.hidden').removeClass('hidden');
809
+ });
810
+ });
811
 
812
+ if (activetab != '' && $(activetab + '-tab').length) {
813
+ $(activetab + '-tab').addClass('nav-tab-active');
814
+ } else {
815
+ $('.<?php
816
  echo $this->prefix ;
817
+ ?>nav-tab-wrapper a:first').addClass('nav-tab-active');
818
+ }
819
+ $('.<?php
820
  echo $this->prefix ;
821
+ ?>nav-tab-wrapper a:not(.js-nav-tab-minor)').click(function (evt) {
822
 
823
+ if (typeof (localStorage) != 'undefined') {
824
+ localStorage.setItem('<?php
825
  echo $this->prefix ;
826
+ ?>settings-active-tab', $(this).attr('href'));
827
+ }
828
 
829
+ $('.<?php
830
  echo $this->prefix ;
831
+ ?>nav-tab-wrapper a').removeClass('nav-tab-active');
832
 
833
+ $(this).addClass('nav-tab-active').blur();
834
+ var clicked_group = $(this).attr('href');
835
 
836
 
837
+ $('.<?php
838
  echo $this->prefix ;
839
+ ?>group').hide();
840
+ $(clicked_group).fadeIn();
841
+ markActiveGroup($(clicked_group));
842
+ evt.preventDefault();
843
+ });
844
 
845
+ $('.<?php
846
  echo $this->prefix ;
847
+ ?>browse').on('click', function (event) {
848
+ event.preventDefault();
849
 
850
+ var self = $(this);
851
 
852
+ // Create the media frame.
853
+ var file_frame = wp.media.frames.file_frame = wp.media({
854
+ title: self.data('uploader_title'),
855
+ button: {
856
+ text: self.data('uploader_button_text'),
857
+ },
858
+ multiple: false
859
+ });
860
 
861
+ file_frame.on('select', function () {
862
+ attachment = file_frame.state().get('selection').first().toJSON();
863
 
864
+ self.prev('.<?php
865
  echo $this->prefix ;
866
+ ?>url').val(attachment.url);
867
+ });
868
 
869
+ // Finally, open the modal
870
+ file_frame.open();
871
+ });
872
+ });
873
  </script>
874
 
875
  <style type="text/css">
876
  /** WordPress 3.8 Fix **/
877
+ .form-table th {
878
+ padding: 20px 10px;
879
+ }
880
+
881
+ #wpbody-content .metabox-holder {
882
+ padding-top: 5px;
883
+ }
884
  </style>
885
  <?php
886
  }
includes/BackwardCompatibility.php DELETED
@@ -1,486 +0,0 @@
1
- <?php
2
-
3
- namespace DgoraWcas;
4
-
5
- class BackwardCompatibility
6
- {
7
-
8
- private $remindMeLaterTransient = 'dgwt_wcas_bc_remind_me_later';
9
-
10
- public function __construct()
11
- {
12
- $this->maybeEnsureCompatibility();
13
-
14
- add_action('wp_ajax_dgwt_wcas_bc_keep_latest', array($this, 'wipeAllAjax'));
15
- add_action('wp_ajax_dgwt_wcas_bc_toggle', array($this, 'toggleAjax'));
16
- add_action('wp_ajax_dgwt_wcas_bc_remind_me_later', array($this, 'remindMeLaterAjax'));
17
-
18
- add_action('wp_ajax_dgwt_wcas_bc_dismiss_ar_notice', array($this, 'dismissActionRequiredNotice'));
19
-
20
- add_action('admin_notices', array($this, 'actionRequiredNotice'));
21
- }
22
-
23
- /**
24
- * Show admin notice
25
- *
26
- * @return void
27
- */
28
- public function actionRequiredNotice()
29
- {
30
-
31
- if (defined('DISABLE_NAG_NOTICES') && DISABLE_NAG_NOTICES) {
32
- return;
33
- }
34
-
35
- if(get_option('dgwt_wcas_dismiss_bc_action_required_notice')){
36
- return;
37
- }
38
-
39
- $cs = get_current_screen();
40
- $views = array(
41
- 'dashboard',
42
- 'update-core',
43
- 'plugins'
44
- );
45
-
46
-
47
- if ( ! empty($cs->id) && in_array($cs->id, $views) && $this->canShowNotice()) {
48
- ?>
49
- <div class="js-dgwt-wcas-bc-action-required notice notice-info is-dismissible">
50
- <p>
51
- <b><?php _e('AJAX Search for WooCommerce', 'sample-text-domain'); ?></b>
52
- <b>[<?php _e('Action Required', 'sample-text-domain'); ?>]</b>
53
- - <?php printf(__('You have updated the plugin to the latest version %s. You need to complete the updating process manually. <a href="%s">Go to the plugin page</a>.', 'sample-text-domain'), '(v' . DGWT_WCAS_VERSION . ')', Helpers::getSettingsUrl()); ?>
54
- </p>
55
- </div>
56
- <?php
57
-
58
- add_filter('admin_footer', function(){
59
- ?>
60
- <script>
61
- jQuery(document).on('click', '.js-dgwt-wcas-bc-action-required .notice-dismiss', function(e){
62
- e.preventDefault();
63
- jQuery.ajax({
64
- url: ajaxurl,
65
- type: 'post',
66
- data: {
67
- action: 'dgwt_wcas_bc_dismiss_ar_notice'
68
- }
69
- });
70
- })
71
- </script>
72
- <?php
73
- });
74
- }
75
-
76
- }
77
-
78
- /**
79
- * Get last backward compatible version
80
- *
81
- * @return void
82
- */
83
- public static function getCompatibleVersion()
84
- {
85
- $version = get_option('dgwt_wcas_backward_compatibility_version');
86
-
87
- return empty($version) ? '' : $version;
88
- }
89
-
90
- /**
91
- * Enable backward compatibility
92
- *
93
- * @return bool true if the action was successful
94
- */
95
- private function enable()
96
- {
97
- $enabled = false;
98
- $cv = self::getCompatibleVersion();
99
- if ( ! empty($cv)) {
100
- $enabled = update_option('dgwt_wcas_backward_compatibility', 'on');
101
- }
102
-
103
- return $enabled;
104
- }
105
-
106
- /**
107
- * Disable backward compatibility
108
- *
109
- * @return bool true if the action was successful
110
- */
111
- public function disable()
112
- {
113
- return update_option('dgwt_wcas_backward_compatibility', 'off');
114
- }
115
-
116
- /**
117
- * Enable or disable BC via ajax
118
- *
119
- * @return string json
120
- */
121
- public function toggleAjax()
122
- {
123
- $status = false;
124
-
125
- if ( ! empty($_REQUEST['state'])) {
126
- switch ($_REQUEST['state']) {
127
- case 'enable':
128
- $status = $this->enable();
129
- break;
130
- case 'disable':
131
- $status = $this->disable();
132
- break;
133
- }
134
- }
135
-
136
- if ($status) {
137
- wp_send_json_success();
138
- }
139
-
140
- wp_send_json_error();
141
-
142
- }
143
-
144
- /**
145
- * Set transient (one week) for remind me later in notice
146
- *
147
- * @return void
148
- */
149
- public function remindMeLaterAjax()
150
- {
151
-
152
- if (set_transient($this->remindMeLaterTransient, true, (60 * 60 * 24 * 3))) {
153
- wp_send_json_success();
154
- }
155
-
156
- wp_send_json_error();
157
-
158
- }
159
-
160
- /**
161
- * Dismiss extra notice to inform about manually updating
162
- *
163
- * @return void
164
- */
165
- public function dismissActionRequiredNotice()
166
- {
167
-
168
- if (add_option('dgwt_wcas_dismiss_bc_action_required_notice', true)) {
169
- wp_send_json_success();
170
- }
171
-
172
- wp_send_json_error();
173
- }
174
-
175
- /**
176
- * Check if backward compatibility options exist.
177
- *
178
- * @return bool
179
- */
180
- public function optionsExists()
181
- {
182
- $optBc = get_option('dgwt_wcas_backward_compatibility');
183
- $optBcVersion = get_option('dgwt_wcas_backward_compatibility_version');
184
-
185
- return ! empty($optBc) && ! empty($optBcVersion);
186
- }
187
-
188
- /**
189
- * Check if backward compatibility is enabled
190
- *
191
- * @return bool
192
- */
193
- private function isEnabled()
194
- {
195
- $opt = get_option('dgwt_wcas_backward_compatibility');
196
-
197
- return ! empty($opt) && $opt === 'on';
198
- }
199
-
200
- /**
201
- * Load backward asstes and partials if it is necessary
202
- *
203
- * @return bool true if loading backward compatible files was necessary
204
- */
205
- private function maybeEnsureCompatibility()
206
- {
207
- $ensured = false;
208
- $cv = self::getCompatibleVersion();
209
- if (
210
- $this->isEnabled()
211
- && $cv
212
- && version_compare($cv, '0.0.1', '>=') >= 0 // Check if version is correct
213
- && version_compare(DGWT_WCAS_VERSION, $cv, '>')
214
- ) {
215
- $methodName = 'compatibleWith_' . str_replace('.', '_', $cv);
216
-
217
- if (method_exists($this, $methodName)) {
218
- $this->$methodName();
219
- $ensured = true;
220
- }
221
-
222
-
223
- }
224
-
225
- return $ensured;
226
- }
227
-
228
- /**
229
- * Wipe all information about backward compatibility
230
- *
231
- * @return bool true on success
232
- */
233
- private function wipeAll()
234
- {
235
-
236
- $bc = delete_option('dgwt_wcas_backward_compatibility');
237
- $bcv = delete_option('dgwt_wcas_backward_compatibility_version');
238
-
239
- return ($bc && $bcv);
240
- }
241
-
242
- public function wipeAllAjax()
243
- {
244
- $status = $this->wipeAll();
245
-
246
- wp_send_json_success($status);
247
- }
248
-
249
- /**
250
- * Load v1.1.7 assets and partials
251
- * style.css, jquery.dgwt-wcas.min.js and search-form.php
252
- *
253
- * @return void
254
- */
255
- public function compatibleWith_1_1_7()
256
- {
257
- // CSS
258
- add_filter('dgwt/wcas/scripts/css_style_url', function ($url) {
259
- return DGWT_WCAS_URL . 'backward-compatibility/1-1-7/style.css';
260
- });
261
-
262
- // JS
263
- add_filter('dgwt/wcas/scripts/js_url', function ($url) {
264
- return DGWT_WCAS_URL . 'backward-compatibility/1-1-7/jquery.dgwt-wcas.min.js';
265
- });
266
-
267
- // Form partial path
268
- add_filter('dgwt/wcas/form/partial_path', function ($url) {
269
- return DGWT_WCAS_DIR . 'backward-compatibility/1-1-7/search-form.php';
270
- });
271
-
272
- // Body classes
273
- add_filter('body_class', function ($classes) {
274
-
275
- $classes[] = 'dgwt-wcas-bc-1-1-7';
276
-
277
- return $classes;
278
-
279
- });
280
-
281
- }
282
-
283
- /**
284
- *
285
- */
286
- public function canShowNotice()
287
- {
288
- $canShow = false;
289
-
290
- $optBc = get_option('dgwt_wcas_backward_compatibility');
291
- $optVersion = get_option('dgwt_wcas_backward_compatibility_version');
292
-
293
- $remindMeLater = get_transient($this->remindMeLaterTransient);
294
-
295
- if ($remindMeLater) {
296
- return false;
297
- }
298
-
299
- if (
300
- ! empty($optBc)
301
- && ! empty($optVersion)
302
- && in_array($optBc, array('on', 'off'))
303
- && version_compare($optVersion, '0.0.1', '>=') >= 0
304
- && version_compare(DGWT_WCAS_VERSION, $optVersion, '>')
305
- ) {
306
- $canShow = true;
307
-
308
- } else {
309
- $this->wipeAll();
310
- }
311
-
312
- return $canShow;
313
- }
314
-
315
- /**
316
- * Notice
317
- *
318
- * @return void
319
- */
320
- public function notice()
321
- {
322
-
323
- if ( ! $this->canShowNotice()) {
324
- return;
325
- }
326
-
327
- $theme = wp_get_theme();
328
- $themeName = $theme->get('Name');
329
- $themeUri = $theme->get('ThemeURI');
330
- $themeAuthor = $theme->get('Author');
331
- $themeAuthorURL = $theme->get('Author URI');
332
- $themeLink = ! empty($themeUri) ? '<a href="' . esc_url($themeUri) . '">' . esc_html($themeName) . '</a>' : '<b>"' . esc_html($themeName) . '"</b>';
333
-
334
- $vompatibleVersion = self::getCompatibleVersion();
335
-
336
- $troubleshootingLink = '<a href="#TB_inline?width=600&height=550&inlineId=dgwt-wcas-troubleshooting" class="thickbox" title="' . __('Troubleshooting',
337
- 'ajax-search-for-woocommerce') . '">' . __('troubleshooting',
338
- 'ajax-search-for-woocommerce') . '</a>';
339
- add_thickbox();
340
- ob_start();
341
- ?>
342
-
343
-
344
- <div class="dgwt-wcas-settings-info dgwt-wcas-bc-notice js-dgwt-wcas-bc-notice">
345
- <div class="dgwt-wcas-bc-main-notice">
346
- <span class="dgwt-wcas-bc-notice-head"><?php echo __('<span style="color:#9b5c8f">Complete the update process</span>', 'ajax-search-for-woocommerce'); ?></span>- <?php _e('In the last update we have changed the AJAX search form on the frontend (CSS styles, names of the HTML classes etc.). You have to check if the AJAX search form looks correct with your theme after these changes.', 'ajax-search-for-woocommerce') ?>
347
- </div>
348
-
349
- <div class="dgwt-wcas-container">
350
-
351
- <div class="dgwt-wcas-bc-todo-wrapp">
352
-
353
- <div class="js-dgwt-wcas-todo-old<?php echo ! $this->isEnabled() ? ' dgwt-wcas-hidden' : ''; ?>">
354
- <span class="dgwt-wcas-bc-todo-head"><?php _e('What should you do now?', 'ajax-search-for-woocommerce'); ?></span>
355
-
356
- <ol class="dgwt-wcas-bc-steps">
357
- <li><?php _e('Switch manually to the latest version to check if the AJAX search form displays correctly with your theme', 'ajax-search-for-woocommerce'); ?></li>
358
- </ol>
359
- </div>
360
-
361
- <div class="js-dgwt-wcas-todo-latest<?php echo $this->isEnabled() ? ' dgwt-wcas-hidden' : ''; ?>">
362
- <span class="dgwt-wcas-bc-todo-head dgwt-wcas-bc-todo-head--latest"><?php _e('You have activated the latest version. Follow the steps below:', 'ajax-search-for-woocommerce'); ?></span>
363
-
364
- <ol class="dgwt-wcas-bc-steps">
365
- <li><?php printf(__('Visit your <a target="_blank" href="%s">store</a>', 'ajax-search-for-woocommerce'), get_permalink(wc_get_page_id('shop'))); ?></li>
366
- <li><?php _e('Check if the AJAX search form displays correctly', 'ajax-search-for-woocommerce'); ?></li>
367
- <li><?php printf(__('If it is ok, click %s', 'ajax-search-for-woocommerce'), '<button class="button button-small dgwt-wcas-bc-button-approve js-dgwt-wcas-bc-wipe-all">' . __('finish the update', 'ajax-search-for-woocommerce') . '</button>'); ?></li>
368
- <li><?php printf(__('If not, switch back to <code>previous version %s</code> and see %s', 'ajax-search-for-woocommerce'), '(v' . $vompatibleVersion . ')', $troubleshootingLink); ?></li>
369
- </ol>
370
- </div>
371
-
372
- </div>
373
-
374
- <div class="dgwt-wcas-bc-switcher">
375
- <h3 class="dgwt-wcas-bc-switcher-head"><?php _e('Version switcher', 'ajax-search-for-woocommerce'); ?></h3>
376
- <div class="dgwt-wcas-bc-error dgwt-wcas-hidden"><?php _e('Something went wrong. Refresh the page and try again.', 'ajax-search-for-woocommerce'); ?></div>
377
- <div class="dgwt-wcas-bc-success dgwt-wcas-hidden"><?php _e('Saved!', 'ajax-search-for-woocommerce'); ?></div>
378
-
379
- <label class="dgwt-wcas-toggler js-dgwt-wcas-switch-left<?php echo $this->isEnabled() ? ' dgwt-wcas-toggler--is-active' : ''; ?>"><?php echo __('previous version', 'ajax-search-for-woocommerce') . ' <small>( v' . $vompatibleVersion . ')</small>'; ?></label>
380
- <div class="dgwt-wcas-toggle<?php echo $this->isEnabled() ? ' dgwt-wcas-toggle--mute' : ''; ?>">
381
- <input type="checkbox" <?php checked(true, $this->isEnabled(), true); ?> class="dgwt-wcas-check js-dgwt-wcas-switcher">
382
- <div class="dgwt-wcas-switch">
383
- <img class="js-dgwt-wcas-bc-spinner dgwt-wcas-bc-spinner dgwt-wcas-hidden" src="<?php echo DGWT_WCAS_URL; ?>/assets/img/preloader.gif">
384
- </div>
385
- </div>
386
- <label class="dgwt-wcas-toggler js-dgwt-wcas-switch-right<?php echo ! $this->isEnabled() ? ' dgwt-wcas-toggler--is-active' : ''; ?>"><?php echo __('latest version', 'ajax-search-for-woocommerce') . ' <small>( v' . DGWT_WCAS_VERSION . ')</small>'; ?></label>
387
- </div>
388
-
389
- </div>
390
-
391
-
392
- <br/>
393
- <small><?php printf(__('If the AJAX search form displays incorrectly after switching to the latest version, see the %s', 'ajax-search-for-woocommerce'), $troubleshootingLink); ?></small>
394
-
395
-
396
- <div id="dgwt-wcas-troubleshooting" class="js-dgwt-wcas-read-more-wrapp hidden">
397
-
398
-
399
- <h3>
400
- #1 <?php echo __('Your AJAX search form does not display correctly after manual switching to the latest version.', 'ajax-search-for-woocommerce'); ?>
401
- </h3>
402
-
403
- <p>
404
- <?php printf(__('Probably your theme uses additional CSS styles to customize the appearance of the AJAX search form. Contact the authors of your theme. Maybe they have to update their CSS styles if necessary.', 'ajax-search-for-woocommerce'), $themeLink); ?>
405
- </p>
406
-
407
- <table>
408
- <tbody>
409
- <tr>
410
- <td colspan="2" style="letter-spacing: 3px;border-bottom: 1px solid #eee;"><?php _e('Your Theme Details', 'ajax-search-for-woocommerce'); ?></td>
411
- </tr>
412
-
413
- <?php if ( ! empty($themeName)): ?>
414
- <tr>
415
- <th><?php _ex('Name:', 'Wordpress theme name', 'ajax-search-for-woocommerce'); ?></th>
416
- <td>
417
- <?php
418
- if ( ! empty($themeUri)) {
419
- echo '<a href="' . $themeUri . '" target="_blank">' . $themeName . '</a>';
420
- } else {
421
- echo $themeName;
422
- }
423
- ?>
424
- </td>
425
- </tr>
426
- <?php endif; ?>
427
-
428
- <?php if ( ! empty($themeAuthor)): ?>
429
- <tr>
430
- <th><?php _e('Author:', 'ajax-search-for-woocommerce'); ?></th>
431
- <td>
432
- <?php
433
- if ( ! empty($themeAuthorURL)) {
434
- echo '<a href="' . $themeAuthorURL . '" target="_blank">' . $themeAuthor . '</a>';
435
- } else {
436
- echo $themeAuthor;
437
- }
438
- ?>
439
- </td>
440
- </tr>
441
- <?php endif; ?>
442
-
443
- </tbody>
444
- </table>
445
-
446
- <p>
447
- <?php printf(__('A sample e-mail message that you can send them:', 'ajax-search-for-woocommerce'), $themeLink); ?>
448
- </p>
449
-
450
- <div class="dgwt-wcas-settings-info" style="font-size: 85%;line-height: 120%">
451
- <?php
452
- echo sprintf(__(
453
- "Hello,
454
- <br /><br />
455
- I use your %s theme with AJAX Search for WooCommerce plugin - (https://wordpress.org/plugins/ajax-search-for-woocommerce/)
456
- <br /><br />
457
- In the lates version of AJAX Search for WooCommerce %s they have changed the search form on the frontend (CSS, HTML etc.).
458
- <br /><br />
459
- Could you check it and update your CSS if necessary?", 'ajax-search-for-woocommerce'),
460
- $themeName,
461
- '(v' . DGWT_WCAS_VERSION . ')');
462
- ?>
463
- </div>
464
-
465
- <br/>
466
- <br/>
467
- <p>
468
- <?php _e('If you have any questions, do not hesitate contact <a href="mailto:dgoraplugins@gmail.com?subject=Ajax Search for WooCommerce - Update problem">our support </a> or <a href="https://wordpress.org/support/plugin/ajax-search-for-woocommerce" target="_blank">write on the WordPress.org Support</a>.', 'ajax-search-for-woocommerce'); ?>
469
- </p>
470
-
471
- </div>
472
-
473
- <a href="#" class="dgwt-wcas-bc-remind-me js-dgwt-wcas-bc-remind-me">
474
- <span class="dashicons dashicons-no-alt"></span>
475
- <?php _e('Remind me later', 'ajax-search-for-woocommerce') ?>
476
- </a>
477
- </div>
478
- <?php
479
-
480
- $html = ob_get_contents();
481
- ob_end_clean();
482
-
483
- return $html;
484
- }
485
-
486
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Conflicts/Solver.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
-
3
- namespace DgoraWcas\Conflicts;
4
-
5
- /**
6
- * Class Solver
7
- *
8
- * Solves conflicts with other plugins
9
- */
10
- class Solver
11
- {
12
-
13
- public function __construct()
14
- {
15
- $this->solveSearchWPWooCommerceIntegration();
16
-
17
- $this->solveDiviWithBuilderWC();
18
- }
19
-
20
- /**
21
- * Solves conflict with SearchWP WooCommerce Integration by SearchWP, LLC
22
- * Tested version: plugin SearchWP WooCommerce Integration by SearchWP v1.2.1
23
- *
24
- * Reason: Empty search page (no results). The plugin removes query_vars['s']
25
- *
26
- * @return void
27
- */
28
- public function solveSearchWPWooCommerceIntegration()
29
- {
30
- if (isset($_GET['dgwt_wcas'])) {
31
- add_filter('searchwp_woocommerce_forced', '__return_false', PHP_INT_MAX);
32
- add_filter('searchwp_short_circuit', '__return_true', PHP_INT_MAX);
33
- }
34
-
35
- }
36
-
37
- /**
38
- * Solves conflict with the DIVI builder
39
- * Tested version: theme DIVI v3.19.18
40
- *
41
- * Reason: WP Query for search results was overwritten ih the hook pre_get_posts
42
- */
43
- public function solveDiviWithBuilderWC()
44
- {
45
- add_action('init', function () {
46
- if (isset($_GET['dgwt_wcas'])) {
47
- remove_action('pre_get_posts', 'et_builder_wc_pre_get_posts', 10);
48
- }
49
- });
50
- }
51
-
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/EmbeddingViaMenu.php CHANGED
@@ -3,218 +3,209 @@
3
  namespace DgoraWcas;
4
 
5
  // Exit if accessed directly
6
- if ( ! defined('ABSPATH')) {
7
- exit;
8
  }
9
 
10
- class EmbeddingViaMenu
11
- {
12
- const SEARCH_PLACEHOLDER = 'dgwt_wcas_search_box';
13
-
14
- public function init()
15
- {
16
-
17
- if (is_admin()) {
18
- add_action('admin_head-nav-menus.php', array($this, 'addNavMenuMetaBoxes'));
19
-
20
- add_action('admin_head', array($this, 'navMenuStyle'));
21
- add_action('admin_footer', array($this, 'navMenuScripts'));
22
-
23
- }else{
24
-
25
- add_filter( 'walker_nav_menu_start_el', array( $this, 'processMenuItem' ), 50, 2 );
26
- add_filter( 'megamenu_walker_nav_menu_start_el', array( $this, 'processMenuItem' ), 50, 2 );
27
-
28
- }
29
- }
30
-
31
- /**
32
- * Check if nav-menus screen is active
33
- *
34
- * @return bool
35
- */
36
- private function isNavMenuScreen()
37
- {
38
- $isNav = false;
39
- $screen = get_current_screen();
40
-
41
- if ( ! empty($screen->id) && ($screen->id === 'nav-menus')) {
42
- $isNav = true;
43
- }
44
-
45
- return $isNav;
46
- }
47
-
48
- /**
49
- * Add custom nav meta box.
50
- *
51
- * Adapted from http://www.johnmorrisonline.com/how-to-add-a-fully-functional-custom-meta-box-to-wordpress-navigation-menus/.
52
- *
53
- * @return void
54
- */
55
- public function addNavMenuMetaBoxes()
56
- {
57
- add_meta_box('dgwt_wcas_endpoints_nav_link', __('AJAX Search bar', 'ajax-search-for-woocommerce'), array($this, 'navMenuLinks'), 'nav-menus', 'side',
58
- 'low');
59
- }
60
-
61
- /**
62
- * Modifies the menu item display on frontend.
63
- *
64
- * @param string $itemOutput
65
- *
66
- * @return string
67
- */
68
- public function processMenuItem($itemOutput)
69
- {
70
-
71
- if (
72
- ! empty($itemOutput)
73
- && is_string($itemOutput)
74
- && strpos($itemOutput, self::SEARCH_PLACEHOLDER) !== false
75
- ) {
76
- $itemOutput = do_shortcode('[wcas-search-form]');
77
- }
78
-
79
- return $itemOutput;
80
- }
81
-
82
- /**
83
- * Output menu links.
84
- *
85
- * @return void
86
- */
87
- public function navMenuLinks()
88
- {
89
- ?>
90
- <div id="posttype-dgwt-wcas-endpoints" class="posttypediv">
91
- <p><?php _e('Add AJAX search bar as a menu item.', 'ajax-search-for-woocommerce') ?></p>
92
- <div id="tabs-panel-dgwt-wcas-endpoints" class="tabs-panel tabs-panel-active">
93
- <ul id="dgwt-wcas-endpoints-checklist" class="categorychecklist form-no-clear">
94
- <li>
95
- <label class="menu-item-title">
96
- <input type="checkbox" class="menu-item-checkbox" name="menu-item[-1][menu-item-object-id]"
97
- value="-1"/> <?php echo __('AJAX Search bar', 'ajax-search-for-woocommerce'); ?>
98
- </label>
99
- <input type="hidden" class="menu-item-type" name="menu-item[-1][menu-item-type]" value="custom"/>
100
- <input type="hidden" class="menu-item-title" name="menu-item[-1][menu-item-title]" value="<?php echo self::SEARCH_PLACEHOLDER; ?>"/>
101
- <input type="hidden" class="menu-item-classes" name="menu-item[-1][menu-item-classes]"/>
102
- </li>
103
- </ul>
104
- </div>
105
- <p class="button-controls">
106
  <span class="add-to-menu">
107
- <button type="submit" class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to menu', 'woocommerce'); ?>"
108
- name="add-post-type-menu-item" id="submit-posttype-dgwt-wcas-endpoints"><?php esc_html_e('Add to menu', 'woocommerce'); ?></button>
109
  <span class="spinner"></span>
110
  </span>
111
- </p>
112
- </div>
113
- <?php
114
- }
115
 
116
- public function getDescription()
117
- {
118
- $html = '<div class="dgwt-wcas-admin-menu-item-desc js-dgwt-wcas-admin-menu-item-desc">';
119
- $html .= '<img class="" src="' . DGWT_WCAS_URL . 'assets/img/logo-for-review.jpg" width="32" height="32" />';
120
- $html .= '<span>' . __('AJAX search bar will be displayed here.', 'ajax-search-for-woocommerce') . '</span>';
121
- $html .= '</div>';
122
 
123
- return $html;
124
- }
125
 
126
- public function navMenuStyle()
127
- {
128
 
129
- if ( ! $this->isNavMenuScreen()) {
130
- return;
131
- }
132
 
133
- ?>
134
- <style>
135
- .dgwt-wcas-admin-menu-item-desc {
136
- display: flex;
137
- flex-direction: row;
138
- justify-content: left;
139
- align-items: center;
140
- }
141
 
142
- .dgwt-wcas-admin-menu-item-desc img {
143
- display: block;
144
- margin-right: 15px;
145
- border-radius: 4px;
146
- }
147
- </style>
148
 
149
- <?php
150
 
151
- }
152
 
153
- public function navMenuScripts()
154
- {
155
 
156
- if ( ! $this->isNavMenuScreen()) {
157
- return;
158
- }
159
 
160
- ?>
161
- <script>
162
- (function ($) {
163
 
164
- function replaceLabels($menuItem) {
165
 
166
- var $menuItems = $('#menu-to-edit .menu-item-title');
167
 
168
- if ($menuItems.length > 0) {
169
 
170
- $menuItems.each(function () {
171
- if ($(this).text() === '<?php echo self::SEARCH_PLACEHOLDER; ?>') {
172
 
173
- var $menuItem = $(this).closest('.menu-item');
174
 
175
- $menuItem.find('.menu-item-title').text('AJAX Search bar');
176
- $menuItem.find('.item-type').text('<?php _e('Search bar', 'ajax-search-for-woocommerce'); ?>');
177
- $menuItem.find('.menu-item-settings .edit-menu-item-title').closest('label').hide();
178
- $menuItem.find('.field-url').hide();
179
 
180
 
181
- if ($menuItem.find('.js-dgwt-wcas-admin-menu-item-desc').length == 0) {
182
- $menuItem.find('.menu-item-settings').prepend('<?php echo $this->getDescription(); ?>');
183
- }
184
- }
185
- });
186
- }
187
- }
188
 
189
- $(document).ready(function () {
190
 
191
- replaceLabels();
192
 
193
- });
194
 
195
- $(document).ajaxComplete(function (event, request, settings) {
196
 
197
- if (
198
- typeof settings != 'undefined'
199
- && typeof settings.data == 'string'
200
- && settings.data.indexOf('action=add-menu-item') !== -1
201
- && settings.data.indexOf('dgwt_wcas_search_box') !== -1
202
- ) {
203
- replaceLabels();
204
 
205
- setTimeout(function () {
206
- replaceLabels();
207
- }, 500)
208
 
209
- }
210
 
211
- });
212
 
213
- }(jQuery));
214
- </script>
215
 
216
- <?php
217
 
218
- }
219
 
220
  }
3
  namespace DgoraWcas;
4
 
5
  // Exit if accessed directly
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
  }
9
 
10
+ class EmbeddingViaMenu {
11
+ const SEARCH_PLACEHOLDER = 'dgwt_wcas_search_box';
12
+
13
+ public function init() {
14
+
15
+ if ( is_admin() ) {
16
+ add_action( 'admin_head-nav-menus.php', array( $this, 'addNavMenuMetaBoxes' ) );
17
+
18
+ add_action( 'admin_head', array( $this, 'navMenuStyle' ) );
19
+ add_action( 'admin_footer', array( $this, 'navMenuScripts' ) );
20
+
21
+ } else {
22
+
23
+ add_filter( 'walker_nav_menu_start_el', array( $this, 'processMenuItem' ), 50, 2 );
24
+ add_filter( 'megamenu_walker_nav_menu_start_el', array( $this, 'processMenuItem' ), 50, 2 );
25
+
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Check if nav-menus screen is active
31
+ *
32
+ * @return bool
33
+ */
34
+ private function isNavMenuScreen() {
35
+ $isNav = false;
36
+ $screen = get_current_screen();
37
+
38
+ if ( ! empty( $screen->id ) && ( $screen->id === 'nav-menus' ) ) {
39
+ $isNav = true;
40
+ }
41
+
42
+ return $isNav;
43
+ }
44
+
45
+ /**
46
+ * Add custom nav meta box.
47
+ *
48
+ * Adapted from http://www.johnmorrisonline.com/how-to-add-a-fully-functional-custom-meta-box-to-wordpress-navigation-menus/.
49
+ *
50
+ * @return void
51
+ */
52
+ public function addNavMenuMetaBoxes() {
53
+ add_meta_box( 'dgwt_wcas_endpoints_nav_link', __( 'AJAX Search bar', 'ajax-search-for-woocommerce' ), array( $this, 'navMenuLinks' ), 'nav-menus', 'side',
54
+ 'low' );
55
+ }
56
+
57
+ /**
58
+ * Modifies the menu item display on frontend.
59
+ *
60
+ * @param string $itemOutput
61
+ *
62
+ * @return string
63
+ */
64
+ public function processMenuItem( $itemOutput ) {
65
+
66
+ if (
67
+ ! empty( $itemOutput )
68
+ && is_string( $itemOutput )
69
+ && strpos( $itemOutput, self::SEARCH_PLACEHOLDER ) !== false
70
+ ) {
71
+ $itemOutput = do_shortcode( '[wcas-search-form]' );
72
+ }
73
+
74
+ return $itemOutput;
75
+ }
76
+
77
+ /**
78
+ * Output menu links.
79
+ *
80
+ * @return void
81
+ */
82
+ public function navMenuLinks() {
83
+ ?>
84
+ <div id="posttype-dgwt-wcas-endpoints" class="posttypediv">
85
+ <p><?php _e( 'Add AJAX search bar as a menu item.', 'ajax-search-for-woocommerce' ) ?></p>
86
+ <div id="tabs-panel-dgwt-wcas-endpoints" class="tabs-panel tabs-panel-active">
87
+ <ul id="dgwt-wcas-endpoints-checklist" class="categorychecklist form-no-clear">
88
+ <li>
89
+ <label class="menu-item-title">
90
+ <input type="checkbox" class="menu-item-checkbox" name="menu-item[-1][menu-item-object-id]"
91
+ value="-1"/> <?php echo __( 'AJAX Search bar', 'ajax-search-for-woocommerce' ); ?>
92
+ </label>
93
+ <input type="hidden" class="menu-item-type" name="menu-item[-1][menu-item-type]" value="custom"/>
94
+ <input type="hidden" class="menu-item-title" name="menu-item[-1][menu-item-title]" value="<?php echo self::SEARCH_PLACEHOLDER; ?>"/>
95
+ <input type="hidden" class="menu-item-classes" name="menu-item[-1][menu-item-classes]"/>
96
+ </li>
97
+ </ul>
98
+ </div>
99
+ <p class="button-controls">
 
 
 
 
 
 
100
  <span class="add-to-menu">
101
+ <button type="submit" class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to menu', 'woocommerce' ); ?>"
102
+ name="add-post-type-menu-item" id="submit-posttype-dgwt-wcas-endpoints"><?php esc_html_e( 'Add to menu', 'woocommerce' ); ?></button>
103
  <span class="spinner"></span>
104
  </span>
105
+ </p>
106
+ </div>
107
+ <?php
108
+ }
109
 
110
+ public function getDescription() {
111
+ $html = '<div class="dgwt-wcas-admin-menu-item-desc js-dgwt-wcas-admin-menu-item-desc">';
112
+ $html .= '<img class="" src="' . DGWT_WCAS_URL . 'assets/img/logo-for-review.jpg" width="32" height="32" />';
113
+ $html .= '<span>' . __( 'AJAX search bar will be displayed here.', 'ajax-search-for-woocommerce' ) . '</span>';
114
+ $html .= '</div>';
 
115
 
116
+ return $html;
117
+ }
118
 
119
+ public function navMenuStyle() {
 
120
 
121
+ if ( ! $this->isNavMenuScreen() ) {
122
+ return;
123
+ }
124
 
125
+ ?>
126
+ <style>
127
+ .dgwt-wcas-admin-menu-item-desc {
128
+ display: flex;
129
+ flex-direction: row;
130
+ justify-content: left;
131
+ align-items: center;
132
+ }
133
 
134
+ .dgwt-wcas-admin-menu-item-desc img {
135
+ display: block;
136
+ margin-right: 15px;
137
+ border-radius: 4px;
138
+ }
139
+ </style>
140
 
141
+ <?php
142
 
143
+ }
144
 
145
+ public function navMenuScripts() {
 
146
 
147
+ if ( ! $this->isNavMenuScreen() ) {
148
+ return;
149
+ }
150
 
151
+ ?>
152
+ <script>
153
+ (function ($) {
154
 
155
+ function replaceLabels($menuItem) {
156
 
157
+ var $menuItems = $('#menu-to-edit .menu-item-title');
158
 
159
+ if ($menuItems.length > 0) {
160
 
161
+ $menuItems.each(function () {
162
+ if ($(this).text() === '<?php echo self::SEARCH_PLACEHOLDER; ?>') {
163
 
164
+ var $menuItem = $(this).closest('.menu-item');
165
 
166
+ $menuItem.find('.menu-item-title').text('AJAX Search bar');
167
+ $menuItem.find('.item-type').text('<?php _e( 'Search bar', 'ajax-search-for-woocommerce' ); ?>');
168
+ $menuItem.find('.menu-item-settings .edit-menu-item-title').closest('label').hide();
169
+ $menuItem.find('.field-url').hide();
170
 
171
 
172
+ if ($menuItem.find('.js-dgwt-wcas-admin-menu-item-desc').length == 0) {
173
+ $menuItem.find('.menu-item-settings').prepend('<?php echo $this->getDescription(); ?>');
174
+ }
175
+ }
176
+ });
177
+ }
178
+ }
179
 
180
+ $(document).ready(function () {
181
 
182
+ replaceLabels();
183
 
184
+ });
185
 
186
+ $(document).ajaxComplete(function (event, request, settings) {
187
 
188
+ if (
189
+ typeof settings != 'undefined'
190
+ && typeof settings.data == 'string'
191
+ && settings.data.indexOf('action=add-menu-item') !== -1
192
+ && settings.data.indexOf('dgwt_wcas_search_box') !== -1
193
+ ) {
194
+ replaceLabels();
195
 
196
+ setTimeout(function () {
197
+ replaceLabels();
198
+ }, 500)
199
 
200
+ }
201
 
202
+ });
203
 
204
+ }(jQuery));
205
+ </script>
206
 
207
+ <?php
208
 
209
+ }
210
 
211
  }
includes/Engines/WordPressNative/DetailsBox.php CHANGED
@@ -58,21 +58,14 @@ class DetailsBox
58
  if ( $type === 'taxonomy' ) {
59
  $termID = ( !empty($parts[1]) ? absint( $parts[1] ) : 0 );
60
  $taxonomy = ( !empty($parts[2]) ? sanitize_key( $parts[2] ) : '' );
61
- } else {
62
-
63
- if ( $type === 'product' ) {
64
- $postType = 'product';
65
- $postID = ( !empty($parts[1]) ? absint( $parts[1] ) : 0 );
66
- $variationID = ( !empty($parts[2]) ? absint( $parts[2] ) : 0 );
67
- } else {
68
-
69
- if ( $type === 'post' ) {
70
- $postType = ( !empty($parts[2]) ? $parts[2] : 0 );
71
- $postID = ( !empty($parts[1]) ? absint( $parts[1] ) : 0 );
72
- }
73
-
74
- }
75
-
76
  }
77
 
78
  // Get product details
@@ -83,6 +76,7 @@ class DetailsBox
83
  'objectID' => $item['objectID'],
84
  'html' => $productDetails['html'],
85
  'imageSrc' => $productDetails['imageSrc'],
 
86
  );
87
  }
88
 
@@ -114,6 +108,7 @@ class DetailsBox
114
  $details = array(
115
  'html' => '',
116
  'imageSrc' => '',
 
117
  );
118
  if ( !$product->isCorrect() ) {
119
  return $details;
@@ -134,7 +129,6 @@ class DetailsBox
134
  'stockAvailability' => $product->getStockAvailability(),
135
  'wooObject' => $product->getWooObject(),
136
  );
137
- $details['imageSrc'] = $product->getThumbnailSrc( $thumbSize );
138
  if ( $product->isType( 'simple' ) && $wooProduct->is_purchasable() && $wooProduct->is_in_stock() && !$wooProduct->is_sold_individually() && apply_filters( 'dgwt/wcas/suggestion_details/show_quantity', true ) ) {
139
  $vars['showQuantity'] = true;
140
  }
@@ -153,6 +147,8 @@ class DetailsBox
153
  $productID,
154
  $product
155
  );
 
 
156
  return $details;
157
  }
158
 
58
  if ( $type === 'taxonomy' ) {
59
  $termID = ( !empty($parts[1]) ? absint( $parts[1] ) : 0 );
60
  $taxonomy = ( !empty($parts[2]) ? sanitize_key( $parts[2] ) : '' );
61
+ } elseif ( $type === 'product' ) {
62
+ $postType = 'product';
63
+ $postID = ( !empty($parts[1]) ? absint( $parts[1] ) : 0 );
64
+ $variationID = ( !empty($parts[2]) ? absint( $parts[2] ) : 0 );
65
+ //@TODO handle variations
66
+ } elseif ( $type === 'post' ) {
67
+ $postType = ( !empty($parts[2]) ? $parts[2] : 0 );
68
+ $postID = ( !empty($parts[1]) ? absint( $parts[1] ) : 0 );
 
 
 
 
 
 
 
69
  }
70
 
71
  // Get product details
76
  'objectID' => $item['objectID'],
77
  'html' => $productDetails['html'],
78
  'imageSrc' => $productDetails['imageSrc'],
79
+ 'price' => $productDetails['price'],
80
  );
81
  }
82
 
108
  $details = array(
109
  'html' => '',
110
  'imageSrc' => '',
111
+ 'price' => '',
112
  );
113
  if ( !$product->isCorrect() ) {
114
  return $details;
129
  'stockAvailability' => $product->getStockAvailability(),
130
  'wooObject' => $product->getWooObject(),
131
  );
 
132
  if ( $product->isType( 'simple' ) && $wooProduct->is_purchasable() && $wooProduct->is_in_stock() && !$wooProduct->is_sold_individually() && apply_filters( 'dgwt/wcas/suggestion_details/show_quantity', true ) ) {
133
  $vars['showQuantity'] = true;
134
  }
147
  $productID,
148
  $product
149
  );
150
+ $details['imageSrc'] = $vars->imageSrc;
151
+ $details['price'] = $vars->priceHtml;
152
  return $details;
153
  }
154
 
includes/Engines/WordPressNative/Search.php CHANGED
@@ -29,6 +29,11 @@ class Search
29
  * array
30
  */
31
  private $groups = array() ;
 
 
 
 
 
32
  public function __construct()
33
  {
34
  add_filter(
@@ -55,18 +60,32 @@ class Search
55
  501,
56
  2
57
  );
58
- add_filter(
59
- 'pre_get_posts',
60
- array( $this, 'overwriteSearchPage' ),
61
- 109900,
62
- 1
63
- );
64
- add_filter(
65
- 'posts_search',
66
- array( $this, 'disableSearchFiltersOnPostsIn' ),
67
- 10,
68
- 2
69
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  // Search results ajax action
71
 
72
  if ( DGWT_WCAS_WC_AJAX_ENDPOINT ) {
@@ -189,6 +208,9 @@ class Search
189
  $productsSlots = ( $this->flexibleLimits ? $this->totalLimit : $this->groups['product']['limit'] );
190
  foreach ( $orderedProducts as $post ) {
191
  $product = new Product( $post );
 
 
 
192
  $scoreDebug = '';
193
  if ( defined( 'DGWT_WCAS_DEBUG' ) && DGWT_WCAS_DEBUG ) {
194
  $scoreDebug = ' (score:' . (int) $post->score . ')';
@@ -565,55 +587,65 @@ class Search
565
  return $where;
566
  }
567
 
 
 
 
 
 
568
  public function overwriteSearchPage( $query )
569
  {
570
- if ( $query->is_search() ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
 
572
- if ( isset( $query->query_vars['s'] ) && isset( $_REQUEST['dgwt_wcas'] ) && strlen( $query->query_vars['s'] ) >= 3 ) {
573
- $s = $query->query_vars['s'];
574
- $baseUrl = home_url() . strtok( $_SERVER["REQUEST_URI"], '?' ) . \WC_AJAX::get_endpoint( DGWT_WCAS_SEARCH_ACTION );
575
- $url = add_query_arg( array(
576
- 's' => $s,
577
- 'remote' => 1,
578
- ), $baseUrl );
579
- $ids = array();
580
- $correctResponse = false;
581
- $r = wp_remote_retrieve_body( wp_remote_get( $url, array(
582
- 'timeout' => 120,
583
- ) ) );
584
- $decR = json_decode( $r );
585
- if ( json_last_error() == JSON_ERROR_NONE ) {
586
-
587
- if ( is_object( $decR ) && property_exists( $decR, 'suggestions' ) && is_array( $decR->suggestions ) ) {
588
- $correctResponse = true;
589
- foreach ( $decR->suggestions as $suggestion ) {
590
- $ids[] = $suggestion->ID;
591
- }
592
- }
593
-
594
  }
595
-
596
- if ( $correctResponse ) {
597
- $query->set( 'orderby', 'post__in' );
598
- $query->set( 'post__in', $ids );
599
- }
600
-
601
  }
602
 
603
  }
604
- }
605
-
606
- public function disableSearchFiltersOnPostsIn( $search, $query )
607
- {
608
 
609
- if ( isset( $_REQUEST['s'] ) && isset( $_REQUEST['dgwt_wcas'] ) ) {
610
- $post__in = $query->get( 'post__in' );
611
- if ( !empty($post__in) ) {
612
- $search = '';
613
- }
 
 
 
614
  }
615
-
616
- return $search;
617
  }
618
 
619
  /**
@@ -793,5 +825,20 @@ class Search
793
  );
794
  return apply_filters( 'dgwt/wcas/search_groups', $groups );
795
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
796
 
797
  }
29
  * array
30
  */
31
  private $groups = array() ;
32
+ /**
33
+ * Buffer for post IDs uses for search results page
34
+ * @var null
35
+ */
36
+ private $postsIDsBuffer = null ;
37
  public function __construct()
38
  {
39
  add_filter(
60
  501,
61
  2
62
  );
63
+ // Search results page
64
+ add_action( 'init', function () {
65
+
66
+ if ( apply_filters( 'dgwt/wcas/override_search_results_page', true ) ) {
67
+ add_filter( 'pre_get_posts', array( $this, 'overwriteSearchPage' ), 900001 );
68
+ add_filter(
69
+ 'posts_search',
70
+ array( 'DgoraWcas\\Helpers', 'clearSearchQuery' ),
71
+ 1000,
72
+ 2
73
+ );
74
+ add_filter(
75
+ 'the_posts',
76
+ array( 'DgoraWcas\\Helpers', 'rollbackSearchPhrase' ),
77
+ 1000,
78
+ 2
79
+ );
80
+ add_filter(
81
+ 'dgwt/wcas/search_page/result_post_ids',
82
+ array( $this, 'getProductIds' ),
83
+ 10,
84
+ 2
85
+ );
86
+ }
87
+
88
+ } );
89
  // Search results ajax action
90
 
91
  if ( DGWT_WCAS_WC_AJAX_ENDPOINT ) {
208
  $productsSlots = ( $this->flexibleLimits ? $this->totalLimit : $this->groups['product']['limit'] );
209
  foreach ( $orderedProducts as $post ) {
210
  $product = new Product( $post );
211
+ if ( !$product->isCorrect() ) {
212
+ continue;
213
+ }
214
  $scoreDebug = '';
215
  if ( defined( 'DGWT_WCAS_DEBUG' ) && DGWT_WCAS_DEBUG ) {
216
  $scoreDebug = ' (score:' . (int) $post->score . ')';
587
  return $where;
588
  }
589
 
590
+ /**
591
+ * Disable cache results and narrowing search results to those from our engine
592
+ *
593
+ * @param \WP_Query $query
594
+ */
595
  public function overwriteSearchPage( $query )
596
  {
597
+ if ( !Helpers::isSearchQuery( $query ) ) {
598
+ return;
599
+ }
600
+ /**
601
+ * Disable cache: `cache_results` defaults to false but can be enabled
602
+ */
603
+ $query->set( 'cache_results', false );
604
+ if ( !empty($query->query['cache_results']) ) {
605
+ $query->set( 'cache_results', true );
606
+ }
607
+ $query->set( 'dgwt_wcas', $query->query_vars['s'] );
608
+ $phrase = $query->query_vars['s'];
609
+ $orderby = 'post__in';
610
+ $order = 'desc';
611
+ if ( !empty($query->query_vars['orderby']) ) {
612
+ $orderby = ( $query->query_vars['orderby'] === 'relevance' ? 'post__in' : $query->query_vars['orderby'] );
613
+ }
614
+ if ( !empty($query->query_vars['order']) ) {
615
+ $order = strtolower( $query->query_vars['order'] );
616
+ }
617
+ $baseUrl = home_url() . strtok( $_SERVER["REQUEST_URI"], '?' ) . \WC_AJAX::get_endpoint( DGWT_WCAS_SEARCH_ACTION );
618
+ $url = add_query_arg( array(
619
+ 's' => $phrase,
620
+ 'remote' => 1,
621
+ ), $baseUrl );
622
+ $postIn = array();
623
+ $correctResponse = false;
624
+ $r = wp_remote_retrieve_body( wp_remote_get( $url, array(
625
+ 'timeout' => 120,
626
+ ) ) );
627
+ $decR = json_decode( $r );
628
+ if ( json_last_error() == JSON_ERROR_NONE ) {
629
 
630
+ if ( is_object( $decR ) && property_exists( $decR, 'suggestions' ) && is_array( $decR->suggestions ) ) {
631
+ $correctResponse = true;
632
+ foreach ( $decR->suggestions as $suggestion ) {
633
+ $postIn[] = $suggestion->ID;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
634
  }
 
 
 
 
 
 
635
  }
636
 
637
  }
 
 
 
 
638
 
639
+ if ( $correctResponse ) {
640
+ // Save for later use
641
+ $this->postsIDsBuffer = $postIn;
642
+ $query->set( 'orderby', $orderby );
643
+ $query->set( 'order', $order );
644
+ $query->set( 'post__in', $postIn );
645
+ // Resetting the key 's' to disable the default search logic.
646
+ $query->set( 's', '' );
647
  }
648
+
 
649
  }
650
 
651
  /**
825
  );
826
  return apply_filters( 'dgwt/wcas/search_groups', $groups );
827
  }
828
+
829
+ /**
830
+ * Allow to get the ID of products that have been found
831
+ *
832
+ * @param integer[] $postsIDs
833
+ *
834
+ * @return mixed
835
+ */
836
+ public function getProductIds( $postsIDs )
837
+ {
838
+ if ( $this->postsIDsBuffer !== null ) {
839
+ return $this->postsIDsBuffer;
840
+ }
841
+ return $postsIDs;
842
+ }
843
 
844
  }
includes/Helpers.php CHANGED
@@ -77,9 +77,9 @@ class Helpers
77
  $classes[] = esc_html( $args['class'] );
78
  }
79
 
80
- if ( !empty($args['type']) ) {
81
- $type = esc_html( $args['type'] );
82
- $classes[] = 'js-dgwt-wcas-' . $type . ' dgwt-wcas-' . $type;
83
  }
84
 
85
  return implode( ' ', $classes );
@@ -97,16 +97,16 @@ class Helpers
97
  $svg = '';
98
  ob_start();
99
  ?>
100
- <svg version="1.1" class="<?php
101
  echo $class ;
102
  ?>" xmlns="http://www.w3.org/2000/svg"
103
- xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
104
- viewBox="0 0 51.539 51.361" enable-background="new 0 0 51.539 51.361" xml:space="preserve">
105
  <path d="M51.539,49.356L37.247,35.065c3.273-3.74,5.272-8.623,5.272-13.983c0-11.742-9.518-21.26-21.26-21.26
106
  S0,9.339,0,21.082s9.518,21.26,21.26,21.26c5.361,0,10.244-1.999,13.983-5.272l14.292,14.292L51.539,49.356z M2.835,21.082
107
  c0-10.176,8.249-18.425,18.425-18.425s18.425,8.249,18.425,18.425S31.436,39.507,21.26,39.507S2.835,31.258,2.835,21.082z"/>
108
  </svg>
109
- <?php
110
  $svg .= ob_get_clean();
111
  return apply_filters( 'dgwt/wcas/form/magnifier_ico', $svg );
112
  }
@@ -119,6 +119,9 @@ class Helpers
119
  public static function searchFormAction()
120
  {
121
  $url = esc_url( home_url( '/' ) );
 
 
 
122
  return apply_filters( 'dgwt/wcas/form/action', $url );
123
  }
124
 
@@ -457,7 +460,11 @@ class Helpers
457
  $posBonus = (100 - $pos * 100 / strlen( $string )) / 2;
458
  $score += $posBonus;
459
  }
460
-
 
 
 
 
461
  }
462
 
463
  return $score;
@@ -631,10 +638,6 @@ class Helpers
631
  {
632
  global $wpdb ;
633
  $customFields = array();
634
- $customFieldsTrans = get_transient( 'dgwt_wcas_searchable_custom_fields' );
635
- if ( !empty($customFieldsTrans) && is_array( $customFieldsTrans ) ) {
636
- return $customFieldsTrans;
637
- }
638
  $exludedMetaKeys = array(
639
  '_sku',
640
  '_wp_old_date',
@@ -664,13 +667,15 @@ class Helpers
664
  if ( !in_array( $metaKey, $exludedMetaKeys ) && self::keyIsValid( $metaKey ) ) {
665
  $label = $metaKey;
666
  //@TODO Recognize labels based on meta key or publci known as Yoast SEO etc.
667
- $customFields[$metaKey] = $label;
 
 
 
668
  }
669
 
670
  }
671
  }
672
  $customFields = array_reverse( $customFields );
673
- set_transient( 'dgwt_wcas_searchable_custom_fields', $customFields, 60 * 60 * 24 );
674
  return $customFields;
675
  }
676
 
@@ -906,6 +911,7 @@ class Helpers
906
  * Repair HTML. Close unclosed tags.
907
  *
908
  * @param $html
 
909
  * @return string
910
  */
911
  public static function closeTags( $html )
@@ -930,5 +936,121 @@ class Helpers
930
  }
931
  return $html;
932
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
933
 
934
  }
77
  $classes[] = esc_html( $args['class'] );
78
  }
79
 
80
+ if ( !empty($args['layout']) ) {
81
+ $type = esc_html( $args['layout'] );
82
+ $classes[] = 'js-dgwt-wcas-layout-' . $type . ' dgwt-wcas-layout-' . $type;
83
  }
84
 
85
  return implode( ' ', $classes );
97
  $svg = '';
98
  ob_start();
99
  ?>
100
+ <svg version="1.1" class="<?php
101
  echo $class ;
102
  ?>" xmlns="http://www.w3.org/2000/svg"
103
+ xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
104
+ viewBox="0 0 51.539 51.361" enable-background="new 0 0 51.539 51.361" xml:space="preserve">
105
  <path d="M51.539,49.356L37.247,35.065c3.273-3.74,5.272-8.623,5.272-13.983c0-11.742-9.518-21.26-21.26-21.26
106
  S0,9.339,0,21.082s9.518,21.26,21.26,21.26c5.361,0,10.244-1.999,13.983-5.272l14.292,14.292L51.539,49.356z M2.835,21.082
107
  c0-10.176,8.249-18.425,18.425-18.425s18.425,8.249,18.425,18.425S31.436,39.507,21.26,39.507S2.835,31.258,2.835,21.082z"/>
108
  </svg>
109
+ <?php
110
  $svg .= ob_get_clean();
111
  return apply_filters( 'dgwt/wcas/form/magnifier_ico', $svg );
112
  }
119
  public static function searchFormAction()
120
  {
121
  $url = esc_url( home_url( '/' ) );
122
+ if ( Multilingual::isPolylang() ) {
123
+ $url = esc_url( pll_home_url() );
124
+ }
125
  return apply_filters( 'dgwt/wcas/form/action', $url );
126
  }
127
 
460
  $posBonus = (100 - $pos * 100 / strlen( $string )) / 2;
461
  $score += $posBonus;
462
  }
463
+
464
+ // Bonus for exact match
465
+ if ( $string === $searched ) {
466
+ $score += $args['score_containing'];
467
+ }
468
  }
469
 
470
  return $score;
638
  {
639
  global $wpdb ;
640
  $customFields = array();
 
 
 
 
641
  $exludedMetaKeys = array(
642
  '_sku',
643
  '_wp_old_date',
667
  if ( !in_array( $metaKey, $exludedMetaKeys ) && self::keyIsValid( $metaKey ) ) {
668
  $label = $metaKey;
669
  //@TODO Recognize labels based on meta key or publci known as Yoast SEO etc.
670
+ $customFields[] = array(
671
+ 'label' => $label,
672
+ 'key' => $label,
673
+ );
674
  }
675
 
676
  }
677
  }
678
  $customFields = array_reverse( $customFields );
 
679
  return $customFields;
680
  }
681
 
911
  * Repair HTML. Close unclosed tags.
912
  *
913
  * @param $html
914
+ *
915
  * @return string
916
  */
917
  public static function closeTags( $html )
936
  }
937
  return $html;
938
  }
939
+
940
+ /**
941
+ * Check if we should override default search query
942
+ *
943
+ * @param \WP_Query $query The WP_Query instance
944
+ *
945
+ * @return bool
946
+ */
947
+ public static function isSearchQuery( $query )
948
+ {
949
+ $enabled = true;
950
+ if ( !(!empty($query) && is_object( $query ) && is_a( $query, 'WP_Query' )) ) {
951
+ return false;
952
+ }
953
+ if ( !$query->is_main_query() || isset( $query->query_vars['s'] ) && !isset( $_GET['dgwt_wcas'] ) || !isset( $query->query_vars['s'] ) || !$query->is_search() || $query->get( 'post_type' ) && is_string( $query->get( 'post_type' ) ) && $query->get( 'post_type' ) !== 'product' ) {
954
+ $enabled = false;
955
+ }
956
+ return $enabled;
957
+ }
958
+
959
+ /**
960
+ * Check if this is a product search page
961
+ *
962
+ * @return bool
963
+ */
964
+ public static function isProductSearchPage()
965
+ {
966
+ if ( isset( $_GET['dgwt_wcas'] ) && isset( $_GET['post_type'] ) && $_GET['post_type'] === 'product' && isset( $_GET['s'] ) ) {
967
+ return true;
968
+ }
969
+ return false;
970
+ }
971
+
972
+ /**
973
+ * Restore the search phrase so that it can be used in the template.
974
+ *
975
+ * @param \WP_Post[] $posts Array of post objects.
976
+ * @param \WP_Query $query The WP_Query instance (passed by reference).
977
+ *
978
+ * @return mixed
979
+ */
980
+ public static function rollbackSearchPhrase( $posts, $query )
981
+ {
982
+ if ( !$query->get( 'dgwt_wcas', false ) ) {
983
+ return $posts;
984
+ }
985
+ $query->set( 's', $query->get( 'dgwt_wcas', '' ) );
986
+ return $posts;
987
+ }
988
+
989
+ /**
990
+ * Clear default search query if our engine is active
991
+ *
992
+ * @param string $search Search SQL for WHERE clause.
993
+ * @param \WP_Query $query The current WP_Query object.
994
+ *
995
+ * @return string
996
+ */
997
+ public static function clearSearchQuery( $search, $query )
998
+ {
999
+ if ( !$query->get( 'dgwt_wcas', false ) ) {
1000
+ return $search;
1001
+ }
1002
+ return '';
1003
+ }
1004
+
1005
+ /**
1006
+ * Get formatted search layout settings
1007
+ *
1008
+ * @return object
1009
+ */
1010
+ public static function getLayoutSettings()
1011
+ {
1012
+ $breakpoint = DGWT_WCAS()->settings->getOption( 'mobile_breakpoint', 992 );
1013
+ $layout = array(
1014
+ 'layout' => DGWT_WCAS()->settings->getOption( 'search_layout', 'classic' ),
1015
+ 'mobile_overlay' => ( DGWT_WCAS()->settings->getOption( 'enable_mobile_overlay' ) === 'on' ? true : false ),
1016
+ 'mobile_overlay_wrapper' => apply_filters( 'dgwt/wcas/scripts/mobile_overlay_wrapper', 'body' ),
1017
+ 'breakpoint' => apply_filters( 'dgwt/wcas/scripts/mobile_breakpoint', $breakpoint ),
1018
+ );
1019
+ if ( in_array( $layout['layout'], array( 'icon', 'icon-flexible' ) ) ) {
1020
+ $layout['mobile_overlay'] = true;
1021
+ }
1022
+ return (object) $layout;
1023
+ }
1024
+
1025
+ /**
1026
+ * Checking the current code is run by the object of the given class
1027
+ *
1028
+ * @param string $class_name Class name
1029
+ * @param int $backtrace_limit The number of stack frames that is tested backwards.
1030
+ *
1031
+ * @return bool
1032
+ */
1033
+ public static function is_running_inside_class( $class_name, $backtrace_limit = 10 )
1034
+ {
1035
+ if ( empty($class_name) ) {
1036
+ return false;
1037
+ }
1038
+ if ( intval( $backtrace_limit ) <= 0 ) {
1039
+ $backtrace_limit = 10;
1040
+ }
1041
+ $result = false;
1042
+ $backtrace = debug_backtrace( 0, $backtrace_limit );
1043
+ if ( !empty($backtrace) ) {
1044
+ foreach ( $backtrace as $item ) {
1045
+
1046
+ if ( isset( $item['class'] ) && $item['class'] === $class_name ) {
1047
+ $result = true;
1048
+ break;
1049
+ }
1050
+
1051
+ }
1052
+ }
1053
+ return $result;
1054
+ }
1055
 
1056
  }
includes/Integrations/Brands.php CHANGED
@@ -1,10 +1,14 @@
1
  <?php
2
 
3
-
4
  namespace DgoraWcas\Integrations;
5
 
6
  use DgoraWcas\Helpers;
7
 
 
 
 
 
 
8
  /**
9
  * Class Brands
10
  * @package DgoraWcas\Integrations
@@ -12,216 +16,206 @@ use DgoraWcas\Helpers;
12
  * Support for plugins:
13
  * 1. WooCommerce Brands 1.6.9 by WooCommerce
14
  * 2. YITH WooCommerce Brands Add-on 1.3.3 by YITH
15
- * 3. Perfect WooCommerce Brands 1.7.9 by Alberto de Vera Sevilla
16
  */
17
- class Brands
18
- {
19
- /**
20
- * Brands plugin metadata
21
- *
22
- * @var array
23
- */
24
- private $pluginInfo = array();
25
-
26
- /**
27
- * Brands plugin slug
28
- *
29
- * @var string
30
- */
31
- private $pluginSlug = '';
32
-
33
- /**
34
- * Brand taxonomy name
35
- *
36
- * @var string
37
- */
38
- private $brandTaxonomy = '';
39
-
40
- public function __construct()
41
- {
42
- }
43
-
44
- public function init()
45
- {
46
- $this->setPluginInfo();
47
- $this->setBrandTaxonomy();
48
- $this->addSettings();
49
-
50
- add_filter('dgwt/wcas/suggestion_details/taxonomy/headline', array($this, 'rebuildDetailsHeader'), 10, 4);
51
- }
52
-
53
- /**
54
- * Set current brands vendor plugin
55
- *
56
- * @return void
57
- */
58
- private function setPluginInfo()
59
- {
60
- foreach ($this->getBrandsPlugins() as $pluginPath) {
61
- if (is_plugin_active($pluginPath)) {
62
-
63
- $file = WP_PLUGIN_DIR . '/' . $pluginPath;
64
-
65
- if (file_exists($file)) {
66
- $this->pluginInfo = get_plugin_data($file);
67
- $this->pluginSlug = $pluginPath;
68
- }
69
-
70
- break;
71
- }
72
- }
73
- }
74
-
75
- /**
76
- * Set brand taxonomy name
77
- *
78
- * @return void
79
- */
80
- private function setBrandTaxonomy()
81
- {
82
- $brandTaxonomy = 'product_brand';
83
-
84
- if ($this->hasBrands()) {
85
- switch ($this->pluginSlug) {
86
- case 'yith-woocommerce-brands-add-on-premium/init.php':
87
- case 'yith-woocommerce-brands-add-on/init.php':
88
- $brandTaxonomy = 'yith_product_brand';
89
- break;
90
- case 'perfect-woocommerce-brands/main.php':
91
- $brandTaxonomy = 'pwb-brand';
92
- break;
93
- }
94
- }
95
-
96
- $brandTaxonomy = apply_filters('dgwt/wcas/brands/taxonomy', $brandTaxonomy);
97
-
98
- $this->brandTaxonomy = $brandTaxonomy;
99
- }
100
-
101
- /**
102
- * Get all supported brands plugins files
103
- *
104
- * @return array
105
- */
106
- public function getBrandsPlugins()
107
- {
108
- return array(
109
- 'woocommerce-brands/woocommerce-brands.php',
110
- 'yith-woocommerce-brands-add-on/init.php',
111
- 'yith-woocommerce-brands-add-on-premium/init.php',
112
- 'perfect-woocommerce-brands/main.php'
113
- );
114
- }
115
-
116
- /**
117
- * Check if some brands plugin is enabled
118
- *
119
- * @return bool
120
- */
121
- public function hasBrands()
122
- {
123
- return ! empty($this->pluginInfo);
124
- }
125
-
126
- /**
127
- * Get brand taxonomy
128
- *
129
- * @return string
130
- */
131
- public function getBrandTaxonomy()
132
- {
133
- return ! empty($this->brandTaxonomy) ? sanitize_key($this->brandTaxonomy) : '';
134
- }
135
-
136
- /**
137
- * Get the name of the plugin vendor
138
- *
139
- * @return static
140
- */
141
- public function getPluginName()
142
- {
143
- return ! empty($this->pluginInfo['Name']) ? sanitize_text_field($this->pluginInfo['Name']) : '';
144
- }
145
-
146
- /**
147
- * Get the name of the plugin vendor
148
- *
149
- * @return static
150
- */
151
- public function getPluginVersion()
152
- {
153
- return ! empty($this->pluginInfo['Version']) ? sanitize_text_field($this->pluginInfo['Version']) : '';
154
- }
155
-
156
- /**
157
- * Register settings
158
- *
159
- * @return void
160
- */
161
- private function addSettings()
162
- {
163
- if ($this->hasBrands()) {
164
- add_filter('dgwt/wcas/settings/section=search', function ($settingsScope) {
165
-
166
- $pluginInfo = $this->getPluginName() . ' v' . $this->getPluginVersion();
167
-
168
- $settingsScope[220] = array(
169
- 'name' => 'search_in_brands',
170
- 'label' => __('Search in brands', 'ajax-search-for-woocommerce'),
171
- 'class' => 'dgwt-wcas-premium-only',
172
- 'type' => 'checkbox',
173
- 'default' => 'off',
174
- 'desc' => sprintf(__('based on the plugin %s','ajax-search-for-woocommerce' ), $pluginInfo)
175
- );
176
-
177
- return $settingsScope;
178
- });
179
-
180
- add_filter('dgwt/wcas/settings/section=autocomplete', function ($settingsScope) {
181
-
182
- $pluginInfo = $this->getPluginName() . ' v' . $this->getPluginVersion();
183
-
184
- $settingsScope[1260] = array(
185
- 'name' => 'show_matching_brands',
186
- 'label' => __('Show brands', 'ajax-search-for-woocommerce'),
187
- 'class' => 'dgwt-wcas-premium-only',
188
- 'type' => 'checkbox',
189
- 'default' => 'off',
190
- 'desc' => sprintf(__('based on the plugin %s','ajax-search-for-woocommerce' ), $pluginInfo)
191
- );
192
-
193
- return $settingsScope;
194
- });
195
-
196
-
197
-
198
- }
199
- }
200
-
201
- /**
202
- * Rebuild details panel header for brands
203
- *
204
- * @param $title
205
- * @param $termID
206
- * @param $taxonomy
207
- * @param $termName
208
- * @return string
209
- */
210
- public function rebuildDetailsHeader($title, $termID, $taxonomy, $termName)
211
- {
212
-
213
- if (!empty($taxonomy) && $taxonomy === $this->getBrandTaxonomy()) {
214
-
215
- $title = '<span class="dgwt-wcas-datails-title">';
216
- $title .= '<span class="dgwt-wcas-details-title-tax">';
217
- $title .= Helpers::getLabel('brand') . ': ';
218
- $title .= '</span>';
219
- $title .= $termName;
220
- $title .= '</span>';
221
- }
222
-
223
- return $title;
224
-
225
- }
226
-
227
- }
1
  <?php
2
 
 
3
  namespace DgoraWcas\Integrations;
4
 
5
  use DgoraWcas\Helpers;
6
 
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
  /**
13
  * Class Brands
14
  * @package DgoraWcas\Integrations
16
  * Support for plugins:
17
  * 1. WooCommerce Brands 1.6.9 by WooCommerce
18
  * 2. YITH WooCommerce Brands Add-on 1.3.3 by YITH
19
+ * 3. Perfect WooCommerce Brands 1.8.3 by Alberto de Vera Sevilla
20
  */
21
+ class Brands {
22
+ /**
23
+ * Brands plugin metadata
24
+ *
25
+ * @var array
26
+ */
27
+ private $pluginInfo = array();
28
+
29
+ /**
30
+ * Brands plugin slug
31
+ *
32
+ * @var string
33
+ */
34
+ private $pluginSlug = '';
35
+
36
+ /**
37
+ * Brand taxonomy name
38
+ *
39
+ * @var string
40
+ */
41
+ private $brandTaxonomy = '';
42
+
43
+ public function __construct() {
44
+ }
45
+
46
+ public function init() {
47
+ $this->setPluginInfo();
48
+ $this->setBrandTaxonomy();
49
+ $this->addSettings();
50
+
51
+ add_filter( 'dgwt/wcas/suggestion_details/taxonomy/headline', array( $this, 'rebuildDetailsHeader' ), 10, 4 );
52
+ }
53
+
54
+ /**
55
+ * Set current brands vendor plugin
56
+ *
57
+ * @return void
58
+ */
59
+ private function setPluginInfo() {
60
+ foreach ( $this->getBrandsPlugins() as $pluginPath ) {
61
+ if ( is_plugin_active( $pluginPath ) ) {
62
+
63
+ $file = WP_PLUGIN_DIR . '/' . $pluginPath;
64
+
65
+ if ( file_exists( $file ) ) {
66
+ $this->pluginInfo = get_plugin_data( $file );
67
+ $this->pluginSlug = $pluginPath;
68
+ }
69
+
70
+ break;
71
+ }
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Set brand taxonomy name
77
+ *
78
+ * @return void
79
+ */
80
+ private function setBrandTaxonomy() {
81
+ $brandTaxonomy = 'product_brand';
82
+
83
+ if ( $this->hasBrands() ) {
84
+ switch ( $this->pluginSlug ) {
85
+ case 'yith-woocommerce-brands-add-on-premium/init.php':
86
+ case 'yith-woocommerce-brands-add-on/init.php':
87
+ $brandTaxonomy = 'yith_product_brand';
88
+ break;
89
+ case 'perfect-woocommerce-brands/main.php':
90
+ case 'perfect-woocommerce-brands/perfect-woocommerce-brands.php':
91
+ $brandTaxonomy = 'pwb-brand';
92
+ break;
93
+ }
94
+ }
95
+
96
+ $brandTaxonomy = apply_filters( 'dgwt/wcas/brands/taxonomy', $brandTaxonomy );
97
+
98
+ $this->brandTaxonomy = $brandTaxonomy;
99
+ }
100
+
101
+ /**
102
+ * Get all supported brands plugins files
103
+ *
104
+ * @return array
105
+ */
106
+ public function getBrandsPlugins() {
107
+ return array(
108
+ 'woocommerce-brands/woocommerce-brands.php',
109
+ 'yith-woocommerce-brands-add-on/init.php',
110
+ 'yith-woocommerce-brands-add-on-premium/init.php',
111
+ 'perfect-woocommerce-brands/main.php',
112
+ 'perfect-woocommerce-brands/perfect-woocommerce-brands.php'
113
+ );
114
+ }
115
+
116
+ /**
117
+ * Check if some brands plugin is enabled
118
+ *
119
+ * @return bool
120
+ */
121
+ public function hasBrands() {
122
+ return ! empty( $this->pluginInfo );
123
+ }
124
+
125
+ /**
126
+ * Get brand taxonomy
127
+ *
128
+ * @return string
129
+ */
130
+ public function getBrandTaxonomy() {
131
+ return ! empty( $this->brandTaxonomy ) ? sanitize_key( $this->brandTaxonomy ) : '';
132
+ }
133
+
134
+ /**
135
+ * Get the name of the plugin vendor
136
+ *
137
+ * @return static
138
+ */
139
+ public function getPluginName() {
140
+ return ! empty( $this->pluginInfo['Name'] ) ? sanitize_text_field( $this->pluginInfo['Name'] ) : '';
141
+ }
142
+
143
+ /**
144
+ * Get the name of the plugin vendor
145
+ *
146
+ * @return static
147
+ */
148
+ public function getPluginVersion() {
149
+ return ! empty( $this->pluginInfo['Version'] ) ? sanitize_text_field( $this->pluginInfo['Version'] ) : '';
150
+ }
151
+
152
+ /**
153
+ * Register settings
154
+ *
155
+ * @return void
156
+ */
157
+ private function addSettings() {
158
+ if ( $this->hasBrands() ) {
159
+ add_filter( 'dgwt/wcas/settings/section=search', function ( $settingsScope ) {
160
+
161
+ $pluginInfo = $this->getPluginName() . ' v' . $this->getPluginVersion();
162
+
163
+ $settingsScope[220] = array(
164
+ 'name' => 'search_in_brands',
165
+ 'label' => __( 'Search in brands', 'ajax-search-for-woocommerce' ),
166
+ 'class' => 'dgwt-wcas-premium-only',
167
+ 'type' => 'checkbox',
168
+ 'default' => 'off',
169
+ 'desc' => sprintf( __( 'based on the plugin %s', 'ajax-search-for-woocommerce' ), $pluginInfo )
170
+ );
171
+
172
+ return $settingsScope;
173
+ } );
174
+
175
+ add_filter( 'dgwt/wcas/settings/section=autocomplete', function ( $settingsScope ) {
176
+
177
+ $pluginInfo = $this->getPluginName() . ' v' . $this->getPluginVersion();
178
+
179
+ $settingsScope[1260] = array(
180
+ 'name' => 'show_matching_brands',
181
+ 'label' => __( 'Show brands', 'ajax-search-for-woocommerce' ),
182
+ 'class' => 'dgwt-wcas-premium-only',
183
+ 'type' => 'checkbox',
184
+ 'default' => 'off',
185
+ 'desc' => sprintf( __( 'based on the plugin %s', 'ajax-search-for-woocommerce' ), $pluginInfo )
186
+ );
187
+
188
+ return $settingsScope;
189
+ } );
190
+
191
+
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Rebuild details panel header for brands
197
+ *
198
+ * @param $title
199
+ * @param $termID
200
+ * @param $taxonomy
201
+ * @param $termName
202
+ *
203
+ * @return string
204
+ */
205
+ public function rebuildDetailsHeader( $title, $termID, $taxonomy, $termName ) {
206
+
207
+ if ( ! empty( $taxonomy ) && $taxonomy === $this->getBrandTaxonomy() ) {
208
+
209
+ $title = '<span class="dgwt-wcas-datails-title">';
210
+ $title .= '<span class="dgwt-wcas-details-title-tax">';
211
+ $title .= Helpers::getLabel( 'brand' ) . ': ';
212
+ $title .= '</span>';
213
+ $title .= $termName;
214
+ $title .= '</span>';
215
+ }
216
+
217
+ return $title;
218
+
219
+ }
220
+
221
+ }
 
 
 
 
 
 
 
 
 
 
includes/Integrations/Plugins/BoosterIO/BoosterIO.php CHANGED
@@ -4,349 +4,337 @@ namespace DgoraWcas\Integrations\Plugins\BoosterIO;
4
 
5
  use DgoraWcas\Helpers;
6
 
7
- class BoosterIO
8
- {
9
-
10
- private $countriesGroups = array();
11
- private $currentCountry = '';
12
-
13
- public function init()
14
- {
15
- if ( ! class_exists('WC_Jetpack')) {
16
- return;
17
- }
18
-
19
- if ($this->isPricesAndCurrenciesByCountryEnabled()) {
20
-
21
- add_action('dgwt/wcas/readable_index/bg_processing/before_task', array($this, 'removePricingFilters'));
22
-
23
- add_action('template_redirect', array($this, 'setCurrentCountry'), 100);
24
- add_action('template_redirect', array($this, 'saveCurrentCountry'), 200);
25
-
26
- $this->setGroupedCountries();
27
- $this->formatHTMLPrice();
28
- }
29
-
30
- }
31
-
32
- /**
33
- * Module: [Prices and Currencies by Country]
34
- * Get price HTML for variable product
35
- *
36
- * @param int $product
37
- * @param int $groupID
38
- *
39
- * @return string
40
- */
41
- public function getVariablePriceHtml($product, $groupID)
42
- {
43
- $variationIDs = $product->get_children();
44
- $prices = $this->getVariationPrices($product, $variationIDs, $groupID);
45
-
46
- if (empty($prices['price'])) {
47
- $price = apply_filters('woocommerce_variable_empty_price_html', '', $product);
48
- } else {
49
- $min_price = current($prices['price']);
50
- $max_price = end($prices['price']);
51
- $min_reg_price = current($prices['regular_price']);
52
- $max_reg_price = end($prices['regular_price']);
53
-
54
- if ($min_price !== $max_price) {
55
- $price = wc_format_price_range($min_price, $max_price);
56
- } elseif ($product->is_on_sale() && $min_reg_price === $max_reg_price) {
57
- $price = wc_format_sale_price(wc_price($max_reg_price), wc_price($min_price));
58
- } else {
59
- $price = wc_price($min_price);
60
- }
61
-
62
- $price = apply_filters('woocommerce_variable_price_html', $price . $product->get_price_suffix(), $product);
63
- }
64
-
65
- return apply_filters('woocommerce_get_price_html', $price, $product);
66
- }
67
-
68
- /**
69
- * Module: [Prices and Currencies by Country]
70
- * Get prices for variation based on Booster pricing
71
- *
72
- * @param object $product
73
- * @param array $variationIDs
74
- * @param id $groupID
75
- *
76
- * @return array
77
- */
78
- public function getVariationPrices($product, $variationIDs, $groupID)
79
- {
80
-
81
- $prices = array(
82
- 'price' => array(),
83
- 'regular_price' => array(),
84
- 'sale_price' => array(),
85
- );
86
-
87
- foreach ($variationIDs as $variationID) {
88
- $regularPrice = get_post_meta($variationID, '_wcj_price_by_country_regular_price_local_' . $groupID, true);
89
- $salePrice = get_post_meta($variationID, '_wcj_price_by_country_sale_price_local_' . $groupID, true);
90
-
91
- if (empty($regularPrice)) {
92
- $varProd = new \WC_Product_Variation($variationID);
93
- $regularPrice = $varProd->get_regular_price();
94
- }
95
-
96
- if (empty($salePrice)) {
97
- $varProd = isset($varProd) ? $varProd : new \WC_Product_Variation($variationID);
98
- $salePrice = $product->get_sale_price();
99
- }
100
-
101
- $regularPrice = wcj_price_by_country($regularPrice, $variationID, $groupID);
102
- $salePrice = wcj_price_by_country($salePrice, $variationID, $groupID);
103
-
104
- $prices['price'][$variationID] = $regularPrice;
105
- $prices['regular_price'][$variationID] = $regularPrice;
106
-
107
- if ($salePrice) {
108
- $prices['price'][$variationID] = $salePrice;
109
- $prices['sale_price'][$variationID] = $salePrice;
110
- }
111
-
112
- }
113
-
114
- return $prices;
115
- }
116
-
117
- /**
118
- * Module: [Prices and Currencies by Country]
119
- * Add extra separators to price
120
- *
121
- * @return void
122
- *
123
- */
124
- private function formatHTMLPrice()
125
- {
126
- add_action('init', function () {
127
- if (defined('DGWT_WCAS_AJAX_DETAILS_PANEL')) {
128
- add_filter('dgwt/wcas/product/html_price', array($this, 'decodePriceForDetailsPanel'), 10, 1);
129
- }
130
- });
131
-
132
- add_filter('dgwt/wcas/product/html_price', function ($html, $productID) {
133
-
134
- if ( ! defined('DGWT_WCAS_READABLE_INDEX_TASK')) {
135
- return $html;
136
- }
137
-
138
- $formated = '[booster.ioPricesByCountry:default]';
139
- $formated .= $html;
140
- $formated .= '[booster.ioPricesByCountry:end]';
141
-
142
- foreach ($this->countriesGroups as $groupID => $countries) {
143
-
144
- $p = wc_get_product($productID);
145
-
146
- if ($p->is_type('variable')) {
147
-
148
- $formated .= '[booster.ioPricesByCountry:group_' . implode('_', $countries) . ']';
149
- $formated .= $this->getVariablePriceHtml($p, $groupID);
150
- $formated .= '[booster.ioPricesByCountry:end]';
151
-
152
- } else {
153
- $regularPrice = get_post_meta($productID, '_wcj_price_by_country_regular_price_local_' . $groupID, true);
154
- $salePrice = get_post_meta($productID, '_wcj_price_by_country_sale_price_local_' . $groupID, true);
155
-
156
- if (empty($regularPrice)) {
157
- $regularPrice = $p->get_regular_price();
158
- }
159
-
160
- if (empty($salePrice)) {
161
- $salePrice = $p->get_sale_price();
162
- }
163
-
164
- $regularPrice = wcj_price_by_country($regularPrice, $productID, $groupID);
165
- $salePrice = wcj_price_by_country($salePrice, $productID, $groupID);
166
-
167
-
168
- $p->set_regular_price($regularPrice);
169
- $p->set_price($regularPrice);
170
-
171
- if ($salePrice) {
172
- $p->set_sale_price($salePrice);
173
- $p->set_price($salePrice);
174
- }
175
-
176
- $formated .= '[booster.ioPricesByCountry:group_' . implode('_', $countries) . ']';
177
- $formated .= $p->get_price_html();
178
- $formated .= '[booster.ioPricesByCountry:end]';
179
-
180
- }
181
-
182
- }
183
-
184
- return $formated;
185
- }, 10, 2);
186
- }
187
-
188
- /**
189
- * Decode pices for details panel
190
- */
191
- public function decodePriceForDetailsPanel($html)
192
- {
193
-
194
- $filters = new Filters();
195
-
196
- $html = $filters->formatPrice($html, $this->getCurrentCountry());
197
-
198
- return $html;
199
- }
200
-
201
-
202
- /**
203
- * Module: [Prices and Currencies by Country]
204
- * Check if module product by country is enabled
205
- *
206
- * @return bool
207
- */
208
- private function isPricesAndCurrenciesByCountryEnabled()
209
- {
210
- $enabled = false;
211
-
212
- $val = get_option('wcj_price_by_country_enabled');
213
-
214
- if ( ! empty($val) && $val === 'yes') {
215
- $enabled = true;
216
- }
217
-
218
- return $enabled;
219
-
220
- }
221
-
222
- /**
223
- * Module: [Prices and Currencies by Country]
224
- *
225
- * Get grouped countries
226
- */
227
- private function setGroupedCountries()
228
- {
229
- $groups = array();
230
- $total_number = apply_filters('booster_option', 1, get_option('wcj_price_by_country_total_groups_number', 1));
231
- for ($i = 1; $i <= $total_number; $i++) {
232
-
233
- $countries = array();
234
- switch (get_option('wcj_price_by_country_selection', 'comma_list')) {
235
- case 'comma_list':
236
- $countries = get_option('wcj_price_by_country_exchange_rate_countries_group_' . $i);
237
- break;
238
- case 'multiselect':
239
- $countries = ('' != ($group = get_option('wcj_price_by_country_countries_group_' . $i, '')) ? $group : array());
240
- break;
241
- case 'chosen_select':
242
- $countries = ('' != ($group = get_option('wcj_price_by_country_countries_group_chosen_select_' . $i, '')) ? $group : array());
243
- break;
244
- }
245
-
246
- $groups[$i] = $countries;
247
-
248
- }
249
-
250
- $this->countriesGroups = $groups;
251
- }
252
-
253
- /**
254
- * Module: [Prices and Currencies by Country]
255
- *
256
- * Remove filters for indexer
257
- *
258
- * @return void;
259
- */
260
- public function removePricingFilters()
261
- {
262
- $priority = wcj_get_module_price_hooks_priority('price_by_country');
263
- Helpers::removeFiltersForAnonymousClass('woocommerce_product_get_price', 'WCJ_Price_by_Country_Core', 'change_price', $priority);
264
- Helpers::removeFiltersForAnonymousClass('woocommerce_product_get_sale_price', 'WCJ_Price_by_Country_Core', 'change_price', $priority);
265
- Helpers::removeFiltersForAnonymousClass('woocommerce_product_get_regular_price', 'WCJ_Price_by_Country_Core', 'change_price', $priority);
266
-
267
- }
268
-
269
-
270
- /**
271
- * Modified method get_customer_country_group_id of WCJ_Price_by_Country_Core class
272
- *
273
- * @see booster-plus-for-woocommerce\includes\price-by-country\class-wcj-price-by-country-core.php LINE 294
274
- * Original version 4.1.0
275
- */
276
- public function setCurrentCountry()
277
- {
278
-
279
- if (
280
- ! function_exists('WC')
281
- || 'yes' === get_option('wcj_price_by_country_revert', 'no') && is_checkout()
282
- ) {
283
- return;
284
- }
285
-
286
- if ( ! empty($this->currentCountry)) {
287
- return $this->currentCountry;
288
- }
289
-
290
- $country = '';
291
-
292
- if (is_user_logged_in()
293
- && 'no' != ($override_option = get_option('wcj_price_by_country_override_on_checkout_with_billing_country', 'no'))
294
- && (
295
- ('all' === get_option('wcj_price_by_country_override_scope', 'all'))
296
- || ('checkout' === get_option('wcj_price_by_country_override_scope', 'all') && is_checkout())
297
- )
298
- && isset(WC()->customer)
299
- && (('yes' === $override_option && '' != WC()->customer->get_billing_country()) || ('shipping_country' === $override_option && '' != WC()->customer->get_shipping_country()))
300
- ) {
301
- $country = ('yes' === $override_option) ? WC()->customer->get_billing_country() : WC()->customer->get_shipping_country();
302
- }
303
-
304
- if (isset($_REQUEST['wcj_country_selector'])) {
305
- $country = sanitize_key($_REQUEST['wcj_country_selector']);
306
- }
307
-
308
- if ( ! empty($country) && strlen($country) === 2) {
309
- $this->currentCountry = strtoupper($country);
310
- }
311
-
312
- }
313
-
314
- /**
315
- * Get current country
316
- *
317
- * @return string
318
- */
319
- public function getCurrentCountry()
320
- {
321
- if ( ! session_id()) {
322
- session_start();
323
- }
324
-
325
- $country = '';
326
-
327
- if ( ! empty($_SESSION['wcj-country'])) {
328
- $country = $_SESSION['wcj-country'];
329
- }
330
-
331
- if ( ! empty($_SESSION['dgwt-wcas-boosterio-current-language'])) {
332
- $country = $_SESSION['dgwt-wcas-boosterio-current-language'];
333
- }
334
-
335
- return $country;
336
- }
337
-
338
- /**
339
- * Save current country in WC session
340
- *
341
- * @return void
342
- */
343
- public function saveCurrentCountry()
344
- {
345
-
346
- if ( ! session_id()) {
347
- session_start();
348
- }
349
- $_SESSION['dgwt-wcas-boosterio-current-language'] = $this->currentCountry;
350
-
351
- }
352
- }
4
 
5
  use DgoraWcas\Helpers;
6
 
7
+ class BoosterIO {
8
+
9
+ private $countriesGroups = array();
10
+ private $currentCountry = '';
11
+
12
+ public function init() {
13
+ if ( ! class_exists( 'WC_Jetpack' ) ) {
14
+ return;
15
+ }
16
+
17
+ if ( $this->isPricesAndCurrenciesByCountryEnabled() ) {
18
+
19
+ add_action( 'dgwt/wcas/readable_index/bg_processing/before_task', array( $this, 'removePricingFilters' ) );
20
+
21
+ add_action( 'template_redirect', array( $this, 'setCurrentCountry' ), 100 );
22
+ add_action( 'template_redirect', array( $this, 'saveCurrentCountry' ), 200 );
23
+
24
+ $this->setGroupedCountries();
25
+ $this->formatHTMLPrice();
26
+ }
27
+
28
+ }
29
+
30
+ /**
31
+ * Module: [Prices and Currencies by Country]
32
+ * Get price HTML for variable product
33
+ *
34
+ * @param int $product
35
+ * @param int $groupID
36
+ *
37
+ * @return string
38
+ */
39
+ public function getVariablePriceHtml( $product, $groupID ) {
40
+ $variationIDs = $product->get_children();
41
+ $prices = $this->getVariationPrices( $product, $variationIDs, $groupID );
42
+
43
+ if ( empty( $prices['price'] ) ) {
44
+ $price = apply_filters( 'woocommerce_variable_empty_price_html', '', $product );
45
+ } else {
46
+ $min_price = current( $prices['price'] );
47
+ $max_price = end( $prices['price'] );
48
+ $min_reg_price = current( $prices['regular_price'] );
49
+ $max_reg_price = end( $prices['regular_price'] );
50
+
51
+ if ( $min_price !== $max_price ) {
52
+ $price = wc_format_price_range( $min_price, $max_price );
53
+ } elseif ( $product->is_on_sale() && $min_reg_price === $max_reg_price ) {
54
+ $price = wc_format_sale_price( wc_price( $max_reg_price ), wc_price( $min_price ) );
55
+ } else {
56
+ $price = wc_price( $min_price );
57
+ }
58
+
59
+ $price = apply_filters( 'woocommerce_variable_price_html', $price . $product->get_price_suffix(), $product );
60
+ }
61
+
62
+ return apply_filters( 'woocommerce_get_price_html', $price, $product );
63
+ }
64
+
65
+ /**
66
+ * Module: [Prices and Currencies by Country]
67
+ * Get prices for variation based on Booster pricing
68
+ *
69
+ * @param object $product
70
+ * @param array $variationIDs
71
+ * @param id $groupID
72
+ *
73
+ * @return array
74
+ */
75
+ public function getVariationPrices( $product, $variationIDs, $groupID ) {
76
+
77
+ $prices = array(
78
+ 'price' => array(),
79
+ 'regular_price' => array(),
80
+ 'sale_price' => array(),
81
+ );
82
+
83
+ foreach ( $variationIDs as $variationID ) {
84
+ $regularPrice = get_post_meta( $variationID, '_wcj_price_by_country_regular_price_local_' . $groupID, true );
85
+ $salePrice = get_post_meta( $variationID, '_wcj_price_by_country_sale_price_local_' . $groupID, true );
86
+
87
+ if ( empty( $regularPrice ) ) {
88
+ $varProd = new \WC_Product_Variation( $variationID );
89
+ $regularPrice = $varProd->get_regular_price();
90
+ }
91
+
92
+ if ( empty( $salePrice ) ) {
93
+ $varProd = isset( $varProd ) ? $varProd : new \WC_Product_Variation( $variationID );
94
+ $salePrice = $product->get_sale_price();
95
+ }
96
+
97
+ $regularPrice = wcj_price_by_country( $regularPrice, $variationID, $groupID );
98
+ $salePrice = wcj_price_by_country( $salePrice, $variationID, $groupID );
99
+
100
+ $prices['price'][ $variationID ] = $regularPrice;
101
+ $prices['regular_price'][ $variationID ] = $regularPrice;
102
+
103
+ if ( $salePrice ) {
104
+ $prices['price'][ $variationID ] = $salePrice;
105
+ $prices['sale_price'][ $variationID ] = $salePrice;
106
+ }
107
+
108
+ }
109
+
110
+ return $prices;
111
+ }
112
+
113
+ /**
114
+ * Module: [Prices and Currencies by Country]
115
+ * Add extra separators to price
116
+ *
117
+ * @return void
118
+ *
119
+ */
120
+ private function formatHTMLPrice() {
121
+ add_action( 'init', function () {
122
+ if ( defined( 'DGWT_WCAS_AJAX_DETAILS_PANEL' ) ) {
123
+ add_filter( 'dgwt/wcas/product/html_price', array( $this, 'decodePriceForDetailsPanel' ), 10, 1 );
124
+ }
125
+ } );
126
+
127
+ add_filter( 'dgwt/wcas/product/html_price', function ( $html, $productID ) {
128
+
129
+ if ( ! defined( 'DGWT_WCAS_READABLE_INDEX_TASK' ) ) {
130
+ return $html;
131
+ }
132
+
133
+ $formated = '[booster.ioPricesByCountry:default]';
134
+ $formated .= $html;
135
+ $formated .= '[booster.ioPricesByCountry:end]';
136
+
137
+ foreach ( $this->countriesGroups as $groupID => $countries ) {
138
+
139
+ $p = wc_get_product( $productID );
140
+
141
+ if ( $p->is_type( 'variable' ) ) {
142
+
143
+ $formated .= '[booster.ioPricesByCountry:group_' . implode( '_', $countries ) . ']';
144
+ $formated .= $this->getVariablePriceHtml( $p, $groupID );
145
+ $formated .= '[booster.ioPricesByCountry:end]';
146
+
147
+ } else {
148
+ $regularPrice = get_post_meta( $productID, '_wcj_price_by_country_regular_price_local_' . $groupID, true );
149
+ $salePrice = get_post_meta( $productID, '_wcj_price_by_country_sale_price_local_' . $groupID, true );
150
+
151
+ if ( empty( $regularPrice ) ) {
152
+ $regularPrice = $p->get_regular_price();
153
+ }
154
+
155
+ if ( empty( $salePrice ) ) {
156
+ $salePrice = $p->get_sale_price();
157
+ }
158
+
159
+ $regularPrice = wcj_price_by_country( $regularPrice, $productID, $groupID );
160
+ $salePrice = wcj_price_by_country( $salePrice, $productID, $groupID );
161
+
162
+
163
+ $p->set_regular_price( $regularPrice );
164
+ $p->set_price( $regularPrice );
165
+
166
+ if ( $salePrice ) {
167
+ $p->set_sale_price( $salePrice );
168
+ $p->set_price( $salePrice );
169
+ }
170
+
171
+ $formated .= '[booster.ioPricesByCountry:group_' . implode( '_', $countries ) . ']';
172
+ $formated .= $p->get_price_html();
173
+ $formated .= '[booster.ioPricesByCountry:end]';
174
+
175
+ }
176
+
177
+ }
178
+
179
+ return $formated;
180
+ }, 10, 2 );
181
+ }
182
+
183
+ /**
184
+ * Decode pices for details panel
185
+ */
186
+ public function decodePriceForDetailsPanel( $html ) {
187
+
188
+ $filters = new Filters();
189
+
190
+ $html = $filters->formatPrice( $html, $this->getCurrentCountry() );
191
+
192
+ return $html;
193
+ }
194
+
195
+
196
+ /**
197
+ * Module: [Prices and Currencies by Country]
198
+ * Check if module product by country is enabled
199
+ *
200
+ * @return bool
201
+ */
202
+ private function isPricesAndCurrenciesByCountryEnabled() {
203
+ $enabled = false;
204
+
205
+ $val = get_option( 'wcj_price_by_country_enabled' );
206
+
207
+ if ( ! empty( $val ) && $val === 'yes' ) {
208
+ $enabled = true;
209
+ }
210
+
211
+ return $enabled;
212
+
213
+ }
214
+
215
+ /**
216
+ * Module: [Prices and Currencies by Country]
217
+ *
218
+ * Get grouped countries
219
+ */
220
+ private function setGroupedCountries() {
221
+ $groups = array();
222
+ $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) );
223
+ for ( $i = 1; $i <= $total_number; $i ++ ) {
224
+
225
+ $countries = array();
226
+ switch ( get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
227
+ case 'comma_list':
228
+ $countries = get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i );
229
+ break;
230
+ case 'multiselect':
231
+ $countries = ( '' != ( $group = get_option( 'wcj_price_by_country_countries_group_' . $i, '' ) ) ? $group : array() );
232
+ break;
233
+ case 'chosen_select':
234
+ $countries = ( '' != ( $group = get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' ) ) ? $group : array() );
235
+ break;
236
+ }
237
+
238
+ $groups[ $i ] = $countries;
239
+
240
+ }
241
+
242
+ $this->countriesGroups = $groups;
243
+ }
244
+
245
+ /**
246
+ * Module: [Prices and Currencies by Country]
247
+ *
248
+ * Remove filters for indexer
249
+ *
250
+ * @return void;
251
+ */
252
+ public function removePricingFilters() {
253
+ $priority = wcj_get_module_price_hooks_priority( 'price_by_country' );
254
+ Helpers::removeFiltersForAnonymousClass( 'woocommerce_product_get_price', 'WCJ_Price_by_Country_Core', 'change_price', $priority );
255
+ Helpers::removeFiltersForAnonymousClass( 'woocommerce_product_get_sale_price', 'WCJ_Price_by_Country_Core', 'change_price', $priority );
256
+ Helpers::removeFiltersForAnonymousClass( 'woocommerce_product_get_regular_price', 'WCJ_Price_by_Country_Core', 'change_price', $priority );
257
+
258
+ }
259
+
260
+
261
+ /**
262
+ * Modified method get_customer_country_group_id of WCJ_Price_by_Country_Core class
263
+ *
264
+ * @see booster-plus-for-woocommerce\includes\price-by-country\class-wcj-price-by-country-core.php LINE 294
265
+ * Original version 4.1.0
266
+ */
267
+ public function setCurrentCountry() {
268
+
269
+ if (
270
+ ! function_exists( 'WC' )
271
+ || 'yes' === get_option( 'wcj_price_by_country_revert', 'no' ) && is_checkout()
272
+ ) {
273
+ return;
274
+ }
275
+
276
+ if ( ! empty( $this->currentCountry ) ) {
277
+ return $this->currentCountry;
278
+ }
279
+
280
+ $country = '';
281
+
282
+ if ( is_user_logged_in()
283
+ && 'no' != ( $override_option = get_option( 'wcj_price_by_country_override_on_checkout_with_billing_country', 'no' ) )
284
+ && (
285
+ ( 'all' === get_option( 'wcj_price_by_country_override_scope', 'all' ) )
286
+ || ( 'checkout' === get_option( 'wcj_price_by_country_override_scope', 'all' ) && is_checkout() )
287
+ )
288
+ && isset( WC()->customer )
289
+ && ( ( 'yes' === $override_option && '' != WC()->customer->get_billing_country() ) || ( 'shipping_country' === $override_option && '' != WC()->customer->get_shipping_country() ) )
290
+ ) {
291
+ $country = ( 'yes' === $override_option ) ? WC()->customer->get_billing_country() : WC()->customer->get_shipping_country();
292
+ }
293
+
294
+ if ( isset( $_REQUEST['wcj_country_selector'] ) ) {
295
+ $country = sanitize_key( $_REQUEST['wcj_country_selector'] );
296
+ }
297
+
298
+ if ( ! empty( $country ) && strlen( $country ) === 2 ) {
299
+ $this->currentCountry = strtoupper( $country );
300
+ }
301
+
302
+ }
303
+
304
+ /**
305
+ * Get current country
306
+ *
307
+ * @return string
308
+ */
309
+ public function getCurrentCountry() {
310
+ if ( ! session_id() ) {
311
+ session_start();
312
+ }
313
+
314
+ $country = '';
315
+
316
+ if ( ! empty( $_SESSION['wcj-country'] ) ) {
317
+ $country = $_SESSION['wcj-country'];
318
+ }
319
+
320
+ if ( ! empty( $_SESSION['dgwt-wcas-boosterio-current-language'] ) ) {
321
+ $country = $_SESSION['dgwt-wcas-boosterio-current-language'];
322
+ }
323
+
324
+ return $country;
325
+ }
326
+
327
+ /**
328
+ * Save current country in WC session
329
+ *
330
+ * @return void
331
+ */
332
+ public function saveCurrentCountry() {
333
+
334
+ if ( ! session_id() ) {
335
+ session_start();
336
+ }
337
+ $_SESSION['dgwt-wcas-boosterio-current-language'] = $this->currentCountry;
338
+
339
+ }
340
+ }
 
 
 
 
 
 
 
 
 
 
 
 
includes/Integrations/Plugins/BoosterIO/Filters.php CHANGED
@@ -5,226 +5,218 @@ namespace DgoraWcas\Integrations\Plugins\BoosterIO;
5
 
6
  use DgoraWcas\Engines\TNTSearchMySQL\Config;
7
 
8
- class Filters
9
- {
10
- const PLUGIN_NAME = 'booster-plus-for-woocommerce/booster-plus-for-woocommerce.php';
11
 
12
- private $country = '';
13
 
14
- public function init()
15
- {
16
 
17
- if ( ! Config::isPluginActive(self::PLUGIN_NAME)) {
18
- return;
19
- }
20
 
21
- $this->setCurrentCountry();
22
 
23
- // For module: Product Visibility by Country
24
- if ($this->isModuleEnabled('product_by_country')) {
25
- $this->excludeProductByCountry();
26
- }
27
 
28
- // Module: Prices and Currencies by Country
29
- if ($this->isModuleEnabled('price_by_country')) {
30
- $this->filterPrices();
31
- }
32
 
33
- }
34
 
35
- /**
36
- * Module: [Product Visibility by Country]
37
- * Set current country code based on PHP Session
38
- *
39
- * @return void
40
- */
41
- private function setCurrentCountry()
42
- {
43
- if ( ! session_id()) {
44
- session_start();
45
- }
46
 
47
- if ( ! empty($_SESSION['wcj-country'])) {
48
- $this->country = $_SESSION['wcj-country'];
49
- }
50
 
51
- if ( ! empty($_SESSION['dgwt-wcas-boosterio-current-language'])) {
52
- $this->country = $_SESSION['dgwt-wcas-boosterio-current-language'];
53
- }
54
 
55
- }
56
 
57
- /**
58
- * Module: [Product Visibility by Country]
59
- * Exlude all product by based on country
60
- */
61
- private function excludeProductByCountry()
62
- {
63
 
64
- add_filter('dgwt/wcas/tnt/search_results/ids', function ($ids) {
65
 
66
- global $wpdb;
67
 
68
- if (empty($this->country)) {
69
- return $ids;
70
- }
71
 
72
- $filteredIds = $ids;
73
 
74
- $i = 0;
75
- foreach ($ids as $id) {
76
 
77
- $sql = $wpdb->prepare("SELECT meta_value
78
  FROM $wpdb->postmeta
79
  WHERE post_id = %d
80
  AND meta_key = '_wcj_product_by_country_visible'
81
- ", $id);
82
-
83
- $rawCountries = $wpdb->get_var($sql);
84
-
85
- if ( ! empty($rawCountries) && strpos($rawCountries, 'a:') === 0) {
86
- $allowedCountries = unserialize($rawCountries);
87
- if ( ! empty($allowedCountries) && ! in_array($this->country, $allowedCountries)) {
88
- unset($filteredIds[$i]);
89
- }
90
- }
91
-
92
- $i++;
93
- }
94
-
95
- return $filteredIds;
96
- });
97
- }
98
-
99
- /**
100
- * Module: Prices and Currencies by Country
101
- *
102
- * Format prices on output
103
- *
104
- * @return void
105
- */
106
- private function filterPrices()
107
- {
108
-
109
- add_filter('dgwt/wcas/tnt/search_results/output', function ($output) {
110
-
111
- if ( ! empty($output['suggestions'])) {
112
- $i = 0;
113
- foreach ($output['suggestions'] as $suggestion) {
114
-
115
- if (isset($suggestion['price'])) {
116
- $output['suggestions'][$i]['price'] = $this->formatPrice($suggestion['price'], $this->country);
117
- }
118
-
119
- $i++;
120
- }
121
- }
122
-
123
- return $output;
124
- });
125
-
126
- }
127
-
128
- /**
129
- * Module: Prices and Currencies by Country
130
- *
131
- * Format price
132
- *
133
- * @param string $html
134
- * @param string $location
135
- *
136
- * @return string
137
- */
138
- public function formatPrice($html, $location)
139
- {
140
-
141
- $currentLocation = empty($location) || strlen($location) !== 2 ? '' : strtoupper($location);
142
-
143
- if (strpos($html, 'booster.ioPricesByCountry:default') !== false) {
144
- $groups = array();
145
-
146
- if (empty($currentLocation)) {
147
- return $this->getLocationPrice($html, 'default');
148
- }
149
-
150
-
151
- preg_match_all('/(?<=\[booster\.ioPricesByCountry\:group_).+?(?=\])/m', $html, $matches, PREG_SET_ORDER, 0);
152
-
153
- if ( ! empty($matches) && is_array($matches)) {
154
- foreach ($matches as $group) {
155
- if ( ! empty($group[0])) {
156
- $groups[$group[0]] = explode('_', $group[0]);
157
- }
158
- }
159
- }
160
-
161
-
162
- foreach ($groups as $group => $countries) {
163
- if ( ! empty($countries)) {
164
- foreach ($countries as $country) {
165
- if ($country === $currentLocation) {
166
- return $this->getLocationPrice($html, $group);
167
- }
168
- }
169
- }
170
- }
171
-
172
-
173
- return $this->getLocationPrice($html, 'default');
174
- }
175
-
176
- return $html;
177
- }
178
-
179
- /**
180
- * Module: Prices and Currencies by Country
181
- *
182
- * Finds a substring between two strings
183
- *
184
- * @return string
185
- */
186
- private function getLocationPrice($html, $location)
187
- {
188
-
189
- $key = empty($location) || $location === 'default' ? 'default' : 'group_' . $location;
190
-
191
- // Empty default price
192
- if ($key === 'default' && strpos($html, '[booster.ioPricesByCountry:default][booster.ioPricesByCountry:end]') !== false) {
193
- return '';
194
- }
195
-
196
- preg_match('/(?<=\[booster\.ioPricesByCountry\:' . $key . '\]).+?(?=\[booster\.ioPricesByCountry\:end\])/m', $html, $matches);
197
-
198
- if ( ! empty($matches) && is_array($matches)) {
199
- $html = $matches[0];
200
- }
201
-
202
- return $html;
203
- }
204
 
 
 
 
205
 
206
- /**
207
- * Module: [Product Visibility by Country]
208
- * Check if module product by country is enabled
209
- *
210
- * @param string $moduleName
211
- *
212
- * @return bool
213
- */
214
- private function isModuleEnabled($moduleName)
215
- {
216
- global $wpdb;
217
- $enabled = false;
218
- $optionKey = 'wcj_' . $moduleName . '_enabled';
219
-
220
- $val = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $optionKey));
221
 
222
- if ( ! empty($val) && $val === 'yes') {
223
- $enabled = true;
224
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
 
226
- return $enabled;
227
-
228
- }
229
-
230
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  use DgoraWcas\Engines\TNTSearchMySQL\Config;
7
 
8
+ class Filters {
9
+ const PLUGIN_NAME = 'booster-plus-for-woocommerce/booster-plus-for-woocommerce.php';
 
10
 
11
+ private $country = '';
12
 
13
+ public function init() {
 
14
 
15
+ if ( ! Config::isPluginActive( self::PLUGIN_NAME ) ) {
16
+ return;
17
+ }
18
 
19
+ $this->setCurrentCountry();
20
 
21
+ // For module: Product Visibility by Country
22
+ if ( $this->isModuleEnabled( 'product_by_country' ) ) {
23
+ $this->excludeProductByCountry();
24
+ }
25
 
26
+ // Module: Prices and Currencies by Country
27
+ if ( $this->isModuleEnabled( 'price_by_country' ) ) {
28
+ $this->filterPrices();
29
+ }
30
 
31
+ }
32
 
33
+ /**
34
+ * Module: [Product Visibility by Country]
35
+ * Set current country code based on PHP Session
36
+ *
37
+ * @return void
38
+ */
39
+ private function setCurrentCountry() {
40
+ if ( ! session_id() ) {
41
+ session_start();
42
+ }
 
43
 
44
+ if ( ! empty( $_SESSION['wcj-country'] ) ) {
45
+ $this->country = $_SESSION['wcj-country'];
46
+ }
47
 
48
+ if ( ! empty( $_SESSION['dgwt-wcas-boosterio-current-language'] ) ) {
49
+ $this->country = $_SESSION['dgwt-wcas-boosterio-current-language'];
50
+ }
51
 
52
+ }
53
 
54
+ /**
55
+ * Module: [Product Visibility by Country]
56
+ * Exlude all product by based on country
57
+ */
58
+ private function excludeProductByCountry() {
 
59
 
60
+ add_filter( 'dgwt/wcas/tnt/search_results/ids', function ( $ids ) {
61
 
62
+ global $wpdb;
63
 
64
+ if ( empty( $this->country ) ) {
65
+ return $ids;
66
+ }
67
 
68
+ $filteredIds = $ids;
69
 
70
+ $i = 0;
71
+ foreach ( $ids as $id ) {
72
 
73
+ $sql = $wpdb->prepare( "SELECT meta_value
74
  FROM $wpdb->postmeta
75
  WHERE post_id = %d
76
  AND meta_key = '_wcj_product_by_country_visible'
77
+ ", $id );
78
+
79
+ $rawCountries = $wpdb->get_var( $sql );
80
+
81
+ if ( ! empty( $rawCountries ) && strpos( $rawCountries, 'a:' ) === 0 ) {
82
+ $allowedCountries = unserialize( $rawCountries );
83
+ if ( ! empty( $allowedCountries ) && ! in_array( $this->country, $allowedCountries ) ) {
84
+ unset( $filteredIds[ $i ] );
85
+ }
86
+ }
87
+
88
+ $i ++;
89
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
+ return $filteredIds;
92
+ } );
93
+ }
94
 
95
+ /**
96
+ * Module: Prices and Currencies by Country
97
+ *
98
+ * Format prices on output
99
+ *
100
+ * @return void
101
+ */
102
+ private function filterPrices() {
 
 
 
 
 
 
 
103
 
104
+ add_filter( 'dgwt/wcas/tnt/search_results/output', function ( $output ) {
105
+
106
+ if ( ! empty( $output['suggestions'] ) ) {
107
+ $i = 0;
108
+ foreach ( $output['suggestions'] as $suggestion ) {
109
+
110
+ if ( isset( $suggestion['price'] ) ) {
111
+ $output['suggestions'][ $i ]['price'] = $this->formatPrice( $suggestion['price'], $this->country );
112
+ }
113
+
114
+ $i ++;
115
+ }
116
+ }
117
+
118
+ return $output;
119
+ } );
120
+
121
+ }
122
 
123
+ /**
124
+ * Module: Prices and Currencies by Country
125
+ *
126
+ * Format price
127
+ *
128
+ * @param string $html
129
+ * @param string $location
130
+ *
131
+ * @return string
132
+ */
133
+ public function formatPrice( $html, $location ) {
134
+
135
+ $currentLocation = empty( $location ) || strlen( $location ) !== 2 ? '' : strtoupper( $location );
136
+
137
+ if ( strpos( $html, 'booster.ioPricesByCountry:default' ) !== false ) {
138
+ $groups = array();
139
+
140
+ if ( empty( $currentLocation ) ) {
141
+ return $this->getLocationPrice( $html, 'default' );
142
+ }
143
+
144
+
145
+ preg_match_all( '/(?<=\[booster\.ioPricesByCountry\:group_).+?(?=\])/m', $html, $matches, PREG_SET_ORDER, 0 );
146
+
147
+ if ( ! empty( $matches ) && is_array( $matches ) ) {
148
+ foreach ( $matches as $group ) {
149
+ if ( ! empty( $group[0] ) ) {
150
+ $groups[ $group[0] ] = explode( '_', $group[0] );
151
+ }
152
+ }
153
+ }
154
+
155
+
156
+ foreach ( $groups as $group => $countries ) {
157
+ if ( ! empty( $countries ) ) {
158
+ foreach ( $countries as $country ) {
159
+ if ( $country === $currentLocation ) {
160
+ return $this->getLocationPrice( $html, $group );
161
+ }
162
+ }
163
+ }
164
+ }
165
+
166
+
167
+ return $this->getLocationPrice( $html, 'default' );
168
+ }
169
+
170
+ return $html;
171
+ }
172
+
173
+ /**
174
+ * Module: Prices and Currencies by Country
175
+ *
176
+ * Finds a substring between two strings
177
+ *
178
+ * @return string
179
+ */
180
+ private function getLocationPrice( $html, $location ) {
181
+
182
+ $key = empty( $location ) || $location === 'default' ? 'default' : 'group_' . $location;
183
+
184
+ // Empty default price
185
+ if ( $key === 'default' && strpos( $html, '[booster.ioPricesByCountry:default][booster.ioPricesByCountry:end]' ) !== false ) {
186
+ return '';
187
+ }
188
+
189
+ preg_match( '/(?<=\[booster\.ioPricesByCountry\:' . $key . '\]).+?(?=\[booster\.ioPricesByCountry\:end\])/m', $html, $matches );
190
+
191
+ if ( ! empty( $matches ) && is_array( $matches ) ) {
192
+ $html = $matches[0];
193
+ }
194
+
195
+ return $html;
196
+ }
197
+
198
+
199
+ /**
200
+ * Module: [Product Visibility by Country]
201
+ * Check if module product by country is enabled
202
+ *
203
+ * @param string $moduleName
204
+ *
205
+ * @return bool
206
+ */
207
+ private function isModuleEnabled( $moduleName ) {
208
+ global $wpdb;
209
+ $enabled = false;
210
+ $optionKey = 'wcj_' . $moduleName . '_enabled';
211
+
212
+ $val = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $optionKey ) );
213
+
214
+ if ( ! empty( $val ) && $val === 'yes' ) {
215
+ $enabled = true;
216
+ }
217
+
218
+ return $enabled;
219
+
220
+ }
221
+
222
+ }
includes/Integrations/Plugins/PluginsCompatibility.php CHANGED
@@ -2,38 +2,35 @@
2
 
3
  namespace DgoraWcas\Integrations\Plugins;
4
 
5
- class PluginsCompatibility
6
- {
7
-
8
- public function __construct()
9
- {
10
- $this->loadCompatibilities();
11
- }
12
-
13
- /**
14
- * Load class with compatibilities logic for current theme
15
- *
16
- * @return void
17
- */
18
- private function loadCompatibilities()
19
- {
20
-
21
- $direcories = glob(DGWT_WCAS_DIR . 'includes/Integrations/Plugins/*', GLOB_ONLYDIR);
22
-
23
- if ( ! empty($direcories) && is_array($direcories)) {
24
- foreach ($direcories as $dir) {
25
- $name = str_replace(DGWT_WCAS_DIR . 'includes/Integrations/Plugins/', '', $dir);
26
- $filename = $name . '.php';
27
-
28
- $file = $dir . '/' . $filename;
29
- $class = '\\DgoraWcas\\Integrations\\Plugins\\' . $name . "\\" . $name;
30
-
31
- if (file_exists($file) && class_exists($class)) {
32
- $tmp = new $class;
33
- $tmp->init();
34
- }
35
- }
36
- }
37
-
38
- }
39
- }
2
 
3
  namespace DgoraWcas\Integrations\Plugins;
4
 
5
+ class PluginsCompatibility {
6
+
7
+ public function __construct() {
8
+ $this->loadCompatibilities();
9
+ }
10
+
11
+ /**
12
+ * Load class with compatibilities logic for current theme
13
+ *
14
+ * @return void
15
+ */
16
+ private function loadCompatibilities() {
17
+
18
+ $direcories = glob( DGWT_WCAS_DIR . 'includes/Integrations/Plugins/*', GLOB_ONLYDIR );
19
+
20
+ if ( ! empty( $direcories ) && is_array( $direcories ) ) {
21
+ foreach ( $direcories as $dir ) {
22
+ $name = str_replace( DGWT_WCAS_DIR . 'includes/Integrations/Plugins/', '', $dir );
23
+ $filename = $name . '.php';
24
+
25
+ $file = $dir . '/' . $filename;
26
+ $class = '\\DgoraWcas\\Integrations\\Plugins\\' . $name . "\\" . $name;
27
+
28
+ if ( file_exists( $file ) && class_exists( $class ) ) {
29
+ $tmp = new $class;
30
+ $tmp->init();
31
+ }
32
+ }
33
+ }
34
+
35
+ }
36
+ }
 
 
 
includes/Integrations/Plugins/WooCommerce/WooCommerce.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\WooCommerce;
4
+
5
+ use \DgoraWcas\Helpers;
6
+
7
+ /**
8
+ * Integration with native WooCommerce filters
9
+ */
10
+ class WooCommerce {
11
+
12
+ public function init() {
13
+
14
+ add_filter( 'woocommerce_layered_nav_link', array( $this, 'add_search_param_to_link' ) );
15
+
16
+ add_filter( 'woocommerce_widget_get_current_page_url', array( $this, 'add_search_param_to_link' ) );
17
+
18
+ if ( Helpers::isProductSearchPage() ) {
19
+ add_filter( 'woocommerce_price_filter_sql', array( $this, 'filter_price_sql' ) );
20
+
21
+ add_filter( 'get_terms_args', array( $this, 'narrow_term_filters' ), 10, 2 );
22
+
23
+ add_filter( 'woocommerce_get_filtered_term_product_counts_query', array( $this, 'filter_counts_query' ) );
24
+ }
25
+ }
26
+
27
+ /**
28
+ * Add &dgwt_wcas=1 to the link
29
+ *
30
+ * @return string
31
+ */
32
+ public function add_search_param_to_link( $link ) {
33
+
34
+ if ( isset( $_GET['s'] ) ) {
35
+ $link = add_query_arg( array( 'dgwt_wcas' => '1' ), $link );
36
+ }
37
+
38
+ return $link;
39
+ }
40
+
41
+ /**
42
+ * Narrowing the list of products to those from our search engine
43
+ *
44
+ * @param string $sql
45
+ *
46
+ * @return string
47
+ */
48
+ public function filter_price_sql( $sql ) {
49
+ if ( ! Helpers::is_running_inside_class( 'WC_Widget_Price_Filter' ) ) {
50
+ return $sql;
51
+ }
52
+
53
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
54
+
55
+ if ( $post_ids ) {
56
+ $sql .= " AND product_id IN(" . implode( ',', $post_ids ) . ")";
57
+ }
58
+
59
+ return $sql;
60
+ }
61
+
62
+ /**
63
+ * Passing our search results to plugin's terms filters
64
+ *
65
+ * The plugin will use our products IDs to determine terms in the displayed filters.
66
+ *
67
+ * @param array $args An array of get_terms() arguments.
68
+ * @param string[] $taxonomies An array of taxonomy names.
69
+ *
70
+ * @return array
71
+ */
72
+ public function narrow_term_filters( $args, $taxonomies ) {
73
+ if ( ! Helpers::is_running_inside_class( 'WC_Widget_Layered_Nav' ) ) {
74
+ return $args;
75
+ }
76
+
77
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
78
+
79
+ if ( $post_ids ) {
80
+ $args['object_ids'] = $post_ids;
81
+ }
82
+
83
+ return $args;
84
+ }
85
+
86
+ /**
87
+ * Including products from our search engine in the term count display
88
+ *
89
+ * @param $query
90
+ *
91
+ * @return mixed
92
+ */
93
+ public function filter_counts_query( $query ) {
94
+ global $wpdb;
95
+
96
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
97
+
98
+ if ( $post_ids ) {
99
+ $query['where'] .= " AND $wpdb->posts.ID IN(" . implode( ',', $post_ids ) . ")";
100
+ }
101
+
102
+ return $query;
103
+ }
104
+ }
includes/Integrations/Plugins/WooCommerceAJAXFilters/WooCommerceAJAXFilters.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\WooCommerceAJAXFilters;
4
+
5
+ /**
6
+ * Integration with Advanced AJAX Product Filters
7
+ *
8
+ * Plugin URL: https://wordpress.org/plugins/woocommerce-ajax-filters/
9
+ * Author: BeRocket
10
+ */
11
+ class WooCommerceAJAXFilters {
12
+ public function init() {
13
+ if ( ! defined( 'BeRocket_AJAX_filters_version' ) ) {
14
+ return;
15
+ }
16
+ if ( version_compare( BeRocket_AJAX_filters_version, '1.4.1.8' ) <= 0 ) {
17
+ return;
18
+ }
19
+
20
+ add_filter( 'berocket_aapf_get_attribute_values_post__in_outside', array( $this, 'filterPostInIds' ), 20 );
21
+ }
22
+
23
+ /**
24
+ * Passing our search results to plugin
25
+ *
26
+ * The plugin uses our products IDs to determine the values in the displayed filters.
27
+ *
28
+ * @param boolean|integer[] $post__in
29
+ *
30
+ * @return boolean|integer[]
31
+ */
32
+ public function filterPostInIds( $post__in ) {
33
+ global $wp_query;
34
+
35
+ if ( $wp_query->get( 'dgwt_wcas', false ) === false ) {
36
+ return $post__in;
37
+ }
38
+
39
+ $posts_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
40
+
41
+ if ( ! empty( $posts_ids ) ) {
42
+ return $posts_ids;
43
+ }
44
+
45
+ return $post__in;
46
+ }
47
+ }
includes/Integrations/Plugins/WooCommerceProductFilters/WooCommerceProductFilters.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\WooCommerceProductFilters;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ /**
8
+ * Integration with Product Filters for WooCommerce
9
+ *
10
+ * Plugin URL: https://woocommerce.com/products/product-filters/
11
+ * Author: Automattic, developed by Nexter
12
+ */
13
+ class WooCommerceProductFilters {
14
+ public function init() {
15
+ if ( ! defined( 'WC_PRODUCT_FILTER_VERSION' ) ) {
16
+ return;
17
+ }
18
+ if ( version_compare( WC_PRODUCT_FILTER_VERSION, '1.1.16' ) < 0 ) {
19
+ return;
20
+ }
21
+ if ( ! Helpers::isProductSearchPage() ) {
22
+ return;
23
+ }
24
+
25
+ add_filter( 'wcpf_product_counts_search_sql', array( $this, 'wcpf_product_counts_search_sql' ) );
26
+ add_filter( 'woocommerce_price_filter_sql', array( $this, 'woocommerce_price_filter_sql' ), 10, 3 );
27
+ }
28
+
29
+ /**
30
+ * Narrowing the list of products to determine the number assigned to terms, to those returned by our search engine
31
+ *
32
+ * @param string $sql
33
+ *
34
+ * @return string
35
+ */
36
+ public function wcpf_product_counts_search_sql( $sql ) {
37
+ global $wpdb;
38
+
39
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
40
+
41
+ if ( $post_ids ) {
42
+ $sql = " AND $wpdb->posts.ID IN(" . implode( ',', $post_ids ) . ")";
43
+ }
44
+
45
+ return $sql;
46
+ }
47
+
48
+ /**
49
+ * Narrowing the list of products for determining edge prices to those returned by our search engine
50
+ *
51
+ * @param string $sql
52
+ *
53
+ * @return string
54
+ */
55
+ public function woocommerce_price_filter_sql( $sql, $meta_query_sql, $tax_query_sql ) {
56
+ global $wpdb;
57
+
58
+ if ( ! Helpers::is_running_inside_class( 'WooCommerce_Product_Filter_Plugin\Field\Price_Slider\Filter_Component' ) ) {
59
+ return $sql;
60
+ }
61
+
62
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
63
+
64
+ if ( $post_ids ) {
65
+ $sql .= " AND $wpdb->posts.ID IN(" . implode( ',', $post_ids ) . ")";
66
+ }
67
+
68
+ return $sql;
69
+ }
70
+ }
includes/Integrations/Plugins/WooCommerceProductTable/WooCommerceProductTable.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\WooCommerceProductTable;
4
+
5
+ use \DgoraWcas\Helpers;
6
+
7
+ /**
8
+ * Integration with WooCommerce Product Table
9
+ *
10
+ * Plugin URL: https://barn2.co.uk/wordpress-plugins/woocommerce-product-table/
11
+ * Author: Barn2 Plugins
12
+ */
13
+ class WooCommerceProductTable {
14
+ public function init() {
15
+ if ( ! defined( '\Barn2\Plugin\WC_Product_Table\PLUGIN_VERSION' ) ) {
16
+ return;
17
+ }
18
+ if ( version_compare( \Barn2\Plugin\WC_Product_Table\PLUGIN_VERSION, '2.6.2' ) < 0 ) {
19
+ return;
20
+ }
21
+
22
+ add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
23
+ }
24
+
25
+ /**
26
+ * Overwrite the search results in the table
27
+ *
28
+ * @param \WP_Query $query
29
+ */
30
+ public function pre_get_posts( $query ) {
31
+ if ( ! Helpers::isProductSearchPage() ) {
32
+ return;
33
+ }
34
+ if ( ! Helpers::is_running_inside_class( 'WC_Product_Table_Query' ) ) {
35
+ return;
36
+ }
37
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
38
+
39
+ if ( $post_ids ) {
40
+ // We set a variable to make our filters work for WP_Query
41
+ $query->set( 'dgwt_wcas', $query->query_vars['s'] );
42
+
43
+ $query->set( 'post__in', $post_ids );
44
+ $query->set( 'orderby', 'post__in' );
45
+
46
+ add_action( 'wp_footer', array( $this, 'add_js' ), 5 );
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Reset search value in search input and hide the search box above/below the table
52
+ */
53
+ public function add_js() {
54
+ ?>
55
+ <script>
56
+ (function ($) {
57
+ $(document).ready(function () {
58
+ $('.wc-product-table').on('init.wcpt', function (e, table) {
59
+ table.$table.prev('.wc-product-table-controls').find('.dataTables_filter input').val('').trigger('keyup');
60
+ table.$table.prev('.wc-product-table-controls').find('.dataTables_filter label').hide();
61
+ table.$table.next('.wc-product-table-controls').find('.dataTables_filter label').hide();
62
+ });
63
+ });
64
+ })(jQuery);
65
+ </script>
66
+ <?php
67
+ }
68
+ }
includes/Integrations/Plugins/WooCommerceProductsFilter/WooCommerceProductsFilter.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\WooCommerceProductsFilter;
4
+
5
+ /**
6
+ * Integration with WOOF – Products Filter for WooCommerce
7
+ *
8
+ * Plugin URL: https://wordpress.org/plugins/woocommerce-products-filter/
9
+ * Author: realmag777
10
+ */
11
+ class WooCommerceProductsFilter {
12
+ public function init() {
13
+ if ( ! defined( 'WOOF_VERSION' ) ) {
14
+ return;
15
+ }
16
+ if ( version_compare( WOOF_VERSION, '1.2.3' ) < 0 ) {
17
+ return;
18
+ }
19
+ if ( ! $this->is_search() ) {
20
+ return;
21
+ }
22
+
23
+ add_action( 'pre_get_posts', array( $this, 'search_products' ), 900000 );
24
+
25
+ add_filter( 'woof_print_content_before_search_form', array( $this, 'inject_search_filter' ) );
26
+
27
+ add_filter( 'woof_get_filtered_price_query', array( $this, 'get_filtered_price_query' ) );
28
+
29
+ add_filter( 'woof_get_terms_args', array( $this, 'get_terms_args' ) );
30
+ }
31
+
32
+ /**
33
+ * Set search query var if our custom search param is present
34
+ *
35
+ * @param \WP_Query $query
36
+ */
37
+ public function search_products( $query ) {
38
+ $dgwt_wcas_s = isset( $_GET['dgwt_wcas_s'] ) && ! empty( trim( $_GET['dgwt_wcas_s'] ) ) ? trim( $_GET['dgwt_wcas_s'] ) : '';
39
+
40
+ if ( ! empty( $dgwt_wcas_s ) ) {
41
+ $query->set( 's', $dgwt_wcas_s );
42
+ $query->is_search = true;
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Inject our custom search param to object with plugin's filters
48
+ *
49
+ * @param string $content
50
+ *
51
+ * @return string
52
+ */
53
+ public function inject_search_filter( $content = '' ) {
54
+ ob_start();
55
+ ?>
56
+ <script>
57
+ function dgwt_wcas_s_init() {
58
+ woof_current_values.dgwt_wcas_s = '<?php echo esc_js( get_search_query() ) ?>';
59
+ }
60
+
61
+ if (document.readyState != 'loading') {
62
+ dgwt_wcas_s_init();
63
+ } else {
64
+ document.addEventListener('DOMContentLoaded', dgwt_wcas_s_init);
65
+ }
66
+ </script>
67
+ <?php
68
+ $content .= ob_get_clean();
69
+
70
+ return $content;
71
+ }
72
+
73
+ /**
74
+ * Passing our search results to plugin's price filter
75
+ *
76
+ * The plugin will use our products IDs to determine the values in the displayed filters.
77
+ *
78
+ * @param string $sql
79
+ *
80
+ * @return string
81
+ */
82
+ public function get_filtered_price_query( $sql ) {
83
+ global $wpdb;
84
+
85
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
86
+
87
+ if ( $post_ids ) {
88
+ $sql .= " AND $wpdb->posts.ID IN(" . implode( ',', $post_ids ) . ")";
89
+ }
90
+
91
+ return $sql;
92
+ }
93
+
94
+ /**
95
+ * Passing our search results to plugin's terms filters
96
+ *
97
+ * The plugin will use our products IDs to determine terms in the displayed filters.
98
+ *
99
+ * @param array $args
100
+ *
101
+ * @return array
102
+ */
103
+ public function get_terms_args( $args ) {
104
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
105
+
106
+ if ( $post_ids ) {
107
+ $args['object_ids'] = $post_ids;
108
+ }
109
+
110
+ return $args;
111
+ }
112
+
113
+ /**
114
+ * Check if it's search page
115
+ *
116
+ * @return bool
117
+ */
118
+ private function is_search() {
119
+ if (
120
+ isset( $_GET['dgwt_wcas'] ) && $_GET['dgwt_wcas'] === '1' &&
121
+ isset( $_GET['post_type'] ) && $_GET['post_type'] === 'product' &&
122
+ (
123
+ ( isset( $_GET['s'] ) && ! empty( $_GET['s'] ) ) ||
124
+ ( isset( $_GET['dgwt_wcas_s'] ) && ! empty( $_GET['dgwt_wcas_s'] ) )
125
+ )
126
+ ) {
127
+ return true;
128
+ }
129
+
130
+ return false;
131
+ }
132
+ }
includes/Integrations/Plugins/WooProductFilter/WooProductFilter.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\WooProductFilter;
4
+
5
+ use \DgoraWcas\Engines\TNTSearchMySQL\SearchQuery\SearchResultsPageQuery;
6
+ use \DgoraWcas\Multilingual;
7
+
8
+ /**
9
+ * Integration with Woo Product Filter
10
+ *
11
+ * Plugin URL: https://wordpress.org/plugins/woo-product-filter/
12
+ * Author: WooBeWoo
13
+ */
14
+ class WooProductFilter {
15
+ public function init() {
16
+ if ( ! defined( 'WPF_VERSION' ) ) {
17
+ return;
18
+ }
19
+ if ( version_compare( WPF_VERSION, '1.2.8' ) < 0 ) {
20
+ return;
21
+ }
22
+
23
+ // TODO This filter must be added by the plugin author
24
+ add_filter( 'wpf_getFilteredPriceSql', array( $this, 'filter_price_sql' ) );
25
+
26
+ add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
27
+ }
28
+
29
+ /**
30
+ * Narrowing the list of products for determining edge prices to those returned by our search engine
31
+ *
32
+ * @param string $sql
33
+ *
34
+ * @return string
35
+ */
36
+ public function filter_price_sql( $sql ) {
37
+ global $wpdb;
38
+
39
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
40
+
41
+ if ( $post_ids ) {
42
+ $sql .= " AND $wpdb->posts.ID IN(" . implode( ',', $post_ids ) . ")";
43
+ }
44
+
45
+ return $sql;
46
+ }
47
+
48
+ /**
49
+ * Narrow the list of products in the AJAX search to those returned by our search engine
50
+ *
51
+ * Filtered custom WP_Query used by this plugin: wp-content/plugins/woo-product-filter/modules/woofilters/controller.php~152
52
+ *
53
+ * @param \WP_Query $query
54
+ */
55
+ public function pre_get_posts( $query ) {
56
+ if ( ! defined( 'DOING_AJAX' ) ) {
57
+ return;
58
+ }
59
+ if ( ! isset( $_POST['action'] ) || ( isset( $_POST['action'] ) && $_POST['action'] !== 'filtersFrontend' ) ) {
60
+ return;
61
+ }
62
+ if ( ! isset( $_POST['mod'] ) || ( isset( $_POST['mod'] ) && $_POST['mod'] !== 'woofilters' ) ) {
63
+ return;
64
+ }
65
+ if ( ! isset( $_POST['currenturl'] ) ) {
66
+ return;
67
+ }
68
+
69
+ $orderby = 'relevance';
70
+ $order = 'desc';
71
+
72
+ // parse args from url passed as POST var
73
+ $url_query = wp_parse_url( $_POST['currenturl'] );
74
+ $url_query_args = array();
75
+ wp_parse_str( $url_query['query'], $url_query_args );
76
+
77
+ if ( ! isset( $url_query_args['dgwt_wcas'] ) || ! isset( $url_query_args['s'] ) ) {
78
+ return;
79
+ }
80
+
81
+ if ( ! empty( $url_query_args['orderby'] ) ) {
82
+ $orderby = $url_query_args['orderby'];
83
+ }
84
+ if ( ! empty( $url_query_args['order'] ) ) {
85
+ $order = strtolower( $url_query_args['order'] );
86
+ }
87
+ if ( $orderby === 'price' ) {
88
+ $order = 'asc';
89
+ }
90
+
91
+ $search = new SearchResultsPageQuery();
92
+ $search->setPhrase( $url_query_args['s'] );
93
+
94
+ if ( Multilingual::isMultilingual() ) {
95
+ $search->setLang( Multilingual::getCurrentLanguage() );
96
+ }
97
+
98
+ $search->searchProducts();
99
+
100
+ $results = $search->getProducts( $orderby, $order );
101
+
102
+ $post_ids = array_map( 'intval', wp_list_pluck( $results, 'post_id' ) );
103
+ if ( $post_ids ) {
104
+ $query->set( 'post__in', $post_ids );
105
+ $query->set( 'orderby', 'post__in' );
106
+ }
107
+ }
108
+ }
includes/Integrations/Plugins/XforWooCommerceFilter/XforWooCommerceFilter.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\XforWooCommerceFilter;
4
+
5
+ use \DgoraWcas\Engines\TNTSearchMySQL\SearchQuery\SearchResultsPageQuery;
6
+ use \DgoraWcas\Multilingual;
7
+ use \DgoraWcas\Helpers;
8
+
9
+ /**
10
+ * Integration with Product Filter for WooCommerce
11
+ *
12
+ * Plugin URL: https://xforwoocommerce.com
13
+ * Author: 7VX LLC, USA CA
14
+ */
15
+ class XforWooCommerceFilter {
16
+ protected $post_ids = array();
17
+
18
+ public function init() {
19
+ if ( ! class_exists( 'XforWC_Product_Filters' ) ) {
20
+ return;
21
+ }
22
+ if ( version_compare( \XforWC_Product_Filters::$version, '7.2.3' ) < 0 ) {
23
+ return;
24
+ }
25
+
26
+ add_action( 'prdctfltr_add_inputs', array( $this, 'prdctfltr_add_inputs' ) );
27
+ add_action( 'pre_get_posts', array( $this, 'search_products' ), 1000000 );
28
+
29
+ add_filter( 'prdctfltr_get_terms_args', array( $this, 'prdctfltr_get_terms_args' ) );
30
+ }
31
+
32
+ /**
33
+ * Adding an input to be submitted during an AJAX query when changing filters
34
+ *
35
+ * Only on search page or during AJAX query on the search page.
36
+ */
37
+ public function prdctfltr_add_inputs() {
38
+ if (
39
+ Helpers::isProductSearchPage() ||
40
+ (
41
+ defined( 'DOING_AJAX' ) &&
42
+ isset( $_POST['action'] ) &&
43
+ $_POST['action'] === 'prdctfltr_respond_550' &&
44
+ isset( $_POST['pf_id'] ) &&
45
+ isset( $_POST['pf_filters'][ $_POST['pf_id'] ]['dgwt_wcas'] )
46
+ )
47
+ ) {
48
+ echo '<input type="hidden" name="dgwt_wcas" value="1" class="pf_added_input" />';
49
+ echo '<input type="hidden" name="post_type" value="product" class="pf_added_input" />';
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Narrow the list of products in the AJAX search to those returned by our search engine
55
+ *
56
+ * Filtered custom WP_Query used by this plugin: wp-content/plugins/xforwoocommerce/x-pack/prdctfltr/includes/pf-shortcode.php:1333
57
+ *
58
+ * @param \WP_Query $query
59
+ */
60
+ public function search_products( $query ) {
61
+ if ( ! $this->is_prdctfltr_ajax_search() ) {
62
+ return;
63
+ }
64
+
65
+ $orderby = isset( $_POST['pf_filters'][ $_POST['pf_id'] ]['orderby'] ) ? $_POST['pf_filters'][ $_POST['pf_id'] ]['orderby'] : 'relevance';
66
+ $order = 'desc';
67
+ if ( $orderby === 'price' ) {
68
+ $order = 'asc';
69
+ }
70
+ $phrase = $_POST['pf_filters'][ $_POST['pf_id'] ]['s'];
71
+
72
+ $search = new SearchResultsPageQuery();
73
+ $search->setPhrase( $phrase );
74
+
75
+ if ( Multilingual::isMultilingual() ) {
76
+ $search->setLang( Multilingual::getCurrentLanguage() );
77
+ }
78
+
79
+ $search->searchProducts();
80
+
81
+ $results = $search->getProducts( $orderby, $order );
82
+
83
+ $post_ids = array_map( 'intval', wp_list_pluck( $results, 'post_id' ) );
84
+ $this->post_ids = $post_ids;
85
+ if ( $post_ids ) {
86
+ $query->set( 's', '' );
87
+ $query->is_search = false;
88
+ $query->set( 'post__in', $post_ids );
89
+ $query->set( 'orderby', 'post__in' );
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Limit the number of terms to those associated with search results
95
+ *
96
+ * @param $args
97
+ *
98
+ * @return mixed
99
+ */
100
+ public function prdctfltr_get_terms_args( $args ) {
101
+ if ( ! Helpers::isProductSearchPage() && ! $this->is_prdctfltr_ajax_search() ) {
102
+ return $args;
103
+ }
104
+
105
+ // If we are in the middle of an AJAX query, we get product ids related with custom WP_Query.
106
+ if ( $this->is_prdctfltr_ajax_search() ) {
107
+ $post_ids = $this->post_ids;
108
+ } else {
109
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
110
+ }
111
+
112
+ if ( $post_ids ) {
113
+ $args['object_ids'] = $post_ids;
114
+ }
115
+
116
+ return $args;
117
+ }
118
+
119
+ /**
120
+ * Checking if we are in the middle of an AJAX query that handles filter and search results refreshing
121
+ *
122
+ * @return bool
123
+ */
124
+ private function is_prdctfltr_ajax_search() {
125
+ if ( ! defined( 'DOING_AJAX' ) ) {
126
+ return false;
127
+ }
128
+ if ( ! isset( $_POST['action'] ) ) {
129
+ return false;
130
+ }
131
+ if ( $_POST['action'] !== 'prdctfltr_respond_550' ) {
132
+ return false;
133
+ }
134
+ if ( ! isset( $_POST['pf_id'] ) ) {
135
+ return false;
136
+ }
137
+ if ( ! isset( $_POST['pf_filters'][ $_POST['pf_id'] ] ) ) {
138
+ return false;
139
+ }
140
+ if ( ! isset( $_POST['pf_filters'][ $_POST['pf_id'] ]['s'] ) ) {
141
+ return false;
142
+ }
143
+ if ( ! isset( $_POST['pf_filters'][ $_POST['pf_id'] ]['dgwt_wcas'] ) ) {
144
+ return false;
145
+ }
146
+
147
+ return true;
148
+ }
149
+ }
includes/Integrations/Solver.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations;
4
+
5
+ // Exit if accessed directly
6
+ if ( !defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+ /**
10
+ * Class Solver
11
+ *
12
+ * Solves conflicts with other plugins
13
+ */
14
+ class Solver
15
+ {
16
+ public function __construct()
17
+ {
18
+ $this->solveSearchWPWooCommerceIntegration();
19
+ $this->solveDiviWithBuilderWC();
20
+ $this->solveMedicorCoreScrips();
21
+ }
22
+
23
+ /**
24
+ * Solves conflict with SearchWP WooCommerce Integration by SearchWP, LLC
25
+ * Tested version: plugin SearchWP WooCommerce Integration by SearchWP v1.2.1
26
+ *
27
+ * Reason: Empty search page (no results). The plugin removes query_vars['s']
28
+ *
29
+ * @return void
30
+ */
31
+ public function solveSearchWPWooCommerceIntegration()
32
+ {
33
+
34
+ if ( isset( $_GET['dgwt_wcas'] ) ) {
35
+ add_filter( 'searchwp_woocommerce_forced', '__return_false', PHP_INT_MAX );
36
+ add_filter( 'searchwp_short_circuit', '__return_true', PHP_INT_MAX );
37
+ }
38
+
39
+ }
40
+
41
+ /**
42
+ * Solves conflict with the DIVI builder
43
+ * Tested version: theme DIVI v3.19.18
44
+ *
45
+ * Reason: WP Query for search results was overwritten ih the hook pre_get_posts
46
+ */
47
+ public function solveDiviWithBuilderWC()
48
+ {
49
+ add_action( 'init', function () {
50
+ if ( isset( $_GET['dgwt_wcas'] ) ) {
51
+ remove_action( 'pre_get_posts', 'et_builder_wc_pre_get_posts', 10 );
52
+ }
53
+ } );
54
+ }
55
+
56
+ /**
57
+ * Medicor plugin by WpOpal uses wp_dequeue_style( 'dgwt-wcas-style' ); in their code.
58
+ * I don't know why they block my CSS, but I have to force to restore it.
59
+ */
60
+ private function solveMedicorCoreScrips()
61
+ {
62
+ if ( class_exists( 'MedicorCore' ) ) {
63
+ add_action( 'wp_print_styles', function () {
64
+ wp_enqueue_style( 'dgwt-wcas-style' );
65
+ }, PHP_INT_MAX );
66
+ }
67
+ }
68
+
69
+ }
includes/Integrations/Themes/Astra/Astra.php CHANGED
@@ -4,30 +4,32 @@ namespace DgoraWcas\Integrations\Themes\Astra;
4
 
5
  use DgoraWcas\Helpers;
6
 
 
 
 
 
7
 
8
- class Astra
9
- {
10
 
11
- private $themeSlug = 'astra';
12
 
13
- private $themeName = 'Astra';
14
 
15
- public function __construct()
16
- {
17
- if(defined('ASTRA_EXT_VER')) {
18
- add_filter('dgwt/wcas/suggestion_details/show_quantity', '__return_false');
19
- }
20
 
21
- add_action('admin_head', function(){
22
- ?>
23
- <style>
24
- #dgwt_wcas_basic .submit {
25
- display: none!important;
26
- }
27
- </style>
28
- <?php
29
- });
30
 
31
- }
32
 
33
- }
4
 
5
  use DgoraWcas\Helpers;
6
 
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
 
12
+ class Astra {
 
13
 
14
+ private $themeSlug = 'astra';
15
 
16
+ private $themeName = 'Astra';
17
 
18
+ public function __construct() {
19
+ if ( defined( 'ASTRA_EXT_VER' ) ) {
20
+ add_filter( 'dgwt/wcas/suggestion_details/show_quantity', '__return_false' );
21
+ }
 
22
 
23
+ add_action( 'admin_head', function () {
24
+ ?>
25
+ <style>
26
+ #dgwt_wcas_basic .submit {
27
+ display: none !important;
28
+ }
29
+ </style>
30
+ <?php
31
+ } );
32
 
33
+ }
34
 
35
+ }
includes/Integrations/Themes/Enfold/Enfold.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\Enfold;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Enfold {
13
+
14
+ private $themeSlug = 'enfold';
15
+
16
+ private $themeName = 'Enfold';
17
+
18
+ public function __construct() {
19
+
20
+ add_action( 'init', function () {
21
+
22
+ add_action( 'wp_head', array( $this, 'customCSS' ) );
23
+ add_action( 'wp_footer', array( $this, 'customJS' ) );
24
+
25
+ } );
26
+ }
27
+
28
+
29
+ /**
30
+ * Custom CSS
31
+ *
32
+ * @return void
33
+ */
34
+ public function customCSS() {
35
+ ?>
36
+ <style>
37
+ #top .dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
38
+ padding: 10px 15px 10px 40px;
39
+ margin: 0;
40
+ }
41
+
42
+ #top.rtl .dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
43
+ padding: 10px 40px 10px 15px
44
+ }
45
+ </style>
46
+ <?php
47
+ }
48
+
49
+ /**
50
+ * Custom JS
51
+ *
52
+ * @return void
53
+ */
54
+ public function customJS() {
55
+ ?>
56
+ <script>
57
+ (function ($) {
58
+ function avia_apply_quant_btn() {
59
+ jQuery(".quantity input[type=number]").each(function () {
60
+ var number = $(this),
61
+ max = parseFloat(number.attr('max')),
62
+ min = parseFloat(number.attr('min')),
63
+ step = parseInt(number.attr('step'), 10),
64
+ newNum = jQuery(jQuery('<div />').append(number.clone(true)).html().replace('number', 'text')).insertAfter(number);
65
+ number.remove();
66
+
67
+ setTimeout(function () {
68
+ if (newNum.next('.plus').length === 0) {
69
+ var minus = jQuery('<input type="button" value="-" class="minus">').insertBefore(newNum),
70
+ plus = jQuery('<input type="button" value="+" class="plus">').insertAfter(newNum);
71
+
72
+ minus.on('click', function () {
73
+ var the_val = parseInt(newNum.val(), 10) - step;
74
+ the_val = the_val < 0 ? 0 : the_val;
75
+ the_val = the_val < min ? min : the_val;
76
+ newNum.val(the_val).trigger("change");
77
+ });
78
+ plus.on('click', function () {
79
+ var the_val = parseInt(newNum.val(), 10) + step;
80
+ the_val = the_val > max ? max : the_val;
81
+ newNum.val(the_val).trigger("change");
82
+
83
+ });
84
+ }
85
+ }, 10);
86
+
87
+ });
88
+ }
89
+
90
+ $(document).ready(function () {
91
+
92
+ $(document).on('dgwtWcasDetailsPanelLoaded', function(){
93
+ avia_apply_quant_btn();
94
+ });
95
+ });
96
+
97
+ }(jQuery));
98
+ </script>
99
+ <?php
100
+ }
101
+
102
+ }
includes/Integrations/Themes/Flatsome/Flatsome.php CHANGED
@@ -4,277 +4,274 @@ namespace DgoraWcas\Integrations\Themes\Flatsome;
4
 
5
  use DgoraWcas\Helpers;
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- class Flatsome
9
- {
10
-
11
- private $themeSlug = 'flatsome';
12
-
13
- private $themeName = 'Flatsome';
14
-
15
- public function __construct()
16
- {
17
- $this->replaceForm();
18
-
19
- add_filter('dgwt/wcas/settings', array($this, 'registerSettings'));
20
- }
21
-
22
- /**
23
- * Add settings
24
- *
25
- * @param array $settings
26
- *
27
- * @return array
28
- */
29
- public function registerSettings($settings)
30
- {
31
- $key = 'dgwt_wcas_basic';
32
-
33
- $settings[$key][10] = array(
34
- 'name' => $this->themeSlug . '_main_head',
35
- 'label' => __('Replace Flatsome search bar', 'ajax-search-for-woocommerce'),
36
- 'type' => 'head',
37
- 'class' => 'dgwt-wcas-sgs-header'
38
- );
39
-
40
- $settings[$key][52] = array(
41
- 'name' => $this->themeSlug . '_settings_head',
42
- 'label' => __('Flatsome Theme', 'ajax-search-for-woocommerce'),
43
- 'type' => 'desc',
44
- 'desc' => Helpers::embeddingInThemeHtml(),
45
- 'class' => 'dgwt-wcas-sgs-themes-label',
46
- );
47
-
48
- $img = DGWT_WCAS()->themeCompatibility->getThemeImageSrc();
49
- if ( ! empty($img)) {
50
- $settings[$key][52]['label'] = '<img src="' . $img . '">';
51
- }
52
-
53
- $settings[$key][55] = array(
54
- 'name' => $this->themeSlug . '_replace_search',
55
- 'label' => __('Replace', 'ajax-search-for-woocommerce'),
56
- 'desc' => __('Replaces all Flatsome search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce'),
57
- 'type' => 'checkbox',
58
- 'default' => 'off',
59
- );
60
-
61
- $settings[$key][90] = array(
62
- 'name' => $this->themeSlug . '_othersways__head',
63
- 'label' => __('Alternative ways to embed a search bar', 'ajax-search-for-woocommerce'),
64
- 'type' => 'head',
65
- 'class' => 'dgwt-wcas-sgs-header'
66
- );
67
-
68
- return $settings;
69
- }
70
-
71
- /**
72
- * Check if can replace the native Storefront search form
73
- * by the Ajax Search for WooCommerce form.
74
- *
75
- * @return bool
76
- */
77
- private function canReplaceSearch()
78
- {
79
- $canIntegrate = false;
80
-
81
- if (DGWT_WCAS()->settings->getOption($this->themeSlug . '_replace_search', 'off') === 'on') {
82
- $canIntegrate = true;
83
- }
84
-
85
- return $canIntegrate;
86
- }
87
-
88
- /**
89
- * Mark the native search form to replace
90
- *
91
- * @return void
92
- */
93
- private function replaceForm()
94
- {
95
- if ($this->canReplaceSearch()) {
96
-
97
- $this->applyCSS();
98
- $this->applyJS();
99
-
100
- add_filter('body_class', function ($classes) {
101
- $classes[] = 'dgwt-wcas-theme-flatsome';
102
-
103
- return $classes;
104
- });
105
-
106
- add_action('wp_loaded', function () {
107
- remove_shortcode('search');
108
- add_shortcode('search', array('DgoraWcas\\Shortcode', 'addBody'));
109
- });
110
-
111
- // Change mobile breakpoint from 992 to 850
112
- add_filter('dgwt/wcas/scripts/mobile_breakpoint', function () {
113
- return 850;
114
- });
115
-
116
- // Change overlay wrapper from body do .mfp-wrap .sidebar-menu
117
- add_filter('dgwt/wcas/scripts/mobile_overlay_wrapper', function () {
118
- return '.mfp-wrap .sidebar-menu';
119
- });
120
-
121
-
122
- }
123
- }
124
-
125
-
126
- /**
127
- * Apply custom CSS
128
- *
129
- * @return void
130
- */
131
- private function applyCSS()
132
- {
133
-
134
- add_action('wp_head', function () {
135
- ?>
136
- <style>
137
- .dgwt-wcas-flatsome-up {
138
- margin-top: -40vh;
139
- }
140
-
141
- #search-lightbox .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input {
142
- height: 60px;
143
- font-size: 20px;
144
- }
145
-
146
- #search-lightbox .dgwt-wcas-search-wrapp {
147
- -webkit-transition: all 100ms ease-in-out;
148
- -moz-transition: all 100ms ease-in-out;
149
- -ms-transition: all 100ms ease-in-out;
150
- -o-transition: all 100ms ease-in-out;
151
- transition: all 100ms ease-in-out;
152
- }
153
-
154
- .dgwt-wcas-overlay-mobile-on .mfp-wrap .mfp-content {
155
- width: 100vw;
156
- }
157
-
158
- .dgwt-wcas-overlay-mobile-on .mfp-close,
159
- .dgwt-wcas-overlay-mobile-on .nav-sidebar {
160
- display: none;
161
- }
162
-
163
- .dgwt-wcas-overlay-mobile-on .main-menu-overlay {
164
- display: none;
165
- }
166
-
167
- .dgwt-wcas-open .header-search-dropdown .nav-dropdown {
168
- opacity: 1;
169
- max-height: inherit;
170
- left: -15px !important;
171
- }
172
-
173
- .dgwt-wcas-open:not(.dgwt-wcas-theme-flatsome-dd-sc) .nav-right .header-search-dropdown .nav-dropdown {
174
- left: auto;
175
- /*right: -15px;*/
176
- }
177
-
178
- .dgwt-wcas-theme-flatsome .nav-dropdown .dgwt-wcas-search-wrapp {
179
- min-width: 450px;
180
- }
181
-
182
- .header-search-form {
183
- min-width: 250px;
184
- }
185
-
186
- </style>
187
- <?php
188
- });
189
-
190
- }
191
 
192
- /**
193
- * Apply custom JS
194
- *
195
- * @return void
196
- */
197
- private function applyJS()
198
- {
199
 
200
- add_action('wp_footer', function () {
201
 
202
- $minChars = DGWT_WCAS()->settings->getOption('min_chars');
203
- if (empty($minChars) || ! is_numeric($minChars)) {
204
- $minChars = 3;
205
- }
 
 
206
 
207
- // @TODO Dropdown on search hover
208
- ?>
209
- <script>
210
- (function ($) {
211
 
212
- $(document).ready(function () {
 
 
 
213
 
214
- $(document).on('keyup', '#search-lightbox .dgwt-wcas-search-wrapp .dgwt-wcas-search-input', function () {
215
- if (this.value.length >= <?php echo $minChars; ?>) {
216
- $(this).closest('.dgwt-wcas-search-wrapp').addClass('dgwt-wcas-flatsome-up')
217
- }
218
- });
219
 
220
- var refreshDropdownPosition;
221
- var style = '';
222
- var positioning = false;
223
- $(document).on('mouseenter', '.header-search-dropdown a', function (e) {
224
 
225
- if (positioning) {
226
- return;
227
- }
228
-
229
- setTimeout(function () {
230
- var pos = $(e.target).closest('.header-search').find('.nav-dropdown').attr('style');
231
 
232
- if (typeof pos == 'string' && pos.length > 0) {
233
- style = pos;
234
- }
 
235
 
236
- refreshDropdownPosition = setInterval(function () {
 
 
 
 
 
237
 
238
- if ($('body').hasClass('dgwt-wcas-open') && style.length > 0) {
239
- $('.nav-dropdown').attr('style', style);
240
- }
241
 
 
242
 
243
- if (!$('body').hasClass('dgwt-wcas-open') && !$('.header-search').hasClass('current-dropdown')) {
244
- clearInterval(refreshDropdownPosition);
245
- $('.nav-dropdown').removeAttr('style');
246
- style = '';
247
- positioning = false;
248
- }
249
 
250
- }, 10)
251
 
252
- }, 400);
 
 
 
 
 
253
 
254
- positioning = true;
255
- });
256
 
257
- $(document).on('click', '.header-search-lightbox .header-button a', function () {
258
 
259
- var formWrapper = $('#search-lightbox').find('.dgwt-wcas-search-wrapp');
260
- setTimeout(function () {
261
- if (formWrapper.find('.dgwt-wcas-close')[0]) {
262
- formWrapper.find('.dgwt-wcas-close')[0].click();
263
- }
264
 
265
- formWrapper.removeClass('dgwt-wcas-flatsome-up');
266
- formWrapper.find('.dgwt-wcas-search-input').focus();
267
- }, 1);
268
 
269
- });
270
- });
 
 
 
271
 
272
- })(jQuery);
 
 
273
 
274
- </script>
275
- <?php
276
- }, 1000);
277
 
278
- }
279
 
280
- }
 
 
 
 
 
 
4
 
5
  use DgoraWcas\Helpers;
6
 
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Flatsome {
13
+
14
+ private $themeSlug = 'flatsome';
15
+
16
+ private $themeName = 'Flatsome';
17
+
18
+ public function __construct() {
19
+ $this->replaceForm();
20
+
21
+ add_filter( 'dgwt/wcas/settings', array( $this, 'registerSettings' ) );
22
+ }
23
+
24
+ /**
25
+ * Add settings
26
+ *
27
+ * @param array $settings
28
+ *
29
+ * @return array
30
+ */
31
+ public function registerSettings( $settings ) {
32
+ $key = 'dgwt_wcas_basic';
33
+
34
+ $settings[ $key ][10] = array(
35
+ 'name' => $this->themeSlug . '_main_head',
36
+ 'label' => __( 'Replace Flatsome search bar', 'ajax-search-for-woocommerce' ),
37
+ 'type' => 'head',
38
+ 'class' => 'dgwt-wcas-sgs-header'
39
+ );
40
+
41
+ $settings[ $key ][52] = array(
42
+ 'name' => $this->themeSlug . '_settings_head',
43
+ 'label' => __( 'Flatsome Theme', 'ajax-search-for-woocommerce' ),
44
+ 'type' => 'desc',
45
+ 'desc' => Helpers::embeddingInThemeHtml(),
46
+ 'class' => 'dgwt-wcas-sgs-themes-label',
47
+ );
48
+
49
+ $img = DGWT_WCAS()->themeCompatibility->getThemeImageSrc();
50
+ if ( ! empty( $img ) ) {
51
+ $settings[ $key ][52]['label'] = '<img src="' . $img . '">';
52
+ }
53
+
54
+ $settings[ $key ][55] = array(
55
+ 'name' => $this->themeSlug . '_replace_search',
56
+ 'label' => __( 'Replace', 'ajax-search-for-woocommerce' ),
57
+ 'desc' => __( 'Replace all Flatsome search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce' ),
58
+ 'type' => 'checkbox',
59
+ 'default' => 'off',
60
+ );
61
+
62
+ $settings[ $key ][90] = array(
63
+ 'name' => $this->themeSlug . '_othersways__head',
64
+ 'label' => __( 'Alternative ways to embed a search bar', 'ajax-search-for-woocommerce' ),
65
+ 'type' => 'head',
66
+ 'class' => 'dgwt-wcas-sgs-header'
67
+ );
68
+
69
+ return $settings;
70
+ }
71
+
72
+ /**
73
+ * Check if can replace the native Storefront search form
74
+ * by the Ajax Search for WooCommerce form.
75
+ *
76
+ * @return bool
77
+ */
78
+ private function canReplaceSearch() {
79
+ $canIntegrate = false;
80
+
81
+ if ( DGWT_WCAS()->settings->getOption( $this->themeSlug . '_replace_search', 'off' ) === 'on' ) {
82
+ $canIntegrate = true;
83
+ }
84
+
85
+ return $canIntegrate;
86
+ }
87
+
88
+ /**
89
+ * Mark the native search form to replace
90
+ *
91
+ * @return void
92
+ */
93
+ private function replaceForm() {
94
+ if ( $this->canReplaceSearch() ) {
95
+
96
+ $this->applyCSS();
97
+ $this->applyJS();
98
+
99
+ add_filter( 'body_class', function ( $classes ) {
100
+ $classes[] = 'dgwt-wcas-theme-flatsome';
101
+
102
+ return $classes;
103
+ } );
104
+
105
+ add_action( 'wp_loaded', function () {
106
+ remove_shortcode( 'search' );
107
+ add_shortcode( 'search', array( 'DgoraWcas\\Shortcode', 'addBody' ) );
108
+ } );
109
+
110
+ // Change mobile breakpoint from 992 to 850
111
+ add_filter( 'dgwt/wcas/scripts/mobile_breakpoint', function () {
112
+ return 850;
113
+ } );
114
+
115
+ // Change overlay wrapper from body do .mfp-wrap .sidebar-menu
116
+ add_filter( 'dgwt/wcas/scripts/mobile_overlay_wrapper', function () {
117
+ return '.mfp-wrap .sidebar-menu';
118
+ } );
119
+
120
+
121
+ }
122
+ }
123
+
124
+
125
+ /**
126
+ * Apply custom CSS
127
+ *
128
+ * @return void
129
+ */
130
+ private function applyCSS() {
131
+
132
+ add_action( 'wp_head', function () {
133
+ ?>
134
+ <style>
135
+ .dgwt-wcas-flatsome-up {
136
+ margin-top: -40vh;
137
+ }
138
+
139
+ #search-lightbox .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input {
140
+ height: 60px;
141
+ font-size: 20px;
142
+ }
143
+
144
+ #search-lightbox .dgwt-wcas-search-wrapp {
145
+ -webkit-transition: all 100ms ease-in-out;
146
+ -moz-transition: all 100ms ease-in-out;
147
+ -ms-transition: all 100ms ease-in-out;
148
+ -o-transition: all 100ms ease-in-out;
149
+ transition: all 100ms ease-in-out;
150
+ }
151
+
152
+ .dgwt-wcas-overlay-mobile-on .mfp-wrap .mfp-content {
153
+ width: 100vw;
154
+ }
155
+
156
+ .dgwt-wcas-overlay-mobile-on .mfp-close,
157
+ .dgwt-wcas-overlay-mobile-on .nav-sidebar {
158
+ display: none;
159
+ }
160
+
161
+ .dgwt-wcas-overlay-mobile-on .main-menu-overlay {
162
+ display: none;
163
+ }
164
+
165
+ .dgwt-wcas-open .header-search-dropdown .nav-dropdown {
166
+ opacity: 1;
167
+ max-height: inherit;
168
+ left: -15px !important;
169
+ }
170
+
171
+ .dgwt-wcas-open:not(.dgwt-wcas-theme-flatsome-dd-sc) .nav-right .header-search-dropdown .nav-dropdown {
172
+ left: auto;
173
+ /*right: -15px;*/
174
+ }
175
+
176
+ .dgwt-wcas-theme-flatsome .nav-dropdown .dgwt-wcas-search-wrapp {
177
+ min-width: 450px;
178
+ }
179
 
180
+ .header-search-form {
181
+ min-width: 250px;
182
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
+ </style>
185
+ <?php
186
+ } );
 
 
 
 
187
 
188
+ }
189
 
190
+ /**
191
+ * Apply custom JS
192
+ *
193
+ * @return void
194
+ */
195
+ private function applyJS() {
196
 
197
+ add_action( 'wp_footer', function () {
 
 
 
198
 
199
+ $minChars = DGWT_WCAS()->settings->getOption( 'min_chars' );
200
+ if ( empty( $minChars ) || ! is_numeric( $minChars ) ) {
201
+ $minChars = 3;
202
+ }
203
 
204
+ // @TODO Dropdown on search hover
205
+ ?>
206
+ <script>
207
+ (function ($) {
 
208
 
209
+ $(document).ready(function () {
 
 
 
210
 
211
+ $(document).on('keyup', '#search-lightbox .dgwt-wcas-search-wrapp .dgwt-wcas-search-input', function () {
212
+ if (this.value.length >= <?php echo $minChars; ?>) {
213
+ $(this).closest('.dgwt-wcas-search-wrapp').addClass('dgwt-wcas-flatsome-up')
214
+ }
215
+ });
 
216
 
217
+ var refreshDropdownPosition;
218
+ var style = '';
219
+ var positioning = false;
220
+ $(document).on('mouseenter', '.header-search-dropdown a', function (e) {
221
 
222
+ if (positioning) {
223
+ return;
224
+ }
225
+
226
+ setTimeout(function () {
227
+ var pos = $(e.target).closest('.header-search').find('.nav-dropdown').attr('style');
228
 
229
+ if (typeof pos == 'string' && pos.length > 0) {
230
+ style = pos;
231
+ }
232
 
233
+ refreshDropdownPosition = setInterval(function () {
234
 
235
+ if ($('body').hasClass('dgwt-wcas-open') && style.length > 0) {
236
+ $('.nav-dropdown').attr('style', style);
237
+ }
 
 
 
238
 
 
239
 
240
+ if (!$('body').hasClass('dgwt-wcas-open') && !$('.header-search').hasClass('current-dropdown')) {
241
+ clearInterval(refreshDropdownPosition);
242
+ $('.nav-dropdown').removeAttr('style');
243
+ style = '';
244
+ positioning = false;
245
+ }
246
 
247
+ }, 10)
 
248
 
249
+ }, 400);
250
 
251
+ positioning = true;
252
+ });
 
 
 
253
 
254
+ $(document).on('click', '.header-search-lightbox .header-button a', function () {
 
 
255
 
256
+ var formWrapper = $('#search-lightbox').find('.dgwt-wcas-search-wrapp');
257
+ setTimeout(function () {
258
+ if (formWrapper.find('.dgwt-wcas-close')[0]) {
259
+ formWrapper.find('.dgwt-wcas-close')[0].click();
260
+ }
261
 
262
+ formWrapper.removeClass('dgwt-wcas-flatsome-up');
263
+ formWrapper.find('.dgwt-wcas-search-input').focus();
264
+ }, 1);
265
 
266
+ });
267
+ });
 
268
 
269
+ })(jQuery);
270
 
271
+ </script>
272
+ <?php
273
+ }, 1000 );
274
+
275
+ }
276
+
277
+ }
includes/Integrations/Themes/Impreza/Impreza.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\Impreza;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Impreza {
13
+
14
+ private $themeSlug = 'impreza';
15
+
16
+ private $themeName = 'Impreza';
17
+
18
+ public function __construct() {
19
+ $this->replaceForm();
20
+
21
+ add_filter( 'dgwt/wcas/settings', array( $this, 'registerSettings' ) );
22
+ }
23
+
24
+ /**
25
+ * Add settings
26
+ *
27
+ * @param array $settings
28
+ *
29
+ * @return array
30
+ */
31
+ public function registerSettings( $settings ) {
32
+ $key = 'dgwt_wcas_basic';
33
+
34
+ $articleLink = 'https://ajaxsearch.pro/docs/integrations/impreza-theme/';
35
+ $articleText = sprintf(__( 'Here is <a href="%s" target="_blank">article</a> about how to do it using Impreza child-theme.', 'ajax-search-for-woocommerce' ), $articleLink);
36
+
37
+ $settings[ $key ][10] = array(
38
+ 'name' => $this->themeSlug . '_main_head',
39
+ 'label' => __( 'Replace Impreza search bar', 'ajax-search-for-woocommerce' ),
40
+ 'type' => 'head',
41
+ 'class' => 'dgwt-wcas-sgs-header'
42
+ );
43
+
44
+ $settings[ $key ][52] = array(
45
+ 'name' => $this->themeSlug . '_settings_head',
46
+ 'label' => __( 'Impreza Theme', 'ajax-search-for-woocommerce' ),
47
+ 'type' => 'desc',
48
+ 'desc' => Helpers::embeddingInThemeHtml() . '<br />' . $articleText,
49
+ 'class' => 'dgwt-wcas-sgs-themes-label',
50
+ );
51
+
52
+ $img = DGWT_WCAS()->themeCompatibility->getThemeImageSrc();
53
+ if ( ! empty( $img ) ) {
54
+ $settings[ $key ][52]['label'] = '<img src="' . $img . '">';
55
+ }
56
+
57
+
58
+ $settings[ $key ][90] = array(
59
+ 'name' => $this->themeSlug . '_othersways__head',
60
+ 'label' => __( 'Alternative ways to embed a search bar', 'ajax-search-for-woocommerce' ),
61
+ 'type' => 'head',
62
+ 'class' => 'dgwt-wcas-sgs-header'
63
+ );
64
+
65
+ return $settings;
66
+ }
67
+
68
+
69
+ /**
70
+ * Mark the native search form to replace
71
+ *
72
+ * @return void
73
+ */
74
+ private function replaceForm() {
75
+
76
+ $this->applyCSS();
77
+ $this->applyJS();
78
+
79
+ add_filter( 'body_class', function ( $classes ) {
80
+ $classes[] = 'dgwt-wcas-theme-' . $this->themeSlug;
81
+
82
+ return $classes;
83
+ } );
84
+
85
+ // Force enable overlay for mobile search
86
+ add_filter( 'dgwt/wcas/settings/load_value/key=enable_mobile_overlay', function () {
87
+ return 'on';
88
+ } );
89
+
90
+ // Change mobile breakpoint from 992 to 850
91
+ add_filter( 'dgwt/wcas/scripts/mobile_breakpoint', function () {
92
+ return 899;
93
+ } );
94
+
95
+ }
96
+
97
+
98
+ /**
99
+ * Apply custom CSS
100
+ *
101
+ * @return void
102
+ */
103
+ private function applyCSS() {
104
+
105
+ add_action( 'wp_head', function () {
106
+ ?>
107
+ <style>
108
+ .w-search.layout_modern .w-search-close {
109
+
110
+ }
111
+ .w-search.layout_modern .w-search-close {
112
+ color: rgba(0,0,0,0.5)!important;
113
+ }
114
+ .w-search.layout_modern .dgwt-wcas-close {
115
+ display: none;
116
+ }
117
+ .w-search.layout_modern .dgwt-wcas-preloader {
118
+ right: 20px;
119
+ }
120
+ .w-search.layout_fullscreen .w-form-row-field {
121
+ top:48px;
122
+ }
123
+ </style>
124
+ <?php
125
+ } );
126
+
127
+ }
128
+
129
+ /**
130
+ * Apply custom JS
131
+ *
132
+ * @return void
133
+ */
134
+ private function applyJS() {
135
+
136
+ add_action( 'wp_footer', function () {
137
+
138
+ ?>
139
+ <script>
140
+ (function ($) {
141
+
142
+ function dgwtWcasImprezaGetActiveInstance() {
143
+ var $el = $('.dgwt-wcas-search-wrapp.dgwt-wcas-active'),
144
+ instance;
145
+ if ($el.length > 0) {
146
+ $el.each(function () {
147
+ var $input = $(this).find('.dgwt-wcas-search-input');
148
+ if (typeof $input.data('autocomplete') == 'object') {
149
+ instance = $input.data('autocomplete');
150
+ return false;
151
+ }
152
+ });
153
+ }
154
+
155
+ return instance;
156
+ }
157
+
158
+ $(document).ready(function () {
159
+
160
+ $('.w-search.layout_modern .w-search-close').on('click', function(){
161
+
162
+ var instance = dgwtWcasImprezaGetActiveInstance();
163
+
164
+ if(typeof instance == 'object'){
165
+ instance.suggestions = [];
166
+ instance.hide();
167
+ instance.el.val('');
168
+ }
169
+
170
+ });
171
+
172
+ $('.w-search-open').on('click', function(e){
173
+
174
+ if($(window).width() < 900){
175
+ e.preventDefault();
176
+
177
+ var $mobileHandler = $(e.target).closest('.w-search').find('.js-dgwt-wcas-enable-mobile-form');
178
+
179
+ if($mobileHandler.length){
180
+ $mobileHandler[0].click();
181
+ }
182
+
183
+ setTimeout(function(){
184
+ $('.w-search').removeClass('active');
185
+ },500);
186
+ }
187
+
188
+ });
189
+
190
+ });
191
+
192
+
193
+
194
+
195
+ })(jQuery);
196
+
197
+ </script>
198
+ <?php
199
+ }, 1000 );
200
+
201
+ }
202
+
203
+ }
includes/Integrations/Themes/Storefront/Storefront.php CHANGED
@@ -2,101 +2,100 @@
2
 
3
  namespace DgoraWcas\Integrations\Themes\Storefront;
4
 
5
-
6
  use DgoraWcas\Helpers;
7
 
8
- class Storefront
9
- {
10
-
11
- private $themeSlug = 'storefront';
12
-
13
- private $themeName = 'Storefront';
14
-
15
- public function __construct()
16
- {
17
- $this->overwriteFunctions();
18
-
19
- add_filter('dgwt/wcas/settings', array($this, 'registerSettings'));
20
- }
21
-
22
-
23
- /**
24
- * Add settings
25
- *
26
- * @param array $settings
27
- *
28
- * @return array
29
- */
30
- public function registerSettings($settings)
31
- {
32
- $key = 'dgwt_wcas_basic';
33
-
34
- $settings[$key][10] = array(
35
- 'name' => $this->themeSlug . '_main_head',
36
- 'label' => __('Replace Storefront search bar', 'ajax-search-for-woocommerce'),
37
- 'type' => 'head',
38
- 'class' => 'dgwt-wcas-sgs-header'
39
- );
40
-
41
- $settings[$key][52] = array(
42
- 'name' => $this->themeSlug . '_settings_head',
43
- 'label' => __('Storefront Theme', 'ajax-search-for-woocommerce'),
44
- 'type' => 'desc',
45
- 'desc' => Helpers::embeddingInThemeHtml(),
46
- 'class' => 'dgwt-wcas-sgs-themes-label',
47
- );
48
-
49
- $img = DGWT_WCAS()->themeCompatibility->getThemeImageSrc();
50
- if ( ! empty($img)) {
51
- $settings[$key][52]['label'] = '<img src="' . $img . '">';
52
- }
53
-
54
- $settings[$key][55] = array(
55
- 'name' => 'storefront_replace_search',
56
- 'label' => __('Replace', 'ajax-search-for-woocommerce'),
57
- 'desc' => __('Replaces the Storefront default product search to the Ajax Search for WooCommerce form.', 'ajax-search-for-woocommerce'),
58
- 'type' => 'checkbox',
59
- 'default' => 'off',
60
- );
61
-
62
- $settings[$key][90] = array(
63
- 'name' => $this->themeSlug . '_othersways__head',
64
- 'label' => __('Alternative ways to embed a search bar', 'ajax-search-for-woocommerce'),
65
- 'type' => 'head',
66
- 'class' => 'dgwt-wcas-sgs-header'
67
- );
68
-
69
- return $settings;
70
- }
71
-
72
- /**
73
- * Check if can replace the native Storefront search form
74
- * by the Ajax Search for WooCommerce form.
75
- *
76
- * @return bool
77
- */
78
- private function canReplaceSearch()
79
- {
80
- $canIntegrate = false;
81
-
82
- if (DGWT_WCAS()->settings->getOption('storefront_replace_search', 'off') === 'on') {
83
- $canIntegrate = true;
84
- }
85
-
86
- return $canIntegrate;
87
- }
88
-
89
- /**
90
- * Overwrite funtions
91
- *
92
- * @return void
93
- */
94
- private function overwriteFunctions()
95
- {
96
- if ($this->canReplaceSearch()) {
97
- require_once DGWT_WCAS_DIR . 'partials/themes/storefront.php';
98
- }
99
- }
100
-
101
-
102
- }
2
 
3
  namespace DgoraWcas\Integrations\Themes\Storefront;
4
 
 
5
  use DgoraWcas\Helpers;
6
 
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Storefront {
13
+
14
+ private $themeSlug = 'storefront';
15
+
16
+ private $themeName = 'Storefront';
17
+
18
+ public function __construct() {
19
+ $this->overwriteFunctions();
20
+
21
+ add_filter( 'dgwt/wcas/settings', array( $this, 'registerSettings' ) );
22
+ }
23
+
24
+
25
+ /**
26
+ * Add settings
27
+ *
28
+ * @param array $settings
29
+ *
30
+ * @return array
31
+ */
32
+ public function registerSettings( $settings ) {
33
+ $key = 'dgwt_wcas_basic';
34
+
35
+ $settings[ $key ][10] = array(
36
+ 'name' => $this->themeSlug . '_main_head',
37
+ 'label' => __( 'Replace Storefront search bar', 'ajax-search-for-woocommerce' ),
38
+ 'type' => 'head',
39
+ 'class' => 'dgwt-wcas-sgs-header'
40
+ );
41
+
42
+ $settings[ $key ][52] = array(
43
+ 'name' => $this->themeSlug . '_settings_head',
44
+ 'label' => __( 'Storefront Theme', 'ajax-search-for-woocommerce' ),
45
+ 'type' => 'desc',
46
+ 'desc' => Helpers::embeddingInThemeHtml(),
47
+ 'class' => 'dgwt-wcas-sgs-themes-label',
48
+ );
49
+
50
+ $img = DGWT_WCAS()->themeCompatibility->getThemeImageSrc();
51
+ if ( ! empty( $img ) ) {
52
+ $settings[ $key ][52]['label'] = '<img src="' . $img . '">';
53
+ }
54
+
55
+ $settings[ $key ][55] = array(
56
+ 'name' => 'storefront_replace_search',
57
+ 'label' => __( 'Replace', 'ajax-search-for-woocommerce' ),
58
+ 'desc' => __( 'Replace the Storefront default product search to the Ajax Search for WooCommerce form.', 'ajax-search-for-woocommerce' ),
59
+ 'type' => 'checkbox',
60
+ 'default' => 'off',
61
+ );
62
+
63
+ $settings[ $key ][90] = array(
64
+ 'name' => $this->themeSlug . '_othersways__head',
65
+ 'label' => __( 'Alternative ways to embed a search bar', 'ajax-search-for-woocommerce' ),
66
+ 'type' => 'head',
67
+ 'class' => 'dgwt-wcas-sgs-header'
68
+ );
69
+
70
+ return $settings;
71
+ }
72
+
73
+ /**
74
+ * Check if can replace the native Storefront search form
75
+ * by the Ajax Search for WooCommerce form.
76
+ *
77
+ * @return bool
78
+ */
79
+ private function canReplaceSearch() {
80
+ $canIntegrate = false;
81
+
82
+ if ( DGWT_WCAS()->settings->getOption( 'storefront_replace_search', 'off' ) === 'on' ) {
83
+ $canIntegrate = true;
84
+ }
85
+
86
+ return $canIntegrate;
87
+ }
88
+
89
+ /**
90
+ * Overwrite funtions
91
+ *
92
+ * @return void
93
+ */
94
+ private function overwriteFunctions() {
95
+ if ( $this->canReplaceSearch() ) {
96
+ require_once DGWT_WCAS_DIR . 'partials/themes/storefront.php';
97
+ }
98
+ }
99
+
100
+
101
+ }
includes/Integrations/Themes/TheGem/TheGem.php ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\TheGem;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class TheGem {
13
+
14
+ private $themeSlug = 'thegem';
15
+
16
+ private $themeName = 'TheGem';
17
+
18
+ public function __construct() {
19
+ add_filter( 'dgwt/wcas/settings', array( $this, 'registerSettings' ) );
20
+
21
+ if ( $this->canReplaceSearch() ) {
22
+ add_action( 'init', function () {
23
+
24
+ // Header Vertical
25
+ remove_filter( 'wp_nav_menu_items', 'thegem_menu_item_search', 10, 2 );
26
+ add_filter( 'wp_nav_menu_items', array( $this, 'replaceSearchInMenu' ), 10, 2 );
27
+
28
+ // Header Fullwidth hamburger
29
+ remove_filter( 'wp_nav_menu_items', 'thegem_menu_item_hamburger_widget', 100, 2 );
30
+ add_action( 'thegem_before_nav_menu', function () {
31
+ if ( in_array( thegem_get_option( 'header_layout' ), array( 'perspective', 'fullwidth_hamburger' ) ) ) {
32
+ echo do_shortcode( '[wcas-search-form]' );
33
+ }
34
+ } );
35
+
36
+ // Perspective header
37
+ remove_filter( 'get_search_form', 'thegem_serch_form_vertical_header' );
38
+ add_action( 'thegem_perspective_menu_buttons', function () {
39
+ echo do_shortcode( '[wcas-search-form]' );
40
+ } );
41
+
42
+ } );
43
+
44
+ add_filter( 'get_search_form', array( $this, 'removeSearchBarFromVerticalHeader' ), 100 );
45
+ add_action( 'thegem_before_header', array( $this, 'addSearchBarToVerticalHeader' ), 20 );
46
+
47
+ // Force enable overlay for mobile search
48
+ add_filter( 'dgwt/wcas/settings/load_value/key=enable_mobile_overlay', function () {
49
+ return 'on';
50
+ } );
51
+
52
+ add_action( 'wp_head', array( $this, 'customCSS' ) );
53
+ add_action( 'wp_footer', array( $this, 'customJS' ) );
54
+ }
55
+
56
+
57
+ }
58
+
59
+
60
+ /**
61
+ * Add settings
62
+ *
63
+ * @param array $settings
64
+ *
65
+ * @return array
66
+ */
67
+ public function registerSettings( $settings ) {
68
+ $key = 'dgwt_wcas_basic';
69
+
70
+ $settings[ $key ][10] = array(
71
+ 'name' => $this->themeSlug . '_main_head',
72
+ 'label' => __( 'Replace a search bar in TheGem ', 'ajax-search-for-woocommerce' ),
73
+ 'type' => 'head',
74
+ 'class' => 'dgwt-wcas-sgs-header'
75
+ );
76
+
77
+ $settings[ $key ][52] = array(
78
+ 'name' => $this->themeSlug . '_settings_head',
79
+ 'label' => __( 'TheGem Theme', 'ajax-search-for-woocommerce' ),
80
+ 'type' => 'desc',
81
+ 'desc' => Helpers::embeddingInThemeHtml(),
82
+ 'class' => 'dgwt-wcas-sgs-themes-label',
83
+ );
84
+
85
+ $img = DGWT_WCAS()->themeCompatibility->getThemeImageSrc();
86
+ if ( ! empty( $img ) ) {
87
+ $settings[ $key ][52]['label'] = '<img src="' . $img . '">';
88
+ }
89
+
90
+ $settings[ $key ][55] = array(
91
+ 'name' => 'thegem_replace_search',
92
+ 'label' => __( 'Replace', 'ajax-search-for-woocommerce' ),
93
+ 'desc' => __( 'Replace the TheGem default search', 'ajax-search-for-woocommerce' ),
94
+ 'type' => 'checkbox',
95
+ 'default' => 'off',
96
+ );
97
+
98
+ $settings[ $key ][90] = array(
99
+ 'name' => $this->themeSlug . '_othersways__head',
100
+ 'label' => __( 'Alternative ways to embed a search bar', 'ajax-search-for-woocommerce' ),
101
+ 'type' => 'head',
102
+ 'class' => 'dgwt-wcas-sgs-header'
103
+ );
104
+
105
+
106
+ $settings[ $key ][90] = array(
107
+ 'name' => $this->themeSlug . '_othersways__head',
108
+ 'label' => __( 'Alternative ways to embed a search bar', 'ajax-search-for-woocommerce' ),
109
+ 'type' => 'head',
110
+ 'class' => 'dgwt-wcas-sgs-header'
111
+ );
112
+
113
+ // Remove overlay search from settings because enable mobile overlay will be forced
114
+ if ( $this->canReplaceSearch() ) {
115
+ unset( $settings['dgwt_wcas_form_body'][1300] );
116
+ unset( $settings['dgwt_wcas_form_body'][1400] );
117
+ }
118
+
119
+ return $settings;
120
+ }
121
+
122
+ /**
123
+ * Check if can replace the native TheGem search form
124
+ * by the Ajax Search for WooCommerce form.
125
+ *
126
+ * @return bool
127
+ */
128
+ private function canReplaceSearch() {
129
+ $canIntegrate = false;
130
+
131
+ if ( DGWT_WCAS()->settings->getOption( 'thegem_replace_search', 'off' ) === 'on' ) {
132
+ $canIntegrate = true;
133
+ }
134
+
135
+ return $canIntegrate;
136
+ }
137
+
138
+ /**
139
+ * Replace the search in main menu
140
+ *
141
+ * @param $items
142
+ * @param $args
143
+ *
144
+ * @return string
145
+ */
146
+ public function replaceSearchInMenu( $items, $args ) {
147
+
148
+ if ( $args->theme_location == 'primary' && ! thegem_get_option( 'hide_search_icon' ) ) {
149
+ $items .= '<li class="menu-item menu-item-search dgwt-wcas-thegem-menu-search">';
150
+ $items .= '<a href="#"></a>';
151
+ $items .= '<div class="minisearch">';
152
+ $items .= do_shortcode( '[wcas-search-form]' );
153
+ $items .= '</div>';
154
+ $items .= '</li>';
155
+
156
+ }
157
+
158
+ return $items;
159
+ }
160
+
161
+ /**
162
+ * Remove the search bar from vertical header
163
+ *
164
+ * @param string $form
165
+ *
166
+ * @return string
167
+ */
168
+ public function removeSearchBarFromVerticalHeader( $form ) {
169
+
170
+ if ( in_array( thegem_get_option( 'header_layout' ), array( 'fullwidth_hamburger', 'vertical' ) ) ) {
171
+ $form = '';
172
+ }
173
+
174
+
175
+ return $form;
176
+ }
177
+
178
+ /**
179
+ * Remove the search bar from vertical header
180
+ *
181
+ * @return void
182
+ */
183
+ public function addSearchBarToVerticalHeader() {
184
+
185
+ if ( ! in_array( thegem_get_option( 'header_layout' ), array( 'vertical' ) ) ) {
186
+ return;
187
+ }
188
+
189
+ $html = '<div class="dgwt-wcas-thegem-vertical-search">';
190
+ $html .= do_shortcode( '[wcas-search-form]' );
191
+ $html .= '</div>';
192
+
193
+ echo $html;
194
+ }
195
+
196
+
197
+ /**
198
+ * Custom CSS
199
+ *
200
+ * @return void
201
+ */
202
+ public function customCSS() {
203
+ ?>
204
+ <style>
205
+ .dgwt-wcas-thegem-menu-search .minisearch {
206
+ width: 500px;
207
+ }
208
+
209
+ .header-layout-perspective > .dgwt-wcas-search-wrapp {
210
+ top: 30px;
211
+ position: absolute;
212
+ max-width: 600px;
213
+ left: 270px;
214
+ right: auto;
215
+ margin: 0 auto;
216
+ z-index: 10;
217
+ }
218
+
219
+ @media (max-width: 979px) {
220
+ .dgwt-wcas-thegem-menu-search .minisearch {
221
+ width: 100%;
222
+ }
223
+
224
+ .header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp,
225
+ .header-layout-perspective > .dgwt-wcas-search-wrapp {
226
+ max-width: 350px;
227
+ }
228
+
229
+ .header-style-vertical #site-header-wrapper .dgwt-wcas-thegem-vertical-search {
230
+ display: none;
231
+ }
232
+ }
233
+
234
+ @media (max-width: 769px) {
235
+ .header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp,
236
+ .header-layout-perspective > .dgwt-wcas-search-wrapp {
237
+ display: none;
238
+ }
239
+ }
240
+
241
+
242
+ #page.vertical-header .dgwt-wcas-thegem-vertical-search {
243
+ margin-right: auto;
244
+ margin-left: auto;
245
+ padding-left: 21px;
246
+ padding-right: 21px;
247
+ }
248
+
249
+ .header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp {
250
+ top: 30px;
251
+ position: absolute;
252
+ left: 50px;
253
+ max-width: 600px;
254
+ }
255
+
256
+ .site-header.fixed .header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp,
257
+ .site-header.fixed .header-layout-perspective > .dgwt-wcas-search-wrapp {
258
+ top: 8px;
259
+ }
260
+
261
+ body .header-layout-overlay #primary-menu.no-responsive.overlay-search-form-show.animated-minisearch > li.menu-item-search > .minisearch {
262
+ top: 0;
263
+ bottom: auto;
264
+ }
265
+ </style>
266
+ <?php
267
+ }
268
+
269
+ /**
270
+ * Custom JS
271
+ *
272
+ * @return void
273
+ */
274
+ public function customJS() {
275
+ ?>
276
+ <script>
277
+ (function ($) {
278
+
279
+ $('.header-layout-overlay .dgwt-wcas-thegem-menu-search').on('click', function () {
280
+ var $searchHandler = $(this).find('.js-dgwt-wcas-enable-mobile-form');
281
+
282
+ if ($searchHandler.length) {
283
+ $searchHandler[0].click();
284
+ }
285
+
286
+
287
+ });
288
+
289
+ $('.dgwt-wcas-thegem-menu-search').on('click', function () {
290
+ var $input = $(this).find('.dgwt-wcas-search-input');
291
+
292
+ if ($input.length) {
293
+ setTimeout(function () {
294
+ $input.focus();
295
+ }, 300);
296
+ }
297
+ });
298
+
299
+ })(jQuery);
300
+ </script>
301
+ <?php
302
+ }
303
+
304
+ }
includes/Integrations/Themes/ThemesCompatibility.php CHANGED
@@ -2,134 +2,147 @@
2
 
3
  namespace DgoraWcas\Integrations\Themes;
4
 
5
- class ThemesCompatibility
6
- {
7
- private $themeName = '';
8
- private $theme = null;
9
- private $supportActive = false;
10
-
11
- public function __construct()
12
- {
13
- $this->setCurrentTheme();
14
-
15
- $this->loadCompatibilities();
16
- }
17
-
18
- private function setCurrentTheme()
19
- {
20
- $name = '';
21
-
22
- $theme = wp_get_theme();
23
-
24
- if (is_object($theme) && is_a($theme, 'WP_Theme')) {
25
- $template = $theme->get_template();
26
- $stylesheet = $theme->get_stylesheet();
27
- $isChildTheme = $template !== $stylesheet;
28
- $name = sanitize_title($theme->Name);
29
-
30
- if ($isChildTheme) {
31
- $name = $template;
32
- }
33
-
34
- $this->theme = $theme;
35
- }
36
-
37
- $this->themeName = $name;
38
-
39
- }
40
-
41
- /**
42
- * All supported themes
43
- *
44
- * @return array
45
- */
46
- public function supportedThemes()
47
- {
48
- return array(
49
- 'storefront' => array(
50
- 'slug' => 'storefront',
51
- 'name' => 'Storefront',
52
- ),
53
- 'flatsome' => array(
54
- 'slug' => 'flatsome',
55
- 'name' => 'Flatsome',
56
- ),
57
- 'astra' => array(
58
- 'slug' => 'astra',
59
- 'name' => 'Astra',
60
- )
61
- );
62
- }
63
-
64
- /**
65
- * Load class with compatibilities logic for current theme
66
- *
67
- * @return void
68
- */
69
- private function loadCompatibilities()
70
- {
71
-
72
- foreach ($this->supportedThemes() as $theme) {
73
- if ($theme['slug'] === $this->themeName) {
74
-
75
- $this->supportActive = true;
76
-
77
- $class = '\\DgoraWcas\\Integrations\\Themes\\';
78
-
79
- if (isset($theme['className'])) {
80
- $class .= $theme['className'] . '\\' . $theme['className'];
81
- } else {
82
- $class .= $theme['name'] . '\\' . $theme['name'];
83
- }
84
-
85
- new $class;
86
-
87
- break;
88
- }
89
- }
90
- }
91
-
92
- /**
93
- * Check if current theme is supported
94
- *
95
- * @return bool
96
- */
97
- public function isCurrentThemeSupported()
98
- {
99
- return $this->supportActive;
100
- }
101
-
102
- /**
103
- * Get current theme onfo
104
- *
105
- * @return object
106
- */
107
- public function getTheme()
108
- {
109
- return $this->theme;
110
- }
111
-
112
- /**
113
- * Get current theme onfo
114
- *
115
- * @return object
116
- */
117
- public function getThemeImageSrc()
118
- {
119
- $src = '';
120
-
121
- if ( ! empty($this->theme)) {
122
-
123
- foreach (array('png', 'jpg') as $ext) {
124
- if (empty($src) && file_exists($this->theme->get_template_directory() . '/screenshot.' . $ext)) {
125
- $src = $this->theme->get_template_directory_uri() . '/screenshot.' . $ext;
126
- break;
127
- }
128
- }
129
-
130
- }
131
-
132
- return ! empty($src) ? esc_url($src) : '';
133
- }
134
-
135
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  namespace DgoraWcas\Integrations\Themes;
4
 
5
+ // Exit if accessed directly
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ class ThemesCompatibility {
11
+ private $themeName = '';
12
+ private $theme = null;
13
+ private $supportActive = false;
14
+
15
+ public function __construct() {
16
+ $this->setCurrentTheme();
17
+
18
+ $this->loadCompatibilities();
19
+ }
20
+
21
+ private function setCurrentTheme() {
22
+ $name = '';
23
+
24
+ $theme = wp_get_theme();
25
+
26
+ if ( is_object( $theme ) && is_a( $theme, 'WP_Theme' ) ) {
27
+ $template = $theme->get_template();
28
+ $stylesheet = $theme->get_stylesheet();
29
+ $isChildTheme = $template !== $stylesheet;
30
+ $name = sanitize_title( $theme->Name );
31
+
32
+ if ( $isChildTheme ) {
33
+ $name = strtolower( $template );
34
+ }
35
+
36
+ $this->theme = $theme;
37
+ }
38
+
39
+ $this->themeName = $name;
40
+
41
+ }
42
+
43
+ /**
44
+ * All supported themes
45
+ *
46
+ * @return array
47
+ */
48
+ public function supportedThemes() {
49
+ return array(
50
+ 'storefront' => array(
51
+ 'slug' => 'storefront',
52
+ 'name' => 'Storefront',
53
+ ),
54
+ 'flatsome' => array(
55
+ 'slug' => 'flatsome',
56
+ 'name' => 'Flatsome',
57
+ ),
58
+ 'astra' => array(
59
+ 'slug' => 'astra',
60
+ 'name' => 'Astra',
61
+ ),
62
+ 'thegem' => array(
63
+ 'slug' => 'thegem',
64
+ 'name' => 'TheGem',
65
+ ),
66
+ 'impreza' => array(
67
+ 'slug' => 'impreza',
68
+ 'name' => 'Impreza',
69
+ ),
70
+ 'woodmart' => array(
71
+ 'slug' => 'woodmart',
72
+ 'name' => 'Woodmart',
73
+ ),
74
+ 'enfold' => array(
75
+ 'slug' => 'enfold',
76
+ 'name' => 'Enfold',
77
+ )
78
+ );
79
+ }
80
+
81
+ /**
82
+ * Load class with compatibilities logic for current theme
83
+ *
84
+ * @return void
85
+ */
86
+ private function loadCompatibilities() {
87
+
88
+ foreach ( $this->supportedThemes() as $theme ) {
89
+ if ( $theme['slug'] === $this->themeName ) {
90
+
91
+ $this->supportActive = true;
92
+
93
+ $class = '\\DgoraWcas\\Integrations\\Themes\\';
94
+
95
+ if ( isset( $theme['className'] ) ) {
96
+ $class .= $theme['className'] . '\\' . $theme['className'];
97
+ } else {
98
+ $class .= $theme['name'] . '\\' . $theme['name'];
99
+ }
100
+
101
+ new $class;
102
+
103
+ break;
104
+ }
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Check if current theme is supported
110
+ *
111
+ * @return bool
112
+ */
113
+ public function isCurrentThemeSupported() {
114
+ return $this->supportActive;
115
+ }
116
+
117
+ /**
118
+ * Get current theme onfo
119
+ *
120
+ * @return object
121
+ */
122
+ public function getTheme() {
123
+ return $this->theme;
124
+ }
125
+
126
+ /**
127
+ * Get current theme onfo
128
+ *
129
+ * @return object
130
+ */
131
+ public function getThemeImageSrc() {
132
+ $src = '';
133
+
134
+ if ( ! empty( $this->theme ) ) {
135
+
136
+ foreach ( array( 'png', 'jpg' ) as $ext ) {
137
+ if ( empty( $src ) && file_exists( $this->theme->get_template_directory() . '/screenshot.' . $ext ) ) {
138
+ $src = $this->theme->get_template_directory_uri() . '/screenshot.' . $ext;
139
+ break;
140
+ }
141
+ }
142
+
143
+ }
144
+
145
+ return ! empty( $src ) ? esc_url( $src ) : '';
146
+ }
147
+
148
+ }
includes/Integrations/Themes/Woodmart/Woodmart.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\Woodmart;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Woodmart {
13
+
14
+ private $themeSlug = 'woodmart';
15
+
16
+ private $themeName = 'Woodmart';
17
+
18
+ public function __construct() {
19
+ $this->overwriteFunctions();
20
+
21
+ add_filter( 'dgwt/wcas/settings', array( $this, 'registerSettings' ) );
22
+ add_filter( 'woodmart_shop_page_link', array( $this, 'shop_page_link' ), 10, 3 );
23
+ }
24
+
25
+ /**
26
+ * Add to the address of the shop a parameter informing that the search is done by our plugin
27
+ *
28
+ * @param string $link
29
+ * @param boolean $keep_query
30
+ * @param string $taxonomy
31
+ *
32
+ * @return string
33
+ */
34
+ public function shop_page_link( $link, $keep_query, $taxonomy ) {
35
+ if ( $keep_query && isset( $_GET['dgwt_wcas'] ) ) {
36
+ $link = add_query_arg( 'dgwt_wcas', wc_clean( $_GET['dgwt_wcas'] ), $link );
37
+ }
38
+
39
+ return $link;
40
+ }
41
+
42
+ /**
43
+ * Add settings
44
+ *
45
+ * @param array $settings
46
+ *
47
+ * @return array
48
+ */
49
+ public function registerSettings( $settings ) {
50
+ $key = 'dgwt_wcas_basic';
51
+
52
+ $settings[ $key ][10] = array(
53
+ 'name' => $this->themeSlug . '_main_head',
54
+ 'label' => sprintf( __( 'Replace %s search bar', 'ajax-search-for-woocommerce' ), $this->themeName ),
55
+ 'type' => 'head',
56
+ 'class' => 'dgwt-wcas-sgs-header'
57
+ );
58
+
59
+ $settings[ $key ][52] = array(
60
+ 'name' => $this->themeSlug . '_settings_head',
61
+ 'label' => sprintf( __( '%s Theme', 'ajax-search-for-woocommerce' ), $this->themeName ),
62
+ 'type' => 'desc',
63
+ 'desc' => Helpers::embeddingInThemeHtml(),
64
+ 'class' => 'dgwt-wcas-sgs-themes-label',
65
+ );
66
+
67
+ $img = DGWT_WCAS()->themeCompatibility->getThemeImageSrc();
68
+ if ( ! empty( $img ) ) {
69
+ $settings[ $key ][52]['label'] = '<img src="' . $img . '">';
70
+ }
71
+
72
+ $settings[ $key ][55] = array(
73
+ 'name' => 'woodmart_replace_search',
74
+ 'label' => __( 'Replace', 'ajax-search-for-woocommerce' ),
75
+ 'desc' => sprintf( __( 'Replace all %s search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce' ), $this->themeName ),
76
+ 'type' => 'checkbox',
77
+ 'default' => 'off',
78
+ );
79
+
80
+ $settings[ $key ][90] = array(
81
+ 'name' => $this->themeSlug . '_othersways__head',
82
+ 'label' => __( 'Alternative ways to embed a search bar', 'ajax-search-for-woocommerce' ),
83
+ 'type' => 'head',
84
+ 'class' => 'dgwt-wcas-sgs-header'
85
+ );
86
+
87
+ return $settings;
88
+ }
89
+
90
+ /**
91
+ * Check if can replace the native Woodmart search form
92
+ * by the Ajax Search for WooCommerce form.
93
+ *
94
+ * @return bool
95
+ */
96
+ private function canReplaceSearch() {
97
+ $canIntegrate = false;
98
+
99
+ if ( DGWT_WCAS()->settings->getOption( 'woodmart_replace_search', 'off' ) === 'on' ) {
100
+ $canIntegrate = true;
101
+ }
102
+
103
+ return $canIntegrate;
104
+ }
105
+
106
+ /**
107
+ * Overwrite functions
108
+ *
109
+ * @return void
110
+ */
111
+ private function overwriteFunctions() {
112
+ if ( $this->canReplaceSearch() ) {
113
+ require_once DGWT_WCAS_DIR . 'partials/themes/woodmart.php';
114
+ }
115
+ }
116
+ }
includes/Multilingual.php CHANGED
@@ -4,360 +4,428 @@
4
  namespace DgoraWcas;
5
 
6
 
7
- class Multilingual
8
- {
9
-
10
- public static $currentCurrency = '';
11
-
12
- /**
13
- * Check if the website is multilingual
14
- *
15
- * @return bool
16
- */
17
- public static function isMultilingual()
18
- {
19
-
20
- $isMultilingual = false;
21
-
22
- if (
23
- count(self::getLanguages()) > 1
24
- && (self::isWPML())
25
- ) {
26
- $isMultilingual = true;
27
- }
28
-
29
- return $isMultilingual;
30
- }
31
-
32
- /**
33
- * Check if WPMl is active
34
- *
35
- * @return bool
36
- */
37
- public static function isWPML()
38
- {
39
- return class_exists('SitePress');
40
- }
41
-
42
- /**
43
- * Check if language code has 2 leters
44
- *
45
- * @param $lang
46
- *
47
- * @return bool
48
- */
49
- public static function isLangCode($lang)
50
- {
51
- return (bool)preg_match('/^[A-Za-z]{2}$/', $lang);
52
- }
53
-
54
- /**
55
- * Get default language
56
- *
57
- * @return string
58
- */
59
- public static function getDefaultLanguage()
60
- {
61
- $defaultLang = 'en';
62
-
63
- if (self::isWPML()) {
64
- $defaultLang = apply_filters('wpml_default_language', null);
65
- }
66
-
67
- if (empty($defaultLang)) {
68
- $locale = get_locale();
69
- $defaultLang = substr($locale, 0, 2);
70
- }
71
-
72
- return $defaultLang;
73
- }
74
-
75
- /**
76
- * Current language
77
- *
78
- * @return string
79
- */
80
- public static function getCurrentLanguage()
81
- {
82
- $currentLang = self::getDefaultLanguage();
83
-
84
- if (self::isWPML()) {
85
- $currentLang = apply_filters('wpml_current_language', null);
86
- }
87
-
88
- return $currentLang;
89
- }
90
-
91
- /**
92
- * Get Language of product
93
- *
94
- * @param int $postID
95
- *
96
- * @return string
97
- */
98
- public static function getPostLang($postID, $postType = 'product')
99
- {
100
- $lang = self::getDefaultLanguage();
101
-
102
- $postType = 'post_' . $postType;
103
-
104
- if (self::isWPML()) {
105
- global $wpdb;
106
- $tranlationsTable = $wpdb->prefix . 'icl_translations';
107
- $sql = $wpdb->prepare("SELECT language_code
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  FROM $tranlationsTable
109
- WHERE element_type=%s
110
- AND element_id=%d", sanitize_key($postType), $postID);
111
- $query = $wpdb->get_var($sql);
112
-
113
- if ( ! empty($query) && strlen($query) === 2) {
114
- $lang = $query;
115
- }
116
- }
117
-
118
- return $lang;
119
- }
120
-
121
- /**
122
- * Get term lang
123
- *
124
- * @param int $term ID
125
- * @param string $taxonomy
126
- *
127
- * @return string
128
- */
129
- public static function getTermLang($termID, $taxonomy)
130
- {
131
- $lang = self::getDefaultLanguage();
132
-
133
- if (self::isWPML()) {
134
- global $wpdb;
135
-
136
- $elementType = 'tax_' . sanitize_key($taxonomy);
137
- $tranlationsTable = $wpdb->prefix . 'icl_translations';
138
-
139
- $sql = $wpdb->prepare("SELECT language_code
 
 
 
140
  FROM $tranlationsTable
141
  WHERE element_type = %s
142
  AND element_id=%d",
143
- $elementType, $termID);
144
-
145
- $query = $wpdb->get_var($sql);
146
-
147
- if ( ! empty($query) && strlen($query) == 2) {
148
- $lang = $query;
149
- }
150
- }
151
-
152
- return $lang;
153
- }
154
-
155
- /**
156
- * Get permalink
157
- *
158
- * @param string $postID
159
- * @param string $url
160
- * @param string $lang
161
- *
162
- * @return string
163
- */
164
- public static function getPermalink($postID, $url = '', $lang = '')
165
- {
166
- $permalink = $url;
167
-
168
- if (self::isWPML() && self::getDefaultLanguage() !== $lang) {
169
- /**
170
- * 1 if the option is *Different languages in directories*
171
- * 2 if the option is *A different domain per language*
172
- * 3 if the option is *Language name added as a parameter*.
173
- */
174
- $urlType = apply_filters( 'wpml_setting', 0, 'language_negotiation_type' );
175
-
176
- if($urlType == 3) {
177
- $permalink = apply_filters('wpml_permalink', $url, $lang);
178
- }else{
179
- $permalink = apply_filters('wpml_permalink', $url, $lang, true);
180
- }
181
-
182
- }
183
-
184
- return $permalink;
185
- }
186
-
187
- /**
188
- * Active languages
189
- *
190
- * @return langs
191
- */
192
- public static function getLanguages()
193
- {
194
-
195
- $langs = array();
196
-
197
- if (self::isWPML()) {
198
- $wpmlLangs = apply_filters('wpml_active_languages', null, array('skip_missing' => 0));
199
-
200
- if (is_array($wpmlLangs)) {
201
- foreach ($wpmlLangs as $langCode => $details) {
202
- if (self::isLangCode($langCode)) {
203
- $langs[] = strtolower($langCode);
204
- }
205
- }
206
- }
207
- }
208
-
209
- $hiddenLangs = apply_filters( 'wpml_setting', array(), 'hidden_languages' );
210
- if(!empty($hiddenLangs) && is_array($hiddenLangs)){
211
- $langs = array_unique(array_merge($langs, $hiddenLangs));
212
- }
213
-
214
- if (empty($langs)) {
215
- $langs[] = self::getDefaultLanguage();
216
- }
217
-
218
- return $langs;
219
-
220
- }
221
-
222
- /**
223
- * Get all terms in one taxonomy for all languages
224
- *
225
- * @param string $taxonomy
226
- *
227
- * @return array of WP_Term objects
228
- */
229
- public static function getTermsInAllLangs($taxonomy)
230
- {
231
- $terms = array();
232
- $usedIds = array();
233
-
234
- if (self::isWPML()) {
235
- $currentLang = self::getCurrentLanguage();
236
-
237
- foreach (self::getLanguages() as $lang) {
238
- do_action('wpml_switch_language', $lang);
239
- $args = array(
240
- 'taxonomy' => $taxonomy,
241
- 'hide_empty' => true,
242
- 'suppress_filters' => false
243
- );
244
- $termsInLang = get_terms(apply_filters('dgwt/wcas/search/' . $taxonomy . '/args', $args));
245
-
246
- if ( ! empty($termsInLang) && is_array($termsInLang)) {
247
- foreach ($termsInLang as $termInLang) {
248
-
249
- if ( ! in_array($termInLang->term_id, $usedIds)) {
250
- $terms[] = $termInLang;
251
- $usedIds[] = $termInLang->term_id;
252
- }
253
- }
254
- }
255
-
256
- }
257
-
258
- do_action('wpml_switch_language', $currentLang);
259
- }
260
-
261
- return $terms;
262
- }
263
-
264
- /**
265
- * Get term in specific language
266
- *
267
- * @param int $termID
268
- * @param string $taxonomy
269
- * @param string $lang
270
- *
271
- * @return object WP_Term
272
- */
273
- public static function getTerm($termID, $taxonomy, $lang)
274
- {
275
- $term = null;
276
-
277
- if (self::isWPML()) {
278
- $currentLang = self::getCurrentLanguage();
279
- do_action('wpml_switch_language', $lang);
280
-
281
- $term = get_term($termID, $taxonomy);
282
-
283
- do_action('wpml_switch_language', $currentLang);
284
- }
285
-
286
- return $term;
287
- }
288
-
289
- /**
290
- * Check if multicurrency module is enabled
291
- *
292
- * @return bool
293
- */
294
- public static function isMultiCurrency()
295
- {
296
-
297
- $multiCurrency = false;
298
-
299
- if (self::isWPML() && function_exists('wcml_is_multi_currency_on') && wcml_is_multi_currency_on()) {
300
- $multiCurrency = true;
301
- }
302
-
303
-
304
- return $multiCurrency;
305
- }
306
-
307
- /**
308
- * Get currency code assigned to language
309
- *
310
- * @param string $lang
311
- *
312
- * @return string
313
- */
314
- public static function getCurrencyForLang($lang)
315
- {
316
- $currencyCode = '';
317
-
318
- if (self::isWPML()) {
319
- global $woocommerce_wpml;
320
- if ( ! empty($woocommerce_wpml) && is_object($woocommerce_wpml) && ! empty($lang)) {
321
-
322
- if ( ! empty($woocommerce_wpml->settings['default_currencies'][$lang])) {
323
- $currencyCode = $woocommerce_wpml->settings['default_currencies'][$lang];
324
- }
325
- }
326
-
327
- }
328
-
329
- return $currencyCode;
330
- }
331
-
332
- /**
333
- * Set currenct currency
334
- *
335
- * @return void
336
- */
337
- public static function setCurrentCurrency($currency){
338
- self::$currentCurrency = $currency;
339
- }
340
-
341
- /**
342
- * Get currenct currency
343
- *
344
- * @return string
345
- */
346
- public static function getCurrentCurrency()
347
- {
348
- return self::$currentCurrency;
349
- }
350
-
351
- /**
352
- * Switch language
353
- *
354
- * @param $lang
355
- */
356
- public static function switchLanguage($lang)
357
- {
358
- if (self::isWPML() && ! empty($lang)) {
359
- do_action('wpml_switch_language', $lang);
360
- }
361
- }
362
-
363
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  namespace DgoraWcas;
5
 
6
 
7
+ class Multilingual {
8
+
9
+ public static $currentCurrency = '';
10
+
11
+ /**
12
+ * Check if the website is multilingual
13
+ *
14
+ * @return bool
15
+ */
16
+ public static function isMultilingual() {
17
+
18
+ $isMultilingual = false;
19
+
20
+ if ( defined( 'DGWT_WCAS_DISABLE_MULTILINGUAL' ) && DGWT_WCAS_DISABLE_MULTILINGUAL ) {
21
+ return false;
22
+ }
23
+
24
+ if (
25
+ count( self::getLanguages() ) > 1
26
+ && ( self::isWPML() || self::isPolylang() )
27
+ ) {
28
+ $isMultilingual = true;
29
+ }
30
+
31
+ return $isMultilingual;
32
+ }
33
+
34
+ /**
35
+ * Check if WPMl is active
36
+ *
37
+ * @return bool
38
+ */
39
+ public static function isWPML() {
40
+ return class_exists( 'SitePress' );
41
+ }
42
+
43
+ /**
44
+ * Check if Polylang is active
45
+ *
46
+ * @return bool
47
+ */
48
+ public static function isPolylang() {
49
+ return class_exists( 'Polylang' ) && class_exists( 'Polylang_Woocommerce' );
50
+ }
51
+
52
+ /**
53
+ * Get Provider
54
+ *
55
+ * @return bool
56
+ */
57
+ public static function getProvider() {
58
+ $provider = 'not set';
59
+
60
+ if(self::isWPML()){
61
+ $provider = 'WPML';
62
+ }
63
+
64
+ if(self::isPolylang()){
65
+ $provider = 'Polylang';
66
+ }
67
+
68
+ return $provider;
69
+ }
70
+
71
+ /**
72
+ * Check if language code has 2 leters
73
+ *
74
+ * @param $lang
75
+ *
76
+ * @return bool
77
+ */
78
+ public static function isLangCode( $lang ) {
79
+ return (bool) preg_match( '/^[A-Za-z]{2}$/', $lang );
80
+ }
81
+
82
+ /**
83
+ * Get default language
84
+ *
85
+ * @return string
86
+ */
87
+ public static function getDefaultLanguage() {
88
+ $defaultLang = 'en';
89
+
90
+ if ( self::isWPML() ) {
91
+ $defaultLang = apply_filters( 'wpml_default_language', null );
92
+ }
93
+
94
+ if ( self::isPolylang() ) {
95
+ $defaultLang = pll_default_language( 'slug' );
96
+ }
97
+
98
+ if ( empty( $defaultLang ) ) {
99
+ $locale = get_locale();
100
+ $defaultLang = substr( $locale, 0, 2 );
101
+ }
102
+
103
+ return $defaultLang;
104
+ }
105
+
106
+ /**
107
+ * Current language
108
+ *
109
+ * @return string
110
+ */
111
+ public static function getCurrentLanguage() {
112
+ $currentLang = self::getDefaultLanguage();
113
+
114
+ if ( self::isWPML() ) {
115
+ $currentLang = apply_filters( 'wpml_current_language', null );
116
+ }
117
+
118
+ if ( self::isPolylang() ) {
119
+ $lang = pll_current_language( 'slug' );
120
+
121
+ if ( $lang ) {
122
+ $currentLang = $lang;
123
+ } else {
124
+ $currentLang = pll_default_language( 'slug' );
125
+ }
126
+ }
127
+
128
+ return $currentLang;
129
+ }
130
+
131
+ /**
132
+ * Get Language of post or product
133
+ *
134
+ * @param int $postID
135
+ *
136
+ * @return string
137
+ */
138
+ public static function getPostLang( $postID, $postType = 'product' ) {
139
+
140
+ $lang = self::getDefaultLanguage();
141
+
142
+ if ( self::isWPML() ) {
143
+ global $wpdb;
144
+
145
+ $postType = 'post_' . $postType;
146
+
147
+ $tranlationsTable = $wpdb->prefix . 'icl_translations';
148
+ $sql = $wpdb->prepare( "SELECT language_code
149
  FROM $tranlationsTable
150
+ WHERE element_type=%s
151
+ AND element_id=%d", sanitize_key( $postType ), $postID );
152
+ $query = $wpdb->get_var( $sql );
153
+
154
+ if ( ! empty( $query ) && strlen( $query ) === 2 ) {
155
+ $lang = $query;
156
+ }
157
+ }
158
+
159
+ if ( self::isPolylang() ) {
160
+ $lang = pll_get_post_language( $postID, 'slug' );
161
+ }
162
+
163
+ return $lang;
164
+ }
165
+
166
+ /**
167
+ * Get term lang
168
+ *
169
+ * @param int $term ID
170
+ * @param string $taxonomy
171
+ *
172
+ * @return string
173
+ */
174
+ public static function getTermLang( $termID, $taxonomy ) {
175
+ $lang = self::getDefaultLanguage();
176
+
177
+ if ( self::isWPML() ) {
178
+ global $wpdb;
179
+
180
+ $elementType = 'tax_' . sanitize_key( $taxonomy );
181
+ $tranlationsTable = $wpdb->prefix . 'icl_translations';
182
+
183
+ $sql = $wpdb->prepare( "SELECT language_code
184
  FROM $tranlationsTable
185
  WHERE element_type = %s
186
  AND element_id=%d",
187
+ $elementType, $termID );
188
+
189
+ $query = $wpdb->get_var( $sql );
190
+
191
+ if ( ! empty( $query ) && strlen( $query ) == 2 ) {
192
+ $lang = $query;
193
+ }
194
+ }
195
+
196
+ if ( self::isPolylang() ) {
197
+ $lang = pll_get_term_language($termID, 'slug');
198
+ }
199
+
200
+ return $lang;
201
+ }
202
+
203
+ /**
204
+ * Get permalink
205
+ *
206
+ * @param string $postID
207
+ * @param string $url
208
+ * @param string $lang
209
+ *
210
+ * @return string
211
+ */
212
+ public static function getPermalink( $postID, $url = '', $lang = '' ) {
213
+ $permalink = $url;
214
+
215
+ if ( self::isWPML() && self::getDefaultLanguage() !== $lang ) {
216
+ /**
217
+ * 1 if the option is *Different languages in directories*
218
+ * 2 if the option is *A different domain per language*
219
+ * 3 if the option is *Language name added as a parameter*.
220
+ */
221
+ $urlType = apply_filters( 'wpml_setting', 0, 'language_negotiation_type' );
222
+
223
+ if ( $urlType == 3 ) {
224
+ $permalink = apply_filters( 'wpml_permalink', $url, $lang );
225
+ } else {
226
+ $permalink = apply_filters( 'wpml_permalink', $url, $lang, true );
227
+ }
228
+
229
+ }
230
+
231
+ return $permalink;
232
+ }
233
+
234
+ /**
235
+ * Active languages
236
+ *
237
+ * @return langs
238
+ */
239
+ public static function getLanguages() {
240
+
241
+ $langs = array();
242
+
243
+ if ( self::isWPML() ) {
244
+ $wpmlLangs = apply_filters( 'wpml_active_languages', null, array( 'skip_missing' => 0 ) );
245
+
246
+ if ( is_array( $wpmlLangs ) ) {
247
+ foreach ( $wpmlLangs as $langCode => $details ) {
248
+ if ( self::isLangCode( $langCode ) ) {
249
+ $langs[] = strtolower( $langCode );
250
+ }
251
+ }
252
+ }
253
+
254
+ $hiddenLangs = apply_filters( 'wpml_setting', array(), 'hidden_languages' );
255
+ if ( ! empty( $hiddenLangs ) && is_array( $hiddenLangs ) ) {
256
+ $langs = array_unique( array_merge( $langs, $hiddenLangs ) );
257
+ }
258
+ }
259
+
260
+ if ( self::isPolylang() ) {
261
+ $langs = pll_languages_list( array(
262
+ 'hide_empty' => false,
263
+ 'fields' => 'slug'
264
+ ) );
265
+ }
266
+
267
+
268
+ if ( empty( $langs ) ) {
269
+ $langs[] = self::getDefaultLanguage();
270
+ }
271
+
272
+ return $langs;
273
+
274
+ }
275
+
276
+ /**
277
+ * Get all terms in one taxonomy for all languages
278
+ *
279
+ * @param string $taxonomy
280
+ *
281
+ * @return array of WP_Term objects
282
+ */
283
+ public static function getTermsInAllLangs( $taxonomy ) {
284
+ $terms = array();
285
+
286
+ if ( self::isWPML() ) {
287
+ $currentLang = self::getCurrentLanguage();
288
+ $usedIds = array();
289
+
290
+ foreach ( self::getLanguages() as $lang ) {
291
+ do_action( 'wpml_switch_language', $lang );
292
+ $args = array(
293
+ 'taxonomy' => $taxonomy,
294
+ 'hide_empty' => true,
295
+ 'suppress_filters' => false
296
+ );
297
+ $termsInLang = get_terms( apply_filters( 'dgwt/wcas/search/' . $taxonomy . '/args', $args ) );
298
+
299
+ if ( ! empty( $termsInLang ) && is_array( $termsInLang ) ) {
300
+ foreach ( $termsInLang as $termInLang ) {
301
+
302
+ if ( ! in_array( $termInLang->term_id, $usedIds ) ) {
303
+ $terms[] = $termInLang;
304
+ $usedIds[] = $termInLang->term_id;
305
+ }
306
+ }
307
+ }
308
+
309
+ }
310
+
311
+ do_action( 'wpml_switch_language', $currentLang );
312
+ }
313
+
314
+ if ( self::isPolylang() ) {
315
+
316
+ $terms = get_terms( array(
317
+ 'taxonomy' => $taxonomy,
318
+ 'hide_empty' => true,
319
+ 'lang' => '', // query terms in all languages
320
+ ) );
321
+
322
+ }
323
+
324
+ return $terms;
325
+ }
326
+
327
+ /**
328
+ * Get term in specific language
329
+ *
330
+ * @param int $termID
331
+ * @param string $taxonomy
332
+ * @param string $lang
333
+ *
334
+ * @return object WP_Term
335
+ */
336
+ public static function getTerm( $termID, $taxonomy, $lang ) {
337
+ $term = null;
338
+
339
+ if ( self::isWPML() ) {
340
+ $currentLang = self::getCurrentLanguage();
341
+ do_action( 'wpml_switch_language', $lang );
342
+
343
+ $term = get_term( $termID, $taxonomy );
344
+
345
+ do_action( 'wpml_switch_language', $currentLang );
346
+ }
347
+
348
+ if ( self::isPolylang() ) {
349
+
350
+ $termID = pll_get_term( $termID, $lang );
351
+
352
+ if ( $termID ) {
353
+ $term = get_term( $termID, $taxonomy );
354
+ }
355
+
356
+ }
357
+
358
+ return $term;
359
+ }
360
+
361
+ /**
362
+ * Check if multicurrency module is enabled
363
+ *
364
+ * @return bool
365
+ */
366
+ public static function isMultiCurrency() {
367
+
368
+ $multiCurrency = false;
369
+
370
+ if ( self::isWPML() && function_exists( 'wcml_is_multi_currency_on' ) && wcml_is_multi_currency_on() ) {
371
+ $multiCurrency = true;
372
+ }
373
+
374
+
375
+ return $multiCurrency;
376
+ }
377
+
378
+ /**
379
+ * Get currency code assigned to language
380
+ *
381
+ * @param string $lang
382
+ *
383
+ * @return string
384
+ */
385
+ public static function getCurrencyForLang( $lang ) {
386
+ $currencyCode = '';
387
+
388
+ if ( self::isWPML() ) {
389
+ global $woocommerce_wpml;
390
+ if ( ! empty( $woocommerce_wpml ) && is_object( $woocommerce_wpml ) && ! empty( $lang ) ) {
391
+
392
+ if ( ! empty( $woocommerce_wpml->settings['default_currencies'][ $lang ] ) ) {
393
+ $currencyCode = $woocommerce_wpml->settings['default_currencies'][ $lang ];
394
+ }
395
+ }
396
+
397
+ }
398
+
399
+ return $currencyCode;
400
+ }
401
+
402
+ /**
403
+ * Set currenct currency
404
+ *
405
+ * @return void
406
+ */
407
+ public static function setCurrentCurrency( $currency ) {
408
+ self::$currentCurrency = $currency;
409
+ }
410
+
411
+ /**
412
+ * Get currenct currency
413
+ *
414
+ * @return string
415
+ */
416
+ public static function getCurrentCurrency() {
417
+ return self::$currentCurrency;
418
+ }
419
+
420
+ /**
421
+ * Switch language
422
+ *
423
+ * @param $lang
424
+ */
425
+ public static function switchLanguage( $lang ) {
426
+ if ( self::isWPML() && ! empty( $lang ) ) {
427
+ do_action( 'wpml_switch_language', $lang );
428
+ }
429
+ }
430
+
431
+ }
includes/Order.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
-
3
- namespace DgoraWcas;
4
-
5
-
6
- class Order
7
- {
8
-
9
-
10
- }
 
 
 
 
 
 
 
 
 
 
includes/Personalization.php CHANGED
@@ -3,7 +3,7 @@
3
  namespace DgoraWcas;
4
 
5
 
6
- class Personalization {
7
 
8
  public function __construct() {
9
 
@@ -11,16 +11,16 @@ class Personalization {
11
 
12
  }
13
 
14
- /**
15
- * Add personalized CSS
16
- *
17
- * @return void
18
- */
19
  public function printStyle() {
20
 
21
 
22
  // Search form
23
- $show_submit = DGWT_WCAS()->settings->getOption( 'show_submit_button' );
24
  $bg_search_input = DGWT_WCAS()->settings->getOption( 'bg_input_color' );
25
  $text_input_color = DGWT_WCAS()->settings->getOption( 'text_input_color' );
26
  $border_input_color = DGWT_WCAS()->settings->getOption( 'border_input_color' );
@@ -36,164 +36,163 @@ class Personalization {
36
 
37
  $preloader_url = trim( DGWT_WCAS()->settings->getOption( 'preloader_url' ) );
38
 
39
- $max_form_width = absint(DGWT_WCAS()->settings->getOption( 'max_form_width' ));
40
 
41
  ob_start();
42
  ?>
43
- <style type="text/css">
44
-
45
- .dgwt-wcas-ico-magnifier {
46
- max-width: 20px;
47
- }
48
-
49
- .dgwt-wcas-search-wrapp{
50
- <?php if(!empty($max_form_width)): ?>
51
- max-width: <?php echo $max_form_width; ?>px;
52
- <?php endif; ?>
53
- }
54
-
55
- <?php if ( !empty( $bg_search_input ) || !empty( $text_input_color ) || !empty( $border_input_color ) ): ?>
56
- .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input,
57
- .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:hover,
58
- .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:focus {
59
- <?php echo!empty( $bg_search_input ) ? 'background-color:' . sanitize_text_field( $bg_search_input ) . ';' : ''; ?><?php echo!empty( $text_input_color ) ? 'color:' . sanitize_text_field( $text_input_color ) . ';' : ''; ?><?php echo!empty( $border_input_color ) ? 'border-color:' . sanitize_text_field( $border_input_color ) . ';' : ''; ?>
60
- }
61
-
62
- <?php if ( !empty( $text_input_color ) ): ?>
63
- .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input::placeholder {
64
- color: <?php echo sanitize_text_field( $text_input_color ); ?>;
65
- opacity: 0.3;
66
- }
67
-
68
- .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input::-webkit-input-placeholder {
69
- color: <?php echo sanitize_text_field( $text_input_color ); ?>;
70
- opacity: 0.3;
71
- }
72
-
73
- .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:-moz-placeholder {
74
- color: <?php echo sanitize_text_field( $text_input_color ); ?>;
75
- opacity: 0.3;
76
- }
77
-
78
- .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input::-moz-placeholder {
79
- color: <?php echo sanitize_text_field( $text_input_color ); ?>;
80
- opacity: 0.3;
81
- }
82
-
83
- .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:-ms-input-placeholder {
84
- color: <?php echo sanitize_text_field( $text_input_color ); ?>;
85
- }
86
-
87
- .dgwt-wcas-no-submit.dgwt-wcas-search-wrapp .dgwt-wcas-ico-loupe, /* BackwardCompatibility v1.1.7 */
88
- .dgwt-wcas-no-submit.dgwt-wcas-search-wrapp .dgwt-wcas-ico-magnifier {
89
- fill: <?php echo sanitize_text_field( $text_input_color ); ?>;
90
- }
91
-
92
- <?php endif; ?>
93
- <?php endif; ?>
94
-
95
- <?php
96
- // Submit button
97
  if ( $show_submit === 'on' && (!empty( $bg_submit_color ) || !empty( $text_submit_color )) ): ?>
98
- .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit::before {
99
- <?php echo !empty( $bg_submit_color ) ? 'border-color: transparent ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?>
100
- }
101
 
102
- .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:hover::before,
103
- .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:focus::before {
104
- <?php echo!empty( $bg_submit_color ) ? 'border-right-color: ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?>
105
- }
106
 
107
- .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit,
108
- .dgwt-wcas-om-bar .dgwt-wcas-om-return {
109
- <?php echo!empty( $bg_submit_color ) ? 'background-color: ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?><?php echo!empty( $text_submit_color ) ? 'color: ' . sanitize_text_field( $text_submit_color ) . ';' : ''; ?>
110
- }
111
 
112
- .dgwt-wcas-search-wrapp .dgwt-wcas-ico-magnifier,
113
- .dgwt-wcas-om-bar .dgwt-wcas-om-return svg path{
114
- <?php echo!empty( $text_submit_color ) ? 'fill: ' . sanitize_text_field( $text_submit_color ) . ';' : ''; ?>
115
- }
116
 
117
- <?php endif; ?>
118
 
119
- <?php
120
- // Submit button
121
  if ( $show_submit === 'on' && (!empty( $bg_submit_color ) || !empty( $text_submit_color )) ):
122
  ?>
123
- .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit::before {
124
- <?php echo!empty( $bg_submit_color ) ? 'border-color: transparent ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?>
125
- }
126
-
127
- .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:hover::before,
128
- .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:focus::before {
129
- <?php echo!empty( $bg_submit_color ) ? 'border-right-color: ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?>
130
- }
131
-
132
- .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit {
133
- <?php echo!empty( $bg_submit_color ) ? 'background-color: ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?><?php echo!empty( $text_submit_color ) ? 'color: ' . sanitize_text_field( $text_submit_color ) . ';' : ''; ?>
134
- }
135
-
136
- .dgwt-wcas-search-wrapp .dgwt-wcas-ico-magnifier {
137
- <?php echo!empty( $text_submit_color ) ? 'fill: ' . sanitize_text_field( $text_submit_color ) . ';' : ''; ?>
138
- }
139
-
140
- <?php endif; ?>
141
-
142
- <?php if ( !empty( $sug_bg_color ) ): ?>
143
- .dgwt-wcas-suggestions-wrapp,
144
- .dgwt-wcas-details-wrapp,
145
- .dgwt-wcas-search-wrapp .dgwt-wcas-suggestions-wrapp /* BackwardCompatibility v1.1.7 */ {
146
- <?php echo!empty( $sug_bg_color ) ? 'background-color: ' . sanitize_text_field( $sug_bg_color ) . ';' : ''; ?>
147
- }
148
-
149
- <?php endif; ?>
150
-
151
- <?php if ( !empty( $sug_hover_color ) ): ?>
152
- .dgwt-wcas-suggestion-selected,
153
- .dgwt-wcas-search-wrapp .dgwt-wcas-suggestion-selected /* BackwardCompatibility v1.1.7 */ {
154
- <?php echo!empty( $sug_hover_color ) ? 'background-color: ' . sanitize_text_field( $sug_hover_color ) . ';' : ''; ?>
155
- }
156
-
157
- <?php endif; ?>
158
-
159
- <?php if ( !empty( $sug_text_color ) ): ?>
160
- .dgwt-wcas-suggestions-wrapp *,
161
- .dgwt-wcas-details-wrapp *,
162
- .dgwt-wcas-sd,
163
- .dgwt-wcas-suggestion * {
164
- <?php echo!empty( $sug_text_color ) ? 'color: ' . sanitize_text_field( $sug_text_color ) . ';' : ''; ?>
165
- }
166
-
167
- <?php endif; ?>
168
-
169
- <?php if ( !empty( $sug_highlight_color ) ): ?>
170
- .dgwt-wcas-st strong,
171
- .dgwt-wcas-sd strong,
172
- .dgwt-wcas-search-wrapp .dgwt-wcas-st strong /* BackwardCompatibility v1.1.7 */ {
173
- <?php echo 'color: ' . sanitize_text_field( $sug_highlight_color ) . ';'; ?>
174
- }
175
-
176
- <?php endif; ?>
177
-
178
- <?php if ( !empty( $sug_border_color ) ): ?>
179
- .dgwt-wcas-suggestions-wrapp,
180
- .dgwt-wcas-details-wrapp,
181
- .dgwt-wcas-suggestion,
182
- .dgwt-wcas-datails-title,
183
- .dgwt-wcas-details-more-products {
184
- <?php echo 'border-color: ' . sanitize_text_field( $sug_border_color ) . '!important;'; ?>
185
- }
186
-
187
- <?php endif; ?>
188
-
189
- <?php if ( !empty( $preloader_url ) ): ?>
190
- .dgwt-wcas-inner-preloader {
191
- background-image: url('<?php echo esc_url( $preloader_url ); ?>');
192
- }
193
-
194
- <?php endif; ?>
195
-
196
- </style>
197
  <?php
198
  $css = ob_get_contents();
199
  ob_end_clean();
@@ -201,4 +200,4 @@ class Personalization {
201
  echo Helpers::minifyCSS( $css );
202
  }
203
 
204
- }
3
  namespace DgoraWcas;
4
 
5
 
6
+ class Personalization {
7
 
8
  public function __construct() {
9
 
11
 
12
  }
13
 
14
+ /**
15
+ * Add personalized CSS
16
+ *
17
+ * @return void
18
+ */
19
  public function printStyle() {
20
 
21
 
22
  // Search form
23
+ $show_submit = DGWT_WCAS()->settings->getOption( 'show_submit_button' );
24
  $bg_search_input = DGWT_WCAS()->settings->getOption( 'bg_input_color' );
25
  $text_input_color = DGWT_WCAS()->settings->getOption( 'text_input_color' );
26
  $border_input_color = DGWT_WCAS()->settings->getOption( 'border_input_color' );
36
 
37
  $preloader_url = trim( DGWT_WCAS()->settings->getOption( 'preloader_url' ) );
38
 
39
+ $max_form_width = absint( DGWT_WCAS()->settings->getOption( 'max_form_width' ) );
40
 
41
  ob_start();
42
  ?>
43
+ <style type="text/css">
44
+
45
+ .dgwt-wcas-ico-magnifier,
46
+ .dgwt-wcas-ico-magnifier-handler {
47
+ max-width: 20px;
48
+ }
49
+
50
+ .dgwt-wcas-search-wrapp {
51
+ <?php if(!empty($max_form_width)): ?> max-width: <?php echo $max_form_width; ?>px;
52
+ <?php endif; ?>
53
+ }
54
+
55
+ <?php if ( !empty( $bg_search_input ) || !empty( $text_input_color ) || !empty( $border_input_color ) ): ?>
56
+ .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input,
57
+ .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:hover,
58
+ .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:focus {
59
+ <?php echo!empty( $bg_search_input ) ? 'background-color:' . sanitize_text_field( $bg_search_input ) . ';' : ''; ?><?php echo!empty( $text_input_color ) ? 'color:' . sanitize_text_field( $text_input_color ) . ';' : ''; ?><?php echo!empty( $border_input_color ) ? 'border-color:' . sanitize_text_field( $border_input_color ) . ';' : ''; ?>
60
+ }
61
+
62
+ <?php if ( !empty( $text_input_color ) ): ?>
63
+ .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input::placeholder {
64
+ color: <?php echo sanitize_text_field( $text_input_color ); ?>;
65
+ opacity: 0.3;
66
+ }
67
+
68
+ .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input::-webkit-input-placeholder {
69
+ color: <?php echo sanitize_text_field( $text_input_color ); ?>;
70
+ opacity: 0.3;
71
+ }
72
+
73
+ .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:-moz-placeholder {
74
+ color: <?php echo sanitize_text_field( $text_input_color ); ?>;
75
+ opacity: 0.3;
76
+ }
77
+
78
+ .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input::-moz-placeholder {
79
+ color: <?php echo sanitize_text_field( $text_input_color ); ?>;
80
+ opacity: 0.3;
81
+ }
82
+
83
+ .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:-ms-input-placeholder {
84
+ color: <?php echo sanitize_text_field( $text_input_color ); ?>;
85
+ }
86
+
87
+ .dgwt-wcas-no-submit.dgwt-wcas-search-wrapp .dgwt-wcas-ico-magnifier {
88
+ fill: <?php echo sanitize_text_field( $text_input_color ); ?>;
89
+ }
90
+
91
+ <?php endif; ?>
92
+ <?php endif; ?>
93
+
94
+ <?php
95
+ // Submit button
 
96
  if ( $show_submit === 'on' && (!empty( $bg_submit_color ) || !empty( $text_submit_color )) ): ?>
97
+ .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit::before {
98
+ <?php echo !empty( $bg_submit_color ) ? 'border-color: transparent ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?>
99
+ }
100
 
101
+ .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:hover::before,
102
+ .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:focus::before {
103
+ <?php echo!empty( $bg_submit_color ) ? 'border-right-color: ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?>
104
+ }
105
 
106
+ .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit,
107
+ .dgwt-wcas-om-bar .dgwt-wcas-om-return {
108
+ <?php echo!empty( $bg_submit_color ) ? 'background-color: ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?><?php echo!empty( $text_submit_color ) ? 'color: ' . sanitize_text_field( $text_submit_color ) . ';' : ''; ?>
109
+ }
110
 
111
+ .dgwt-wcas-search-wrapp .dgwt-wcas-ico-magnifier,
112
+ .dgwt-wcas-om-bar .dgwt-wcas-om-return svg path {
113
+ <?php echo!empty( $text_submit_color ) ? 'fill: ' . sanitize_text_field( $text_submit_color ) . ';' : ''; ?>
114
+ }
115
 
116
+ <?php endif; ?>
117
 
118
+ <?php
119
+ // Submit button
120
  if ( $show_submit === 'on' && (!empty( $bg_submit_color ) || !empty( $text_submit_color )) ):
121
  ?>
122
+ .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit::before {
123
+ <?php echo!empty( $bg_submit_color ) ? 'border-color: transparent ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?>
124
+ }
125
+
126
+ .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:hover::before,
127
+ .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit:focus::before {
128
+ <?php echo!empty( $bg_submit_color ) ? 'border-right-color: ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?>
129
+ }
130
+
131
+ .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit {
132
+ <?php echo!empty( $bg_submit_color ) ? 'background-color: ' . sanitize_text_field( $bg_submit_color ) . ';' : ''; ?><?php echo!empty( $text_submit_color ) ? 'color: ' . sanitize_text_field( $text_submit_color ) . ';' : ''; ?>
133
+ }
134
+
135
+ .dgwt-wcas-search-wrapp .dgwt-wcas-ico-magnifier {
136
+ <?php echo!empty( $text_submit_color ) ? 'fill: ' . sanitize_text_field( $text_submit_color ) . ';' : ''; ?>
137
+ }
138
+
139
+ <?php endif; ?>
140
+
141
+ <?php if ( !empty( $sug_bg_color ) ): ?>
142
+ .dgwt-wcas-suggestions-wrapp,
143
+ .dgwt-wcas-details-wrapp
144
+ {
145
+ <?php echo!empty( $sug_bg_color ) ? 'background-color: ' . sanitize_text_field( $sug_bg_color ) . ';' : ''; ?>
146
+ }
147
+
148
+ <?php endif; ?>
149
+
150
+ <?php if ( !empty( $sug_hover_color ) ): ?>
151
+ .dgwt-wcas-suggestion-selected
152
+ {
153
+ <?php echo!empty( $sug_hover_color ) ? 'background-color: ' . sanitize_text_field( $sug_hover_color ) . ';' : ''; ?>
154
+ }
155
+
156
+ <?php endif; ?>
157
+
158
+ <?php if ( !empty( $sug_text_color ) ): ?>
159
+ .dgwt-wcas-suggestions-wrapp *,
160
+ .dgwt-wcas-details-wrapp *,
161
+ .dgwt-wcas-sd,
162
+ .dgwt-wcas-suggestion * {
163
+ <?php echo!empty( $sug_text_color ) ? 'color: ' . sanitize_text_field( $sug_text_color ) . ';' : ''; ?>
164
+ }
165
+
166
+ <?php endif; ?>
167
+
168
+ <?php if ( !empty( $sug_highlight_color ) ): ?>
169
+ .dgwt-wcas-st strong,
170
+ .dgwt-wcas-sd strong
171
+ {
172
+ <?php echo 'color: ' . sanitize_text_field( $sug_highlight_color ) . ';'; ?>
173
+ }
174
+
175
+ <?php endif; ?>
176
+
177
+ <?php if ( !empty( $sug_border_color ) ): ?>
178
+ .dgwt-wcas-suggestions-wrapp,
179
+ .dgwt-wcas-details-wrapp,
180
+ .dgwt-wcas-suggestion,
181
+ .dgwt-wcas-datails-title,
182
+ .dgwt-wcas-details-more-products {
183
+ <?php echo 'border-color: ' . sanitize_text_field( $sug_border_color ) . '!important;'; ?>
184
+ }
185
+
186
+ <?php endif; ?>
187
+
188
+ <?php if ( !empty( $preloader_url ) ): ?>
189
+ .dgwt-wcas-inner-preloader {
190
+ background-image: url('<?php echo esc_url( $preloader_url ); ?>');
191
+ }
192
+
193
+ <?php endif; ?>
194
+
195
+ </style>
196
  <?php
197
  $css = ob_get_contents();
198
  ob_end_clean();
200
  echo Helpers::minifyCSS( $css );
201
  }
202
 
203
+ }
includes/Product.php CHANGED
@@ -5,575 +5,551 @@ namespace DgoraWcas;
5
 
6
  use DgoraWcas\Engines\TNTSearchMySQL\Indexer\Utils;
7
 
8
- class Product
9
- {
10
- private $productID = 0;
11
- private $wcProduct = null;
12
- private $variations = array();
13
- private $langCode = 'en';
14
-
15
- public function __construct($product)
16
- {
17
- if ( ! empty($product) && is_object($product) && is_a($product, 'WC_Product')) {
18
- $this->productID = $product->get_id();
19
- $this->wcProduct = $product;
20
- }
21
-
22
- if ( ! empty($product) && is_object($product) && is_a($product, 'WP_Post')) {
23
- $this->productID = absint($product->ID);
24
- $this->wcProduct = wc_get_product($product);
25
- }
26
-
27
- if (is_numeric($product) && 'product' === get_post_type($product)) {
28
- $this->productID = absint($product);
29
- $this->wcProduct = wc_get_product($product);
30
- }
31
-
32
- $this->setLanguage();
33
- }
34
-
35
- /**
36
- * Set info about product language
37
- *
38
- * @return void
39
- */
40
- public function setLanguage()
41
- {
42
- $this->langCode = Multilingual::getPostLang($this->getID());
43
- }
44
-
45
- /**
46
- * Get product ID (post_id)
47
- * @return INT
48
- */
49
- public function getID()
50
- {
51
- return $this->productID;
52
- }
53
-
54
- /**
55
- * Get created date
56
- *
57
- * @return mixed
58
- */
59
- public function getCreatedDate()
60
- {
61
- $date = $this->wcProduct->get_date_created();
62
- if ( ! $date) {
63
- $date = '0000-00-00 00:00:00';
64
- }
65
-
66
- return $date;
67
- }
68
-
69
- /**
70
- * Get product name
71
- * @return string
72
- */
73
- public function getName()
74
- {
75
- return apply_filters('dgwt/wcas/product/name', $this->wcProduct->get_name());
76
- }
77
-
78
- /**
79
- * Get prepared product description
80
- *
81
- * @param string $type full|short|suggestions|details-panel
82
- * @param int $forceWordsLimit
83
- *
84
- * @return string
85
- */
86
- public function getDescription($type = 'full', $forceWordsLimit = 0)
87
- {
88
-
89
- $output = '';
90
-
91
- if ($type === 'full') {
92
- $output = $this->wcProduct->get_description();
93
- }
94
-
95
- if ($type === 'short') {
96
- $output = $this->wcProduct->get_short_description();
97
- }
98
-
99
- if ($type === 'suggestions' || $type === 'details-panel') {
100
-
101
- $desc = $this->wcProduct->get_short_description();
102
-
103
- if (empty($desc)) {
104
- $desc = $this->wcProduct->get_description();
105
- }
106
-
107
- if ( ! empty($desc)) {
108
-
109
- if($type === 'details-panel') {
110
- $wordsLimit = $forceWordsLimit > 0 ? $forceWordsLimit : 20;
111
- $output = Helpers::makeShortDescription($desc, $wordsLimit, '</br><b><strong>', false);
112
- }elseif ($type === 'suggestions'){
113
- $wordsLimit = $forceWordsLimit > 0 ? $forceWordsLimit : 30;
114
- $output = Helpers::makeShortDescription($desc, $wordsLimit, '');
115
- }
116
- }
117
- }
118
-
119
- return apply_filters('dgwt/wcas/product/description', $output, $type, $this->productID, $this);
120
- }
121
-
122
- /**
123
- * Get product permalink
124
- *
125
- * @return string
126
- */
127
- public function getPermalink()
128
- {
129
- $permalink = $this->wcProduct->get_permalink();
130
-
131
- return apply_filters('dgwt/wcas/product/permalink', $permalink, $this->productID, $this);
132
- }
133
-
134
- /**
135
- * Get product thumbnail url
136
- *
137
- * @param string $size
138
- *
139
- * @return string
140
- */
141
- public function getThumbnailSrc($size = '')
142
- {
143
- $src = '';
144
- $size = empty($size) ? 'dgwt-wcas-product-suggestion' : $size;
145
-
146
- $imageID = $this->wcProduct->get_image_id();
147
-
148
- if ( ! empty($imageID)) {
149
- $imageSrc = wp_get_attachment_image_src($imageID, $size);
150
-
151
- if (is_array($imageSrc) && ! empty($imageSrc[0])) {
152
- $src = $imageSrc[0];
153
- }
154
- }
155
-
156
- if (empty($src)) {
157
- $src = wc_placeholder_img_src();
158
- }
159
-
160
- return apply_filters('dgwt/wcas/product/thumbnail_src', $src, $this->productID, $this);
161
- }
162
-
163
- /**
164
- * Get product thumbnail
165
- *
166
- * @param string $size
167
- *
168
- * @return string
169
- */
170
- public function getThumbnail($size = '')
171
- {
172
- return '<img src="' . $this->getThumbnailSrc($size) . '" alt="' . $this->getName() . '" />';
173
- }
174
-
175
-
176
- /**
177
- * Get HTML code with the product price
178
- *
179
- * @return string
180
- */
181
- public function getPriceHTML()
182
- {
183
-
184
- $price = $this->wcProduct->get_price_html();
185
-
186
- if(!empty($price) && is_string($price)){
187
- $price = preg_replace('/(?<=\d)\s+(?=\d|\-)/', '&nbsp;', $price);
188
- }
189
-
190
- return (string) apply_filters('dgwt/wcas/product/html_price', $price, $this->productID, $this);
191
- }
192
-
193
- /**
194
- * Get price
195
- *
196
- * @return string
197
- */
198
- public function getPrice()
199
- {
200
- return (string) $this->wcProduct->get_price();
201
- }
202
-
203
- /**
204
- * Get average rating
205
- *
206
- * @return float
207
- */
208
- public function getAverageRating()
209
- {
210
- return (float) $this->wcProduct->get_average_rating();
211
- }
212
-
213
- /**
214
- * Get review count
215
- *
216
- * @return int
217
- */
218
- public function getReviewCount()
219
- {
220
- return (int) $this->wcProduct->get_review_count();
221
- }
222
-
223
- /**
224
- * Get rating HTML
225
- *
226
- * @return string
227
- */
228
- public function getRatingHtml()
229
- {
230
- return (string) wc_get_rating_html($this->getAverageRating());
231
- }
232
-
233
-
234
- /**
235
- * Get total sales
236
- *
237
- * @return int
238
- */
239
- public function getTotalSales()
240
- {
241
- return (int) $this->wcProduct->get_total_sales();
242
- }
243
-
244
- /**
245
- * Get SKU
246
- * @return string
247
- */
248
- public function getSKU()
249
- {
250
- return (string) apply_filters('dgwt/wcas/product/sku', $this->wcProduct->get_sku(), $this->productID, $this);
251
- }
252
-
253
- /**
254
- * Get available variations
255
- * @return array
256
- */
257
- public function getAvailableVariations()
258
- {
259
-
260
- if (empty($this->variations) && is_a($this->wcProduct, 'WC_Product_Variable')) {
261
- return $this->wcProduct->get_available_variations();
262
- }
263
-
264
- return $this->variations;
265
-
266
- }
267
-
268
- /**
269
- * Get all SKUs for variations
270
- * @return array
271
- */
272
- public function getVariationsSKUs()
273
- {
274
- $skus = array();
275
-
276
- $variations = $this->getAvailableVariations();
277
-
278
- foreach ($variations as $variation) {
279
-
280
- if (is_array($variation) && ! empty($variation['sku'])) {
281
- $skus[] = sanitize_text_field($variation['sku']);
282
- }
283
- }
284
-
285
- return apply_filters('dgwt/wcas/product/variations_skus', $skus, $this->productID, $this);
286
- }
287
-
288
- /**
289
- * Get description of all product variations
290
- *
291
- * @return array
292
- */
293
- public function getVariationsDescriptions()
294
- {
295
-
296
- $descriptions = array();
297
-
298
- $variations = $this->getAvailableVariations();
299
-
300
- foreach ($variations as $variation) {
301
-
302
- if (is_array($variation) && ! empty($variation['variation_description'])) {
303
- $descriptions[] = sanitize_text_field($variation['variation_description']);
304
- }
305
- }
306
-
307
- return $descriptions;
308
- }
309
-
310
-
311
- /**
312
- * Get attributes
313
- *
314
- * @param bool $onlyNames
315
- *
316
- * @return array
317
- */
318
- public function getAttributes($onlyNames = false)
319
- {
320
- $terms = array();
321
- $attributes = apply_filters('dgwt/wcas/product/attributes', $this->wcProduct->get_attributes(), $this->productID, $this);
322
-
323
- foreach ($attributes as $attribute) {
324
-
325
- if ($onlyNames) {
326
-
327
-
328
- if ($attribute->is_taxonomy()) {
329
-
330
- // Global attributes
331
- $attrTerms = $attribute->get_terms();
332
- if ( ! empty($attrTerms) && is_array($attrTerms)) {
333
- foreach ($attrTerms as $attrTerm) {
334
- $terms[] = $attrTerm->name;
335
- }
336
- }
337
-
338
- } else {
339
-
340
- // Custom attributes
341
- $attrOptions = $attribute->get_options();
342
- if ( ! empty($attrOptions) && is_array($attrOptions)) {
343
- // Use external static method for keeping always the same filters = self::getCustomAttributes($productID);
344
- $customAttributesValues = self::getCustomAttributes($this->productID);
345
- if(!empty($customAttributesValues)){
346
- $terms = array_merge($terms, $customAttributesValues);
347
- }
348
-
349
- }
350
- }
351
-
352
- } else {
353
- //@TODO future use
354
- }
355
-
356
- }
357
-
358
- return apply_filters('dgwt/wcas/product/attribute_terms', $terms, $this->productID, $this);
359
- }
360
-
361
- /**
362
- * Get product language
363
- *
364
- * @return string
365
- */
366
- public function getLanguage()
367
- {
368
- return $this->langCode;
369
- }
370
-
371
- /**
372
- * Get custom field value
373
- *
374
- * @param string $metaKey
375
- *
376
- * @return string
377
- */
378
- public function getCustomField($metaKey)
379
- {
380
- return get_post_meta($this->productID, $metaKey, true);
381
- }
382
-
383
- /**
384
- * Get brand name
385
- *
386
- * @return string
387
- */
388
- public function getBrand()
389
- {
390
- $brand = '';
391
- $taxonomy = DGWT_WCAS()->brands->getBrandTaxonomy();
392
-
393
- if ( ! empty($taxonomy)) {
394
-
395
- $terms = get_the_terms($this->productID, $taxonomy);
396
-
397
- if ($terms && ! is_wp_error($terms)) {
398
- $brand = ! empty($terms[0]->name) ? $terms[0]->name : '';
399
- }
400
-
401
- }
402
-
403
- return $brand;
404
- }
405
-
406
- /**
407
- * Get terms form specific taxonomy
408
- *
409
- * @param $taxonomy
410
- * @param $format output format
411
- *
412
- * @return string
413
- *
414
- */
415
- public function getTerms($taxonomy = 'product_cat', $format = 'array')
416
- {
417
- $items = array();
418
-
419
- if ( ! empty($taxonomy)) {
420
-
421
- $terms = get_the_terms($this->productID, $taxonomy);
422
-
423
- if (!empty($terms) && is_array($terms)) {
424
- foreach ($terms as $term){
425
- if(!empty($term->name)){
426
- $items[] = $term->name;
427
- }
428
-
429
- }
430
- }
431
-
432
- }
433
-
434
- return $format === 'string' ? implode(' | ', $items) : $items;
435
- }
436
-
437
- /**
438
- * Check, if class is initialized correctly
439
- * @return bool
440
- */
441
- public function isValid()
442
- {
443
- $isValid = false;
444
-
445
- if (is_a($this->wcProduct, 'WC_Product')) {
446
- $isValid = true;
447
- }
448
-
449
- return $isValid;
450
- }
451
-
452
- /**
453
- * WooCommerce raw product object
454
- *
455
- * @return object
456
- */
457
- public function getWooObject()
458
- {
459
- return $this->wcProduct;
460
- }
461
-
462
- /**
463
- * Get custom attributes
464
- *
465
- * for external use
466
- *
467
- * @param int productID
468
- *
469
- * @return array
470
- */
471
- public static function getCustomAttributes($productID)
472
- {
473
- global $wpdb;
474
-
475
- $terms = array();
476
-
477
- $sql = $wpdb->prepare("SELECT meta_value
478
  FROM $wpdb->postmeta
479
  WHERE post_id = %d
480
  AND meta_key = '_product_attributes'
481
- ", $productID);
482
 
483
- $optValue = $wpdb->get_var($sql);
484
 
485
- if ( ! empty($optValue) && strpos($optValue, 'a:') === 0) {
486
 
487
- $rawAttributes = unserialize($optValue);
488
 
489
- if (is_array($rawAttributes) && ! empty($rawAttributes)) {
490
 
491
- $rawAttributes = apply_filters('dgwt/wcas/product/custom_attributes', $rawAttributes, $productID);
492
 
493
- foreach ($rawAttributes as $rawAttribute) {
494
- if ($rawAttribute['is_taxonomy'] == 0 && ! empty($rawAttribute['value'])) {
495
- $partTerms = explode(' | ', $rawAttribute['value']);
496
 
497
- $terms = array_merge($terms, $partTerms);
498
- }
499
- }
500
- }
501
 
502
- }
503
 
504
- return $terms;
505
 
506
- }
507
 
508
- /**
509
- * Get product currency
510
- *
511
- * @return string
512
- */
513
- public function getCurrency()
514
- {
515
 
516
- $currency = get_woocommerce_currency();
517
 
518
- if (Multilingual::isMultilingual()) {
519
- $currencyByLang = Multilingual::getCurrencyForLang($this->getLanguage());
520
- if(!empty($currencyByLang)){
521
- $currency = $currencyByLang;
522
- }
523
- }
524
 
525
 
526
- return $currency;
527
- }
528
 
529
- /**
530
- * Stock quantity message
531
- *
532
- * @return string
533
- */
534
- public function getStockAvailability()
535
- {
536
- $html = '';
537
 
538
- if ('yes' === get_option('woocommerce_manage_stock') && $this->wcProduct->get_manage_stock()) {
539
- $data = $this->wcProduct->get_availability();
540
- if(!empty($data) && is_array($data)){
541
- $text = !empty($data['availability']) ? $data['availability'] : '';
542
- $class = !empty($data['class']) ? ' ' . $data['class'] : '';
543
 
544
- if($text) {
545
- $html .= '<span class="dgwt-wcas-stock' . $class . '">';
546
- $html .= $text;
547
- $html .= '</span>';
548
- }
549
- }
550
- }
551
 
552
- return $html;
553
- }
554
 
555
- /**
556
- * Check product type
557
- *
558
- * @return bool
559
- */
560
- public function isType($type){
561
- return $this->wcProduct->is_type($type);
562
- }
563
 
564
- /**
565
- * Check if the object was initialized properly
566
- *
567
- * @return bool
568
- */
569
- public function isCorrect(){
570
- $correct = true;
571
 
572
- if(empty($this->wcProduct)){
573
- $correct = false;
574
- }
575
 
576
- return $correct;
577
- }
578
 
579
- }
5
 
6
  use DgoraWcas\Engines\TNTSearchMySQL\Indexer\Utils;
7
 
8
+ class Product {
9
+ private $productID = 0;
10
+ private $wcProduct = null;
11
+ private $variations = array();
12
+ private $langCode = 'en';
13
+
14
+ public function __construct( $product ) {
15
+ if ( ! empty( $product ) && is_object( $product ) && is_a( $product, 'WC_Product' ) ) {
16
+ $this->productID = $product->get_id();
17
+ $this->wcProduct = $product;
18
+ }
19
+
20
+ if ( ! empty( $product ) && is_object( $product ) && is_a( $product, 'WP_Post' ) ) {
21
+ $this->productID = absint( $product->ID );
22
+ $this->wcProduct = wc_get_product( $product );
23
+ }
24
+
25
+ if ( is_numeric( $product ) && 'product' === get_post_type( $product ) ) {
26
+ $this->productID = absint( $product );
27
+ $this->wcProduct = wc_get_product( $product );
28
+ }
29
+
30
+ $this->setLanguage();
31
+ }
32
+
33
+ /**
34
+ * Set info about product language
35
+ *
36
+ * @return void
37
+ */
38
+ public function setLanguage() {
39
+ $this->langCode = Multilingual::getPostLang( $this->getID() );
40
+ }
41
+
42
+ /**
43
+ * Get product ID (post_id)
44
+ * @return INT
45
+ */
46
+ public function getID() {
47
+ return $this->productID;
48
+ }
49
+
50
+ /**
51
+ * Get created date
52
+ *
53
+ * @return mixed
54
+ */
55
+ public function getCreatedDate() {
56
+ $date = $this->wcProduct->get_date_created();
57
+ if ( ! $date ) {
58
+ $date = '0000-00-00 00:00:00';
59
+ }
60
+
61
+ return $date;
62
+ }
63
+
64
+ /**
65
+ * Get product name
66
+ * @return string
67
+ */
68
+ public function getName() {
69
+ return apply_filters( 'dgwt/wcas/product/name', $this->wcProduct->get_name() );
70
+ }
71
+
72
+ /**
73
+ * Get prepared product description
74
+ *
75
+ * @param string $type full|short|suggestions|details-panel
76
+ * @param int $forceWordsLimit
77
+ *
78
+ * @return string
79
+ */
80
+ public function getDescription( $type = 'full', $forceWordsLimit = 0 ) {
81
+
82
+ $output = '';
83
+
84
+ if ( $type === 'full' ) {
85
+ $output = $this->wcProduct->get_description();
86
+ }
87
+
88
+ if ( $type === 'short' ) {
89
+ $output = $this->wcProduct->get_short_description();
90
+ }
91
+
92
+ if ( $type === 'suggestions' || $type === 'details-panel' ) {
93
+
94
+ $desc = $this->wcProduct->get_short_description();
95
+
96
+ if ( empty( $desc ) ) {
97
+ $desc = $this->wcProduct->get_description();
98
+ }
99
+
100
+ if ( ! empty( $desc ) ) {
101
+
102
+ if ( $type === 'details-panel' ) {
103
+ $wordsLimit = $forceWordsLimit > 0 ? $forceWordsLimit : 20;
104
+ $output = Helpers::makeShortDescription( $desc, $wordsLimit, '</br><b><strong>', false );
105
+ } elseif ( $type === 'suggestions' ) {
106
+ $wordsLimit = $forceWordsLimit > 0 ? $forceWordsLimit : 30;
107
+ $output = Helpers::makeShortDescription( $desc, $wordsLimit, '' );
108
+ }
109
+ }
110
+ }
111
+
112
+ return apply_filters( 'dgwt/wcas/product/description', $output, $type, $this->productID, $this );
113
+ }
114
+
115
+ /**
116
+ * Get product permalink
117
+ *
118
+ * @return string
119
+ */
120
+ public function getPermalink() {
121
+ $permalink = $this->wcProduct->get_permalink();
122
+
123
+ return apply_filters( 'dgwt/wcas/product/permalink', $permalink, $this->productID, $this );
124
+ }
125
+
126
+ /**
127
+ * Get product thumbnail url
128
+ *
129
+ * @param string $size
130
+ *
131
+ * @return string
132
+ */
133
+ public function getThumbnailSrc( $size = '' ) {
134
+ $src = '';
135
+ $size = empty( $size ) ? 'dgwt-wcas-product-suggestion' : $size;
136
+
137
+ $imageID = $this->wcProduct->get_image_id();
138
+
139
+ if ( ! empty( $imageID ) ) {
140
+ $imageSrc = wp_get_attachment_image_src( $imageID, $size );
141
+
142
+ if ( is_array( $imageSrc ) && ! empty( $imageSrc[0] ) ) {
143
+ $src = $imageSrc[0];
144
+ }
145
+ }
146
+
147
+ if ( empty( $src ) ) {
148
+ $src = wc_placeholder_img_src();
149
+ }
150
+
151
+ return apply_filters( 'dgwt/wcas/product/thumbnail_src', $src, $this->productID, $this );
152
+ }
153
+
154
+ /**
155
+ * Get product thumbnail
156
+ *
157
+ * @param string $size
158
+ *
159
+ * @return string
160
+ */
161
+ public function getThumbnail( $size = '' ) {
162
+ return '<img src="' . $this->getThumbnailSrc( $size ) . '" alt="' . $this->getName() . '" />';
163
+ }
164
+
165
+
166
+ /**
167
+ * Get HTML code with the product price
168
+ *
169
+ * @return string
170
+ */
171
+ public function getPriceHTML() {
172
+
173
+ $price = $this->wcProduct->get_price_html();
174
+
175
+ if ( ! empty( $price ) && is_string( $price ) ) {
176
+ $price = preg_replace( '/(?<=\d)\s+(?=\d|\-)/', '&nbsp;', $price );
177
+ }
178
+
179
+ return (string) apply_filters( 'dgwt/wcas/product/html_price', $price, $this->productID, $this );
180
+ }
181
+
182
+ /**
183
+ * Get price
184
+ *
185
+ * @return string
186
+ */
187
+ public function getPrice() {
188
+ return (string) $this->wcProduct->get_price();
189
+ }
190
+
191
+ /**
192
+ * Get average rating
193
+ *
194
+ * @return float
195
+ */
196
+ public function getAverageRating() {
197
+ return (float) $this->wcProduct->get_average_rating();
198
+ }
199
+
200
+ /**
201
+ * Get review count
202
+ *
203
+ * @return int
204
+ */
205
+ public function getReviewCount() {
206
+ return (int) $this->wcProduct->get_review_count();
207
+ }
208
+
209
+ /**
210
+ * Get rating HTML
211
+ *
212
+ * @return string
213
+ */
214
+ public function getRatingHtml() {
215
+ return (string) wc_get_rating_html( $this->getAverageRating() );
216
+ }
217
+
218
+
219
+ /**
220
+ * Get total sales
221
+ *
222
+ * @return int
223
+ */
224
+ public function getTotalSales() {
225
+ return (int) $this->wcProduct->get_total_sales();
226
+ }
227
+
228
+ /**
229
+ * Get SKU
230
+ * @return string
231
+ */
232
+ public function getSKU() {
233
+ return (string) apply_filters( 'dgwt/wcas/product/sku', $this->wcProduct->get_sku(), $this->productID, $this );
234
+ }
235
+
236
+ /**
237
+ * Get available variations
238
+ * @return array
239
+ */
240
+ public function getAvailableVariations() {
241
+
242
+ if ( empty( $this->variations ) && is_a( $this->wcProduct, 'WC_Product_Variable' ) ) {
243
+ return $this->wcProduct->get_available_variations();
244
+ }
245
+
246
+ return $this->variations;
247
+
248
+ }
249
+
250
+ /**
251
+ * Get all SKUs for variations
252
+ * @return array
253
+ */
254
+ public function getVariationsSKUs() {
255
+ $skus = array();
256
+
257
+ $variations = $this->getAvailableVariations();
258
+
259
+ foreach ( $variations as $variation ) {
260
+
261
+ if ( is_array( $variation ) && ! empty( $variation['sku'] ) ) {
262
+ $skus[] = sanitize_text_field( $variation['sku'] );
263
+ }
264
+ }
265
+
266
+ return apply_filters( 'dgwt/wcas/product/variations_skus', $skus, $this->productID, $this );
267
+ }
268
+
269
+ /**
270
+ * Get description of all product variations
271
+ *
272
+ * @return array
273
+ */
274
+ public function getVariationsDescriptions() {
275
+
276
+ $descriptions = array();
277
+
278
+ $variations = $this->getAvailableVariations();
279
+
280
+ foreach ( $variations as $variation ) {
281
+
282
+ if ( is_array( $variation ) && ! empty( $variation['variation_description'] ) ) {
283
+ $descriptions[] = sanitize_text_field( $variation['variation_description'] );
284
+ }
285
+ }
286
+
287
+ return $descriptions;
288
+ }
289
+
290
+
291
+ /**
292
+ * Get attributes
293
+ *
294
+ * @param bool $onlyNames
295
+ *
296
+ * @return array
297
+ */
298
+ public function getAttributes( $onlyNames = false ) {
299
+ $terms = array();
300
+ $attributes = apply_filters( 'dgwt/wcas/product/attributes', $this->wcProduct->get_attributes(), $this->productID, $this );
301
+
302
+ foreach ( $attributes as $attribute ) {
303
+
304
+ if ( $onlyNames ) {
305
+
306
+
307
+ if ( $attribute->is_taxonomy() ) {
308
+
309
+ // Global attributes
310
+ $attrTerms = $attribute->get_terms();
311
+ if ( ! empty( $attrTerms ) && is_array( $attrTerms ) ) {
312
+ foreach ( $attrTerms as $attrTerm ) {
313
+ $terms[] = $attrTerm->name;
314
+ }
315
+ }
316
+
317
+ } else {
318
+
319
+ // Custom attributes
320
+ $attrOptions = $attribute->get_options();
321
+ if ( ! empty( $attrOptions ) && is_array( $attrOptions ) ) {
322
+ // Use external static method for keeping always the same filters = self::getCustomAttributes($productID);
323
+ $customAttributesValues = self::getCustomAttributes( $this->productID );
324
+ if ( ! empty( $customAttributesValues ) ) {
325
+ $terms = array_merge( $terms, $customAttributesValues );
326
+ }
327
+
328
+ }
329
+ }
330
+
331
+ } else {
332
+ //@TODO future use
333
+ }
334
+
335
+ }
336
+
337
+ return apply_filters( 'dgwt/wcas/product/attribute_terms', $terms, $this->productID, $this );
338
+ }
339
+
340
+ /**
341
+ * Get product language
342
+ *
343
+ * @return string
344
+ */
345
+ public function getLanguage() {
346
+ return $this->langCode;
347
+ }
348
+
349
+ /**
350
+ * Get custom field value
351
+ *
352
+ * @param string $metaKey
353
+ *
354
+ * @return string
355
+ */
356
+ public function getCustomField( $metaKey ) {
357
+ return get_post_meta( $this->productID, $metaKey, true );
358
+ }
359
+
360
+ /**
361
+ * Get brand name
362
+ *
363
+ * @return string
364
+ */
365
+ public function getBrand() {
366
+ $brand = '';
367
+ $taxonomy = DGWT_WCAS()->brands->getBrandTaxonomy();
368
+
369
+ if ( ! empty( $taxonomy ) ) {
370
+
371
+ $terms = get_the_terms( $this->productID, $taxonomy );
372
+
373
+ if ( $terms && ! is_wp_error( $terms ) ) {
374
+ $brand = ! empty( $terms[0]->name ) ? $terms[0]->name : '';
375
+ }
376
+
377
+ }
378
+
379
+ return $brand;
380
+ }
381
+
382
+ /**
383
+ * Get terms form specific taxonomy
384
+ *
385
+ * @param $taxonomy
386
+ * @param $format output format
387
+ *
388
+ * @return string
389
+ *
390
+ */
391
+ public function getTerms( $taxonomy = 'product_cat', $format = 'array' ) {
392
+ $items = array();
393
+
394
+ if ( ! empty( $taxonomy ) ) {
395
+
396
+ $terms = get_the_terms( $this->productID, $taxonomy );
397
+
398
+ if ( ! empty( $terms ) && is_array( $terms ) ) {
399
+ foreach ( $terms as $term ) {
400
+ if ( ! empty( $term->name ) ) {
401
+
402
+ if ( apply_filters( 'dgwt/wcas/tnt/source_query/term_description', false ) && ! empty( $term->description ) ) {
403
+ $items[] = $term->name . ' | ' . $term->description;
404
+ } else {
405
+ $items[] = $term->name;
406
+ }
407
+
408
+ }
409
+
410
+ }
411
+ }
412
+
413
+ }
414
+
415
+ return $format === 'string' ? implode( ' | ', $items ) : $items;
416
+ }
417
+
418
+ /**
419
+ * Check, if class is initialized correctly
420
+ * @return bool
421
+ */
422
+ public function isValid() {
423
+ $isValid = false;
424
+
425
+ if ( is_a( $this->wcProduct, 'WC_Product' ) ) {
426
+ $isValid = true;
427
+ }
428
+
429
+ return $isValid;
430
+ }
431
+
432
+ /**
433
+ * WooCommerce raw product object
434
+ *
435
+ * @return object
436
+ */
437
+ public function getWooObject() {
438
+ return $this->wcProduct;
439
+ }
440
+
441
+ /**
442
+ * Get custom attributes
443
+ *
444
+ * for external use
445
+ *
446
+ * @param int productID
447
+ *
448
+ * @return array
449
+ */
450
+ public static function getCustomAttributes( $productID ) {
451
+ global $wpdb;
452
+
453
+ $terms = array();
454
+
455
+ $sql = $wpdb->prepare( "SELECT meta_value
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
  FROM $wpdb->postmeta
457
  WHERE post_id = %d
458
  AND meta_key = '_product_attributes'
459
+ ", $productID );
460
 
461
+ $optValue = $wpdb->get_var( $sql );
462
 
463
+ if ( ! empty( $optValue ) && strpos( $optValue, 'a:' ) === 0 ) {
464
 
465
+ $rawAttributes = unserialize( $optValue );
466
 
467
+ if ( is_array( $rawAttributes ) && ! empty( $rawAttributes ) ) {
468
 
469
+ $rawAttributes = apply_filters( 'dgwt/wcas/product/custom_attributes', $rawAttributes, $productID );
470
 
471
+ foreach ( $rawAttributes as $rawAttribute ) {
472
+ if ( $rawAttribute['is_taxonomy'] == 0 && ! empty( $rawAttribute['value'] ) ) {
473
+ $partTerms = explode( ' | ', $rawAttribute['value'] );
474
 
475
+ $terms = array_merge( $terms, $partTerms );
476
+ }
477
+ }
478
+ }
479
 
480
+ }
481
 
482
+ return $terms;
483
 
484
+ }
485
 
486
+ /**
487
+ * Get product currency
488
+ *
489
+ * @return string
490
+ */
491
+ public function getCurrency() {
 
492
 
493
+ $currency = get_woocommerce_currency();
494
 
495
+ if ( Multilingual::isMultilingual() ) {
496
+ $currencyByLang = Multilingual::getCurrencyForLang( $this->getLanguage() );
497
+ if ( ! empty( $currencyByLang ) ) {
498
+ $currency = $currencyByLang;
499
+ }
500
+ }
501
 
502
 
503
+ return $currency;
504
+ }
505
 
506
+ /**
507
+ * Stock quantity message
508
+ *
509
+ * @return string
510
+ */
511
+ public function getStockAvailability() {
512
+ $html = '';
 
513
 
514
+ if ( 'yes' === get_option( 'woocommerce_manage_stock' ) && $this->wcProduct->get_manage_stock() ) {
515
+ $data = $this->wcProduct->get_availability();
516
+ if ( ! empty( $data ) && is_array( $data ) ) {
517
+ $text = ! empty( $data['availability'] ) ? $data['availability'] : '';
518
+ $class = ! empty( $data['class'] ) ? ' ' . $data['class'] : '';
519
 
520
+ if ( $text ) {
521
+ $html .= '<span class="dgwt-wcas-stock' . $class . '">';
522
+ $html .= $text;
523
+ $html .= '</span>';
524
+ }
525
+ }
526
+ }
527
 
528
+ return $html;
529
+ }
530
 
531
+ /**
532
+ * Check product type
533
+ *
534
+ * @return bool
535
+ */
536
+ public function isType( $type ) {
537
+ return $this->wcProduct->is_type( $type );
538
+ }
539
 
540
+ /**
541
+ * Check if the object was initialized properly
542
+ *
543
+ * @return bool
544
+ */
545
+ public function isCorrect() {
546
+ $correct = true;
547
 
548
+ if ( empty( $this->wcProduct ) ) {
549
+ $correct = false;
550
+ }
551
 
552
+ return $correct;
553
+ }
554
 
555
+ }
includes/Scripts.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  namespace DgoraWcas;
4
 
 
5
  // Exit if accessed directly
6
  if ( !defined( 'ABSPATH' ) ) {
7
  exit;
@@ -10,131 +11,121 @@ class Scripts
10
  {
11
  public function __construct()
12
  {
13
- add_action( 'wp_enqueue_scripts', array( $this, 'jsScripts' ) );
14
- add_action( 'wp_print_styles', array( $this, 'cssStyle' ) );
15
  }
16
 
17
  /**
18
- * Register scripts.
19
  * Uses a WP hook wp_enqueue_scripts
20
  *
21
  * @return void
22
  */
23
- public function jsScripts()
24
  {
25
-
26
- if ( !is_admin() ) {
27
- // Main JS
28
- $localize = array(
29
- 'labels' => Helpers::getLabels(),
30
- 'ajax_search_endpoint' => \WC_AJAX::get_endpoint( DGWT_WCAS_SEARCH_ACTION ),
31
- 'ajax_details_endpoint' => \WC_AJAX::get_endpoint( DGWT_WCAS_RESULT_DETAILS_ACTION ),
32
- 'action_search' => DGWT_WCAS_SEARCH_ACTION,
33
- 'action_result_details' => DGWT_WCAS_RESULT_DETAILS_ACTION,
34
- 'min_chars' => 3,
35
- 'width' => 'auto',
36
- 'show_details_box' => false,
37
- 'show_images' => false,
38
- 'show_price' => false,
39
- 'show_desc' => false,
40
- 'show_sale_badge' => false,
41
- 'show_featured_badge' => false,
42
- 'is_rtl' => ( is_rtl() == true ? true : false ),
43
- 'show_preloader' => false,
44
- 'show_headings' => false,
45
- 'preloader_url' => '',
46
- 'taxonomy_brands' => '',
47
- 'img_url' => DGWT_WCAS_URL . 'assets/img/',
48
- 'is_premium' => ( dgoraAsfwFs()->is_premium() ? true : false ),
49
- 'overlay_mobile' => ( DGWT_WCAS()->settings->getOption( 'enable_mobile_overlay' ) === 'on' ? true : false ),
50
- 'mobile_breakpoint' => apply_filters( 'dgwt/wcas/scripts/mobile_breakpoint', 992 ),
51
- 'mobile_overlay_wrapper' => apply_filters( 'dgwt/wcas/scripts/mobile_overlay_wrapper', 'body' ),
52
- 'debounce_wait_ms' => apply_filters( 'dgwt/wcas/scripts/debounce_wait_ms', 400 ),
53
- 'send_ga_events' => apply_filters( 'dgwt/wcas/scripts/send_ga_events', true ),
54
- 'magnifier_icon' => Helpers::getMagnifierIco( '' ),
55
- );
56
- if ( Multilingual::isMultilingual() ) {
57
- $localize['current_lang'] = Multilingual::getCurrentLanguage();
58
- }
59
- // Min characters
60
- $min_chars = DGWT_WCAS()->settings->getOption( 'min_chars' );
61
- if ( !empty($min_chars) && is_numeric( $min_chars ) ) {
62
- $localize['min_chars'] = absint( $min_chars );
63
- }
64
- $sug_width = DGWT_WCAS()->settings->getOption( 'sug_width' );
65
- if ( !empty($sug_width) && is_numeric( $sug_width ) && $sug_width > 100 ) {
66
- $localize['sug_width'] = absint( $sug_width );
67
- }
68
- // Show/hide Details panel
69
- if ( DGWT_WCAS()->settings->getOption( 'show_details_box' ) === 'on' ) {
70
- $localize['show_details_box'] = true;
71
- }
72
- // Show/hide images
73
- if ( DGWT_WCAS()->settings->getOption( 'show_product_image' ) === 'on' ) {
74
- $localize['show_images'] = true;
75
- }
76
- // Show/hide price
77
- if ( DGWT_WCAS()->settings->getOption( 'show_product_price' ) === 'on' ) {
78
- $localize['show_price'] = true;
79
- }
80
- // Show/hide description
81
- if ( DGWT_WCAS()->settings->getOption( 'show_product_desc' ) === 'on' ) {
82
- $localize['show_desc'] = true;
83
- }
84
- // Show/hide description
85
- if ( DGWT_WCAS()->settings->getOption( 'show_product_sku' ) === 'on' ) {
86
- $localize['show_sku'] = true;
87
- }
88
- // Show/hide sale badge
89
- if ( DGWT_WCAS()->settings->getOption( 'show_sale_badge' ) === 'on' ) {
90
- $localize['show_sale_badge'] = true;
91
- }
92
- // Show/hide featured badge
93
- if ( DGWT_WCAS()->settings->getOption( 'show_featured_badge' ) === 'on' ) {
94
- $localize['show_featured_badge'] = true;
95
- }
96
- // Set preloader
97
-
98
- if ( DGWT_WCAS()->settings->getOption( 'show_preloader' ) === 'on' ) {
99
- $localize['show_preloader'] = true;
100
- $localize['preloader_url'] = esc_url( trim( DGWT_WCAS()->settings->getOption( 'preloader_url' ) ) );
101
- }
102
-
103
- // Show/hide autocomplete headings
104
- if ( DGWT_WCAS()->settings->getOption( 'show_grouped_results' ) === 'on' ) {
105
- $localize['show_headings'] = true;
106
- }
107
- $min = ( !DGWT_WCAS_DEBUG ? '.min' : '' );
108
- wp_register_script(
109
- 'jquery-dgwt-wcas',
110
- apply_filters( 'dgwt/wcas/scripts/js_url', DGWT_WCAS_URL . 'assets/js/search' . $min . '.js' ),
111
- array( 'jquery' ),
112
- DGWT_WCAS_VERSION,
113
- true
114
- );
115
- $localize = apply_filters( 'dgwt/wcas/scripts/localize', $localize );
116
- wp_localize_script( 'jquery-dgwt-wcas', 'dgwt_wcas', $localize );
117
- }
118
-
119
- }
120
-
121
- /**
122
- * Register and enqueue style
123
- * Uses a WP hook wp_print_styles
124
- *
125
- * @return void
126
- */
127
- public function cssStyle()
128
- {
129
- // Main CSS
130
  $min = ( !DGWT_WCAS_DEBUG ? '.min' : '' );
 
131
  wp_register_style(
132
  'dgwt-wcas-style',
133
  apply_filters( 'dgwt/wcas/scripts/css_style_url', DGWT_WCAS_URL . 'assets/css/style' . $min . '.css' ),
134
  array(),
135
  DGWT_WCAS_VERSION
136
  );
 
 
 
 
 
 
 
 
137
  wp_enqueue_style( 'dgwt-wcas-style' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  }
139
 
140
  }
2
 
3
  namespace DgoraWcas;
4
 
5
+ use DgoraWcas\Integrations\Solver ;
6
  // Exit if accessed directly
7
  if ( !defined( 'ABSPATH' ) ) {
8
  exit;
11
  {
12
  public function __construct()
13
  {
14
+ add_action( 'wp_enqueue_scripts', array( $this, 'loadScripts' ) );
 
15
  }
16
 
17
  /**
18
+ * Loads scripts and styles
19
  * Uses a WP hook wp_enqueue_scripts
20
  *
21
  * @return void
22
  */
23
+ public function loadScripts()
24
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  $min = ( !DGWT_WCAS_DEBUG ? '.min' : '' );
26
+ //Register
27
  wp_register_style(
28
  'dgwt-wcas-style',
29
  apply_filters( 'dgwt/wcas/scripts/css_style_url', DGWT_WCAS_URL . 'assets/css/style' . $min . '.css' ),
30
  array(),
31
  DGWT_WCAS_VERSION
32
  );
33
+ wp_register_script(
34
+ 'jquery-dgwt-wcas',
35
+ apply_filters( 'dgwt/wcas/scripts/js_url', DGWT_WCAS_URL . 'assets/js/search' . $min . '.js' ),
36
+ array( 'jquery' ),
37
+ DGWT_WCAS_VERSION,
38
+ true
39
+ );
40
+ // Enqueue
41
  wp_enqueue_style( 'dgwt-wcas-style' );
42
+ $layout = Helpers::getLayoutSettings();
43
+ // Localize
44
+ $localize = array(
45
+ 'labels' => Helpers::getLabels(),
46
+ 'ajax_search_endpoint' => \WC_AJAX::get_endpoint( DGWT_WCAS_SEARCH_ACTION ),
47
+ 'ajax_details_endpoint' => \WC_AJAX::get_endpoint( DGWT_WCAS_RESULT_DETAILS_ACTION ),
48
+ 'ajax_prices_endpoint' => \WC_AJAX::get_endpoint( DGWT_WCAS_GET_PRICES_ACTION ),
49
+ 'action_search' => DGWT_WCAS_SEARCH_ACTION,
50
+ 'action_result_details' => DGWT_WCAS_RESULT_DETAILS_ACTION,
51
+ 'action_get_prices' => DGWT_WCAS_GET_PRICES_ACTION,
52
+ 'min_chars' => 3,
53
+ 'width' => 'auto',
54
+ 'show_details_box' => false,
55
+ 'show_images' => false,
56
+ 'show_price' => false,
57
+ 'show_desc' => false,
58
+ 'show_sale_badge' => false,
59
+ 'show_featured_badge' => false,
60
+ 'dynamic_prices' => false,
61
+ 'is_rtl' => ( is_rtl() == true ? true : false ),
62
+ 'show_preloader' => false,
63
+ 'show_headings' => false,
64
+ 'preloader_url' => '',
65
+ 'taxonomy_brands' => '',
66
+ 'img_url' => DGWT_WCAS_URL . 'assets/img/',
67
+ 'is_premium' => ( dgoraAsfwFs()->is_premium() ? true : false ),
68
+ 'overlay_mobile' => $layout->mobile_overlay,
69
+ 'mobile_breakpoint' => $layout->breakpoint,
70
+ 'mobile_overlay_wrapper' => $layout->mobile_overlay_wrapper,
71
+ 'debounce_wait_ms' => apply_filters( 'dgwt/wcas/scripts/debounce_wait_ms', 400 ),
72
+ 'send_ga_events' => apply_filters( 'dgwt/wcas/scripts/send_ga_events', true ),
73
+ 'magnifier_icon' => Helpers::getMagnifierIco( '' ),
74
+ 'custom_params' => (object) apply_filters( 'dgwt/wcas/scripts/custom_params', array() ),
75
+ );
76
+ if ( Multilingual::isMultilingual() ) {
77
+ $localize['current_lang'] = Multilingual::getCurrentLanguage();
78
+ }
79
+ // Min characters
80
+ $min_chars = DGWT_WCAS()->settings->getOption( 'min_chars' );
81
+ if ( !empty($min_chars) && is_numeric( $min_chars ) ) {
82
+ $localize['min_chars'] = absint( $min_chars );
83
+ }
84
+ $sug_width = DGWT_WCAS()->settings->getOption( 'sug_width' );
85
+ if ( !empty($sug_width) && is_numeric( $sug_width ) && $sug_width > 100 ) {
86
+ $localize['sug_width'] = absint( $sug_width );
87
+ }
88
+ // Show/hide Details panel
89
+ if ( DGWT_WCAS()->settings->getOption( 'show_details_box' ) === 'on' ) {
90
+ $localize['show_details_box'] = true;
91
+ }
92
+ // Show/hide images
93
+ if ( DGWT_WCAS()->settings->getOption( 'show_product_image' ) === 'on' ) {
94
+ $localize['show_images'] = true;
95
+ }
96
+ // Show/hide price
97
+ if ( DGWT_WCAS()->settings->getOption( 'show_product_price' ) === 'on' ) {
98
+ $localize['show_price'] = true;
99
+ }
100
+ // Show/hide description
101
+ if ( DGWT_WCAS()->settings->getOption( 'show_product_desc' ) === 'on' ) {
102
+ $localize['show_desc'] = true;
103
+ }
104
+ // Show/hide description
105
+ if ( DGWT_WCAS()->settings->getOption( 'show_product_sku' ) === 'on' ) {
106
+ $localize['show_sku'] = true;
107
+ }
108
+ // Show/hide sale badge
109
+ if ( DGWT_WCAS()->settings->getOption( 'show_sale_badge' ) === 'on' ) {
110
+ $localize['show_sale_badge'] = true;
111
+ }
112
+ // Show/hide featured badge
113
+ if ( DGWT_WCAS()->settings->getOption( 'show_featured_badge' ) === 'on' ) {
114
+ $localize['show_featured_badge'] = true;
115
+ }
116
+ // Set preloader
117
+
118
+ if ( DGWT_WCAS()->settings->getOption( 'show_preloader' ) === 'on' ) {
119
+ $localize['show_preloader'] = true;
120
+ $localize['preloader_url'] = esc_url( trim( DGWT_WCAS()->settings->getOption( 'preloader_url' ) ) );
121
+ }
122
+
123
+ // Show/hide autocomplete headings
124
+ if ( DGWT_WCAS()->settings->getOption( 'show_grouped_results' ) === 'on' ) {
125
+ $localize['show_headings'] = true;
126
+ }
127
+ $localize = apply_filters( 'dgwt/wcas/scripts/localize', $localize );
128
+ wp_localize_script( 'jquery-dgwt-wcas', 'dgwt_wcas', $localize );
129
  }
130
 
131
  }
includes/Settings.php CHANGED
@@ -2,16 +2,14 @@
2
 
3
  namespace DgoraWcas;
4
 
5
- use DgoraWcas\Admin\Promo\Upgrade;
6
- use DgoraWcas\Admin\SettingsAPI;
7
- use DgoraWcas\Engines\TNTSearchMySQL\Indexer\Builder;
8
- use DgoraWcas\Engines\TNTSearchMySQL\Indexer\Scheduler;
9
-
10
  // Exit if accessed directly
11
- if ( ! defined('ABSPATH')) {
12
  exit;
13
  }
14
-
15
  /**
16
  * Settings API data
17
  */
@@ -21,59 +19,55 @@ class Settings
21
  * Unique settings slug
22
  * @var string
23
  */
24
- private $settingSlug = DGWT_WCAS_SETTINGS_KEY;
25
-
26
  /**
27
  * All options values in one array
28
  * @var array
29
  */
30
- public $opt;
31
-
32
  /**
33
  * Settings API object
34
  * @var object
35
  */
36
- public $settingsApi;
37
-
38
  /**
39
  * Check if user can see advanced settings
40
  * @var object
41
  */
42
- public $canSeeAdvSettings = null;
43
-
44
  /**
45
  * Settings defaults
46
  * @var array
47
  */
48
- public $defaults = array();
49
-
50
  /**
51
  * Settings cache
52
  * @var array
53
  */
54
- private $settingsCache = array();
55
-
56
  public function __construct()
57
  {
58
- global $dgwtWcasSettings;
59
-
60
  // Set global variable with settings
61
- $settings = get_option($this->settingSlug);
62
- if ( ! isset($settings) || empty($settings)) {
 
63
  $dgwtWcasSettings = array();
64
  } else {
65
  $dgwtWcasSettings = $settings;
66
  }
67
-
68
- $this->settingsApi = new SettingsAPI($this->settingSlug);
69
-
70
- add_action('admin_init', array($this, 'settingsInit'));
71
-
72
- add_filter('dgwt/wcas/settings/option_value', array($this, 'restoreDefaultValueForFreePlan'), 10, 3);
73
-
74
- add_action('wp_ajax_dgwt_wcas_adv_settings', array($this, 'toggleAdvancedSettings'));
 
 
75
  }
76
-
77
  /**
78
  * Set sections and fields
79
  *
@@ -81,68 +75,58 @@ class Settings
81
  */
82
  public function settingsInit()
83
  {
84
-
85
  //Set the settings
86
- $this->settingsApi->set_sections($this->settings_sections());
87
- $this->settingsApi->set_fields($this->settingsFields());
88
-
89
  //Initialize settings
90
  $this->settingsApi->settings_init();
91
  }
92
-
93
  /*
94
  * Set settings sections
95
  *
96
  * @return array settings sections
97
  */
98
-
99
  public function settings_sections()
100
  {
101
-
102
  $sections = array(
103
  5 => array(
104
- 'id' => 'dgwt_wcas_basic',
105
- 'title' => __('Starting', 'ajax-search-for-woocommerce')
106
- ),
107
  10 => array(
108
- 'id' => 'dgwt_wcas_form_body',
109
- 'title' => __('Search bar', 'ajax-search-for-woocommerce')
110
- ),
111
  15 => array(
112
- 'id' => 'dgwt_wcas_autocomplete',
113
- 'title' => __('Autocomplete', 'ajax-search-for-woocommerce')
114
- ),
115
  25 => array(
116
- 'id' => 'dgwt_wcas_search',
117
- 'title' => __('Search config', 'ajax-search-for-woocommerce')
118
- )
119
  );
120
-
121
- if (dgoraAsfwFs()->is_premium()) {
122
  $sections[30] = array(
123
  'id' => 'dgwt_wcas_performance',
124
- 'title' => __('Indexer', 'ajax-search-for-woocommerce')
125
  );
126
  } else {
127
  $sections[30] = array(
128
  'id' => 'dgwt_wcas_performance',
129
- 'title' => Helpers::getSettingsProLabel(
130
- __('Increase sales', 'ajax-search-for-woocommerce'),
131
- 'header',
132
- __('by simple tricks', 'ajax-search-for-woocommerce')
133
- )
134
  );
135
  }
136
-
137
-
138
- $sections = apply_filters('dgwt_wcas_settings_sections', $sections); // deprecated since v1.2.0
139
- $sections = apply_filters('dgwt/wcas/settings/sections', $sections);
140
-
141
- ksort($sections);
142
-
143
  return $sections;
144
  }
145
-
146
  /**
147
  * Create settings fields
148
  *
@@ -151,582 +135,533 @@ class Settings
151
  function settingsFields()
152
  {
153
  $settingsFields = array(
154
- 'dgwt_wcas_basic' => apply_filters('dgwt/wcas/settings/section=basic', array(
155
- 90 => array(
156
- 'name' => 'embedding_search_form_head',
157
- 'label' => __('How to add search bar in your theme?', 'ajax-search-for-woocommerce'),
158
- 'type' => 'head',
159
- 'class' => 'dgwt-wcas-sgs-header'
160
- ),
161
- 100 => array(
162
- 'name' => 'how_to_use',
163
- 'label' => __('How to add?', 'ajax-search-for-woocommerce'),
164
- 'type' => 'desc',
165
- 'class' => 'dgwt-wcas-only-desc',
166
- 'desc' => Helpers::howToUseHtml(),
167
- ),
168
- )),
169
- 'dgwt_wcas_form_body' => apply_filters('dgwt/wcas/settings/section=form', array(
170
- array(
171
- 'name' => 'form_head',
172
- 'label' => __('Basic', 'ajax-search-for-woocommerce'),
173
- 'type' => 'head',
174
- 'class' => 'dgwt-wcas-sgs-header'
175
- ),
176
- array(
177
- 'name' => 'min_chars',
178
- 'label' => __('Minimum characters', 'ajax-search-for-woocommerce'),
179
- 'type' => 'number',
180
- 'size' => 'small',
181
- 'class' => 'js-dgwt-wcas-adv-settings',
182
- 'desc' => __('Min characters to show autocomplete', 'ajax-search-for-woocommerce'),
183
- 'default' => 3,
184
- ),
185
- array(
186
- 'name' => 'max_form_width',
187
- 'label' => __('Max form width', 'ajax-search-for-woocommerce'),
188
- 'type' => 'number',
189
- 'size' => 'small',
190
- 'desc' => ' px. ' . __('To set 100% width leave blank', 'ajax-search-for-woocommerce'),
191
- 'class' => 'js-dgwt-wcas-adv-settings',
192
- 'default' => 600,
193
- ),
194
- array(
195
- 'name' => 'show_submit_button',
196
- 'label' => __('Show submit button', 'ajax-search-for-woocommerce'),
197
- 'type' => 'checkbox',
198
- 'class' => 'dgwt-wcas-options-cb-toggle js-dgwt-wcas-cbtgroup-submit-btn',
199
- 'size' => 'small',
200
- 'default' => 'off',
201
- ),
202
- array(
203
- 'name' => 'search_submit_text',
204
- 'label' => __('Submit label', 'ajax-search-for-woocommerce') . ' ' . Helpers::createQuestionMark('search-submit-text', __('To display the magnifier icon leave this field empty.', 'ajax-search-for-woocommerce')),
205
- 'type' => 'text',
206
- 'class' => 'js-dgwt-wcas-cbtgroup-submit-btn',
207
- 'default' => __('Search', 'ajax-search-for-woocommerce'),
208
- ),
209
- array(
210
- 'name' => 'search_placeholder',
211
- 'label' => __('Search input placeholder', 'ajax-search-for-woocommerce'),
212
- 'type' => 'text',
213
- 'default' => __('Search for products...', 'ajax-search-for-woocommerce'),
214
- ),
215
- array(
216
- 'name' => 'search_form',
217
- 'label' => __('Search form colors', 'ajax-search-for-woocommerce'),
218
- 'type' => 'head',
219
- 'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings',
220
- ),
221
- array(
222
- 'name' => 'bg_input_color',
223
- 'label' => __('Search input background', 'ajax-search-for-woocommerce'),
224
- 'type' => 'color',
225
- 'class' => 'js-dgwt-wcas-adv-settings',
226
- 'default' => '',
227
- ),
228
- array(
229
- 'name' => 'text_input_color',
230
- 'label' => __('Search input text', 'ajax-search-for-woocommerce'),
231
- 'type' => 'color',
232
- 'class' => 'js-dgwt-wcas-adv-settings',
233
- 'default' => '',
234
- ),
235
- array(
236
- 'name' => 'border_input_color',
237
- 'label' => __('Search input border', 'ajax-search-for-woocommerce'),
238
- 'type' => 'color',
239
- 'class' => 'js-dgwt-wcas-adv-settings',
240
- 'default' => '',
241
- ),
242
- array(
243
- 'name' => 'bg_submit_color',
244
- 'label' => __('Search submit background', 'ajax-search-for-woocommerce'),
245
- 'type' => 'color',
246
- 'class' => 'js-dgwt-wcas-adv-settings js-dgwt-wcas-cbtgroup-submit-btn',
247
- 'default' => '',
248
- ),
249
- array(
250
- 'name' => 'text_submit_color',
251
- 'label' => __('Search submit text', 'ajax-search-for-woocommerce'),
252
- 'type' => 'color',
253
- 'class' => 'js-dgwt-wcas-adv-settings js-dgwt-wcas-cbtgroup-submit-btn',
254
- 'default' => '',
255
- ),
256
- array(
257
- 'name' => 'mobile',
258
- 'label' => __('Mobile', 'ajax-search-for-woocommerce'),
259
- 'type' => 'head',
260
- 'class' => 'dgwt-wcas-sgs-header'
261
- ),
262
- array(
263
- 'name' => 'enable_mobile_overlay',
264
- 'label' => __('Overlay search (beta)', 'ajax-search-for-woocommerce'),
265
- 'desc' => __('Enhances user experience on mobile', 'ajax-search-for-woocommerce'),
266
- 'type' => 'checkbox',
267
- 'default' => function_exists('storefront_product_search') ? 'on' : 'off',
268
- ),
269
- array(
270
- 'name' => 'preloader_head',
271
- 'label' => __('Preloader', 'ajax-search-for-woocommerce'),
272
- 'type' => 'head',
273
- 'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings'
274
- ),
275
- array(
276
- 'name' => 'show_preloader',
277
- 'label' => __('Show preloader', 'ajax-search-for-woocommerce'),
278
- 'class' => 'dgwt-wcas-options-cb-toggle js-dgwt-wcas-cbtgroup-preloader js-dgwt-wcas-adv-settings',
279
- 'type' => 'checkbox',
280
- 'default' => 'on',
281
- ),
282
- array(
283
- 'name' => 'preloader_url',
284
- 'label' => __('Upload preloader image', 'ajax-search-for-woocommerce'),
285
- 'class' => 'js-dgwt-wcas-cbtgroup-preloader js-dgwt-wcas-adv-settings',
286
- 'type' => 'file',
287
- 'default' => '',
288
- )
289
- )),
290
- 'dgwt_wcas_autocomplete' => apply_filters('dgwt/wcas/settings/section=autocomplete', array(
291
- 20 => array(
292
- 'name' => 'autocomplete_head',
293
- 'label' => __('Basic', 'ajax-search-for-woocommerce'),
294
- 'type' => 'head',
295
- 'class' => 'dgwt-wcas-sgs-header'
296
- ),
297
- 50 => array(
298
- 'name' => 'suggestions_limit',
299
- 'label' => __('Limit', 'ajax-search-for-woocommerce'),
300
- 'type' => 'number',
301
- 'size' => 'small',
302
- 'desc' => __('Maximum number of suggestions', 'ajax-search-for-woocommerce'),
303
- 'default' => 7,
304
- ),
305
- 70 => array(
306
- 'name' => 'show_grouped_results',
307
- 'label' => __('Group results', 'ajax-search-for-woocommerce'),
308
- 'type' => 'checkbox',
309
- 'size' => 'small',
310
- 'default' => 'off',
311
- ),
312
- 80 => array(
313
- 'name' => 'search_no_results_text',
314
- 'label' => _x('No results label', 'admin', 'ajax-search-for-woocommerce'),
315
- 'type' => 'text',
316
- 'default' => __('No results', 'ajax-search-for-woocommerce'),
317
- ),
318
- 100 => array(
319
- 'name' => 'product_suggestion_head',
320
- 'label' => __('Products', 'ajax-search-for-woocommerce'),
321
- 'type' => 'head',
322
- 'class' => 'dgwt-wcas-sgs-header'
323
- ),
324
- 300 => array(
325
- 'name' => 'show_product_image',
326
- 'label' => __('Show product image', 'ajax-search-for-woocommerce'),
327
- 'type' => 'checkbox',
328
- 'default' => 'off',
329
- ),
330
- 400 => array(
331
- 'name' => 'show_product_price',
332
- 'label' => __('Show price', 'ajax-search-for-woocommerce'),
333
- 'type' => 'checkbox',
334
- 'default' => 'off',
335
- ),
336
- 500 => array(
337
- 'name' => 'show_product_desc',
338
- 'label' => __('Show product description', 'ajax-search-for-woocommerce'),
339
- 'type' => 'checkbox',
340
- 'default' => 'off',
341
- ),
342
- 600 => array(
343
- 'name' => 'show_product_sku',
344
- 'label' => __('Show SKU', 'ajax-search-for-woocommerce'),
345
- 'type' => 'checkbox',
346
- 'default' => 'off',
347
- ),
348
- // 700 => array(
349
- // 'name' => 'show_sale_badge',
350
- // 'label' => __( 'Show sale badge', 'ajax-search-for-woocommerce' ),
351
- // 'type' => 'checkbox',
352
- // 'default' => 'off',
353
- // ),
354
- // 800 => array(
355
- // 'name' => 'show_featured_badge',
356
- // 'label' => __( 'Show featured badge', 'ajax-search-for-woocommerce' ),
357
- // 'type' => 'checkbox',
358
- // 'default' => 'off',
359
- // ),
360
- 900 => array(
361
- 'name' => 'search_see_all_results_text',
362
- 'label' => __('More results label', 'ajax-search-for-woocommerce'),
363
- 'type' => 'text',
364
- 'default' => __('See all products...', 'ajax-search-for-woocommerce'),
365
- ),
366
- 1000 => array(
367
- 'name' => 'non_products_in_autocomplete_head',
368
- 'label' => __('Non-Products in autocomplete', 'ajax-search-for-woocommerce'),
369
- 'type' => 'head',
370
- 'class' => 'dgwt-wcas-sgs-header'
371
- ),
372
- 1100 => array(
373
- 'name' => 'show_matching_categories',
374
- 'label' => __('Show categories', 'ajax-search-for-woocommerce'),
375
- 'type' => 'checkbox',
376
- 'class' => 'js-dgwt-wcas-settings-margin',
377
- 'default' => 'on',
378
- ),
379
- 1300 => array(
380
- 'name' => 'show_matching_tags',
381
- 'label' => __('Show tags', 'ajax-search-for-woocommerce'),
382
- 'type' => 'checkbox',
383
- 'class' => 'js-dgwt-wcas-settings-margin',
384
- 'default' => 'off',
385
- ),
386
- 1600 => array(
387
- 'name' => 'show_matching_posts',
388
- 'label' => __('Show posts', 'ajax-search-for-woocommerce'),
389
- 'type' => 'checkbox',
390
- 'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
391
- 'default' => 'off',
392
- ),
393
- 1800 => array(
394
- 'name' => 'show_matching_pages',
395
- 'label' => __('Show pages', 'ajax-search-for-woocommerce'),
396
- 'type' => 'checkbox',
397
- 'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
398
- 'default' => 'off',
399
- ),
400
- 2000 => array(
401
- 'name' => 'details_box_head',
402
- 'label' => __('Details panel', 'ajax-search-for-woocommerce'),
403
- 'type' => 'head',
404
- 'class' => 'dgwt-wcas-sgs-header'
405
- ),
406
- 2100 => array(
407
- 'name' => 'show_details_box',
408
- 'label' => __('Show Details panel', 'ajax-search-for-woocommerce') . ' ' . Helpers::createQuestionMark('details-box', __('The Details panel is an additional container for extended information. The details are changed dynamically when a user mouse over one of the suggestions.', 'ajax-search-for-woocommerce')),
409
- 'type' => 'checkbox',
410
- 'size' => 'small',
411
- // 'class' => 'dgwt-wcas-options-cb-toggle js-dgwt-wcas-cbtgroup-details-box',
412
- 'default' => 'off',
413
- ),
414
- // 2200 => array(
415
- // 'name' => 'show_for_tax',
416
- // 'label' => __('Products list', 'ajax-search-for-woocommerce'),
417
- // 'type' => 'select',
418
- // 'desc' => __('Applies only to archives suggestions type', 'ajax-search-for-woocommerce'),
419
- // 'options' => array(
420
- // 'all' => __('All Product', 'ajax-search-for-woocommerce'),
421
- // 'featured' => __('Featured Products', 'ajax-search-for-woocommerce'),
422
- // 'onsale' => __('On-sale Products', 'ajax-search-for-woocommerce'),
423
- // ),
424
- // 'class' => 'js-dgwt-wcas-cbtgroup-details-box js-dgwt-wcas-adv-settings',
425
- // 'default' => 'on',
426
- // ),
427
- // 2300 => array(
428
- // 'name' => 'orderby_for_tax',
429
- // 'label' => __('Order by', 'ajax-search-for-woocommerce'),
430
- // 'type' => 'select',
431
- // 'class' => 'js-dgwt-wcas-cbtgroup-details-box js-dgwt-wcas-adv-settings',
432
- // 'desc' => __('Applies only to category or tags suggestions type', 'ajax-search-for-woocommerce'),
433
- // 'options' => array(
434
- // 'date' => __('Date', 'ajax-search-for-woocommerce'),
435
- // 'price' => __('Price', 'ajax-search-for-woocommerce'),
436
- // 'rand' => __('Random', 'ajax-search-for-woocommerce'),
437
- // 'sales' => __('Sales', 'ajax-search-for-woocommerce'),
438
- // ),
439
- // 'default' => 'on',
440
- // ),
441
- // 2400 => array(
442
- // 'name' => 'order_for_tax',
443
- // 'label' => __('Order', 'ajax-search-for-woocommerce'),
444
- // 'type' => 'select',
445
- // 'class' => 'js-dgwt-wcas-cbtgroup-details-box js-dgwt-wcas-adv-settings',
446
- // 'desc' => __('Applies only to category or tags suggestions type', 'ajax-search-for-woocommerce'),
447
- // 'options' => array(
448
- // 'desc' => __('DESC', 'ajax-search-for-woocommerce'),
449
- // 'asc' => __('ASC', 'ajax-search-for-woocommerce'),
450
- // ),
451
- // 'default' => 'desc',
452
- // ),
453
- 2500 => array(
454
- 'name' => 'suggestions_style_head',
455
- 'label' => __('Suggestions colors', 'ajax-search-for-woocommerce'),
456
- 'type' => 'head',
457
- 'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings'
458
- ),
459
- 2600 => array(
460
- 'name' => 'sug_bg_color',
461
- 'label' => __('Suggestion background', 'ajax-search-for-woocommerce'),
462
- 'type' => 'color',
463
- 'class' => 'js-dgwt-wcas-adv-settings',
464
- 'default' => '',
465
- ),
466
- 2700 => array(
467
- 'name' => 'sug_hover_color',
468
- 'label' => __('Suggestion selected', 'ajax-search-for-woocommerce'),
469
- 'type' => 'color',
470
- 'class' => 'js-dgwt-wcas-adv-settings',
471
- 'default' => '',
472
- ),
473
- 2800 => array(
474
- 'name' => 'sug_text_color',
475
- 'label' => __('Text color', 'ajax-search-for-woocommerce'),
476
- 'type' => 'color',
477
- 'class' => 'js-dgwt-wcas-adv-settings',
478
- 'default' => '',
479
- ),
480
- 2900 => array(
481
- 'name' => 'sug_highlight_color',
482
- 'label' => __('Highlight color', 'ajax-search-for-woocommerce'),
483
- 'type' => 'color',
484
- 'class' => 'js-dgwt-wcas-adv-settings',
485
- 'default' => '',
486
- ),
487
- 3000 => array(
488
- 'name' => 'sug_border_color',
489
- 'label' => __('Border color', 'ajax-search-for-woocommerce'),
490
- 'type' => 'color',
491
- 'class' => 'js-dgwt-wcas-adv-settings',
492
- 'default' => '',
493
- )
494
- )),
495
- 'dgwt_wcas_search' => apply_filters('dgwt/wcas/settings/section=search', array(
496
- 10 => array(
497
- 'name' => 'search_search_head',
498
- 'label' => __('Products search scope', 'ajax-search-for-woocommerce'),
499
- 'type' => 'head',
500
- 'class' => 'dgwt-wcas-sgs-header'
501
- ),
502
- 50 => array(
503
- 'name' => 'search_in_product_content',
504
- 'label' => __('Search in description', 'ajax-search-for-woocommerce'),
505
- 'type' => 'checkbox',
506
- 'default' => 'off',
507
- ),
508
- 100 => array(
509
- 'name' => 'search_in_product_excerpt',
510
- 'label' => __('Search in short description', 'ajax-search-for-woocommerce'),
511
- 'type' => 'checkbox',
512
- 'default' => 'off',
513
- ),
514
- 150 => array(
515
- 'name' => 'search_in_product_sku',
516
- 'label' => __('Search in SKU', 'ajax-search-for-woocommerce'),
517
- 'type' => 'checkbox',
518
- 'desc' => dgoraAsfwFs()->is_premium() ? __('Searching also in variable products SKU',
519
- 'ajax-search-for-woocommerce') : sprintf(__('Searching in variable products SKU is available only in <a href="%s">the pro version</a>.',
520
- 'ajax-search-for-woocommerce'), Upgrade::getUpgradeUrl()),
521
- 'default' => 'off',
522
- ),
523
- 200 => array(
524
- 'name' => 'search_in_product_attributes',
525
- 'label' => __('Search in attributes', 'ajax-search-for-woocommerce'),
526
- 'class' => 'dgwt-wcas-premium-only',
527
- 'type' => 'checkbox',
528
- 'default' => 'off',
529
- ),
530
- 250 => array(
531
- 'name' => 'search_in_product_categories',
532
- 'label' => __('Search in categories', 'ajax-search-for-woocommerce'),
533
- 'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
534
- 'type' => 'checkbox',
535
- 'default' => 'off',
536
- ),
537
- 275 => array(
538
- 'name' => 'search_in_product_tags',
539
- 'label' => __('Search in tags', 'ajax-search-for-woocommerce'),
540
- 'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
541
- 'type' => 'checkbox',
542
- 'default' => 'off',
543
- ),
544
- 300 => array(
545
- 'name' => 'search_in_custom_fields',
546
- 'label' => __('Search in custom fields', 'ajax-search-for-woocommerce'),
547
- 'class' => 'dgwt-wcas-premium-only',
548
- 'type' => 'text',
549
- 'default' => '',
550
- ),
551
- 350 => array(
552
- 'name' => 'exclude_out_of_stock',
553
- 'label' => __("Exclude 'out of stock' products", 'ajax-search-for-woocommerce'),
554
- 'type' => 'checkbox',
555
- 'default' => 'off',
556
- ),
557
- 400 => array(
558
- 'name' => 'search_scope_fuzziness_head',
559
- 'label' => __('Fuzziness', 'ajax-search-for-woocommerce'),
560
- 'type' => 'head',
561
- 'class' => 'dgwt-wcas-sgs-header'
562
- ),
563
- 500 => array(
564
- 'name' => 'search_synonyms_head',
565
- 'label' => __('Synonyms', 'ajax-search-for-woocommerce'),
566
- 'type' => 'head',
567
- 'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings'
568
- ),
569
- 520 => array(
570
- 'name' => 'search_synonyms',
571
- 'label' => __('Synonyms', 'ajax-search-for-woocommerce') . ' ' . Helpers::createQuestionMark('synonyms', __("Synonyms feature allows your users to find more relevant results. If your products have alternative names and users often misspelling them, consider adding synonyms.", 'ajax-search-for-woocommerce')),
572
- 'type' => 'textarea',
573
- 'desc' => __('Synonyms should be separated by a comma. Each new synonyms group in the new line. You can use a phrase instead of a single word. <br /> <br />Sample list:<br /> <br /><span class="dgwt-wcas-synonyms-sample">sofa, couch, davenport, divan, settee<br />big, grand, great, large, outsize</span>', 'ajax-search-for-woocommerce'),
574
- 'class' => 'dgwt-wcas-settings-synonyms js-dgwt-wcas-adv-settings dgwt-wcas-premium-only'
575
- ),
576
- )),
577
- 'dgwt_wcas_performance' => apply_filters('dgwt/wcas/settings/section=performance', array(
578
- 0 => array(
579
- 'name' => 'pro_features',
580
- 'label' => __('Pro features', 'ajax-search-for-woocommerce'),
581
- 'type' => 'desc',
582
- 'desc' => Helpers::featuresHtml(),
583
- ),
584
- 10 => array(
585
- 'name' => 'search_engine_head',
586
- 'label' => __('Speed up search!', 'ajax-search-for-woocommerce'),
587
- 'type' => 'head',
588
- 'class' => 'dgwt-wcas-sgs-header'
589
- ),
590
-
591
- 100 => array(
592
- 'name' => 'indexer_schedule_head',
593
- 'label' => __('Scheduling Indexing', 'ajax-search-for-woocommerce'),
594
- 'type' => 'head',
595
- 'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings'
596
- ),
597
- 110 => array(
598
- 'name' => 'indexer_schedule',
599
- 'label' => __('Enable Scheduler', 'ajax-search-for-woocommerce') . ' ' . Helpers::createQuestionMark('indexer-schedule', __("I most cases you don't need to use the scheduler because The search index is updating when you edit products. If you use import tools or custom code to refresh prices or bulk add/edit products, the indexing scheduler will be helpful.", 'ajax-search-for-woocommerce')),
600
- 'type' => 'checkbox',
601
- 'size' => 'small',
602
- 'class' => 'dgwt-wcas-options-cb-toggle js-dgwt-wcas-cbtgroup-indexer-schedule js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
603
- 'default' => 'off',
604
- ),
605
- 120 => array(
606
- 'name' => 'indexer_schedule_interval',
607
- 'label' => __('Interval', 'ajax-search-for-woocommerce'),
608
- 'type' => 'select',
609
- 'class' => 'js-dgwt-wcas-cbtgroup-indexer-schedule js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
610
- 'options' => array(
611
- 'daily' => __('Daily', 'ajax-search-for-woocommerce'),
612
- 'weekly' => __('Weekly', 'ajax-search-for-woocommerce'),
613
- ),
614
- 'default' => 'weekly',
615
- ),
616
- 130 => array(
617
- 'name' => 'indexer_schedule_start_time',
618
- 'label' => __('What time to rebuild the index?', 'ajax-search-for-woocommerce'),
619
- 'type' => 'select',
620
- 'class' => 'js-dgwt-wcas-cbtgroup-indexer-schedule js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
621
- 'options' => Helpers::getHours(),
622
- 'default' => 3,
623
- ),
624
- ))
625
  );
626
-
627
- $fuzzinesText1 = '<strong>' . __('Increases sales conversions', 'ajax-search-for-woocommerce') . '</strong>';
628
- $fuzzinesText2 = __('Returns suggestions based on likely relevance even though a search keyword may not exactly match. E.g if you type "ipho<b>m</b>e" you get the same results as for "iphone"', 'ajax-search-for-woocommerce');
629
-
630
- if (dgoraAsfwFs()->is_premium()) {
631
-
632
  $settingsFields['dgwt_wcas_search'][300] = array(
633
  'name' => 'search_in_custom_fields',
634
- 'label' => __('Search in custom fields', 'ajax-search-for-woocommerce'),
635
  'type' => 'selectize',
636
- 'options' => Helpers::isSettingsPage() ? Helpers::getSearchableCustomFields() : array(),
637
- 'desc' => __('Select the custom fields you want to add to the search scope', 'ajax-search-for-woocommerce'),
638
  );
639
-
640
  $settingsFields['dgwt_wcas_search'][450] = array(
641
  'name' => 'fuzziness_enabled',
642
- 'label' => __('Fuzzy matching', 'ajax-search-for-woocommerce'),
643
  'desc' => $fuzzinesText2,
644
  'class' => 'dgwt-wcas-premium-only',
645
  'type' => 'select',
646
  'options' => array(
647
- 'off' => __('-- Disabled', 'ajax-search-for-woocommerce'),
648
- 'soft' => __('Soft', 'ajax-search-for-woocommerce'),
649
- 'normal' => __('Normal', 'ajax-search-for-woocommerce'),
650
- 'hard' => __('Hard', 'ajax-search-for-woocommerce'),
651
- ),
652
  'default' => 'normal',
653
  );
654
-
655
- unset($settingsFields['dgwt_wcas_performance'][0]);
656
-
657
  } else {
658
  $settingsFields['dgwt_wcas_search'][450] = array(
659
  'name' => 'fuzziness_enabled_demo',
660
- 'label' => __('Fuzzy matching', 'ajax-search-for-woocommerce'),
661
  'desc' => $fuzzinesText1 . ' ' . $fuzzinesText2,
662
  'class' => 'dgwt-wcas-premium-only',
663
  'type' => 'select',
664
  'options' => array(
665
- 'off' => __('-- Disabled', 'ajax-search-for-woocommerce'),
666
- 'soft' => __('Soft', 'ajax-search-for-woocommerce'),
667
- 'normal' => __('Normal', 'ajax-search-for-woocommerce'),
668
- 'hard' => __('Hard', 'ajax-search-for-woocommerce'),
669
- ),
670
  'default' => 'off',
671
  );
672
-
673
  }
674
-
675
-
676
- if (dgoraAsfwFs()->is_premium()) {
677
-
678
  $settingsFields['dgwt_wcas_performance'][11] = array(
679
  'name' => 'search_engine_build',
680
- 'label' => __('Index status', 'ajax-search-for-woocommerce'),
681
  'type' => 'desc',
682
- 'desc' => Helpers::isSettingsPage() ? Builder::renderIndexingStatus() : '',
683
- 'class' => 'dgwt-wcas-premium-only wcas-opt-tntsearch'
684
  );
685
-
686
  $settingsFields['dgwt_wcas_performance'][110]['desc'] = Scheduler::nextTaskDescription();
687
-
688
  } else {
689
  $settingsFields['dgwt_wcas_performance'][11] = array(
690
  'name' => 'search_engine_build',
691
- 'label' => __('Index status', 'ajax-search-for-woocommerce'),
692
  'type' => 'desc',
693
  'desc' => Helpers::indexerDemoHtml(),
694
- 'class' => 'dgwt-wcas-premium-only wcas-opt-tntsearch'
695
  );
696
  }
697
-
698
- foreach ($settingsFields as $key => $sections) {
699
-
700
- foreach ($sections as $option) {
701
- if ( ! empty($option['name'])) {
702
- $this->defaults[$option['name']] = isset($option['default']) ? $option['default'] : '';
703
  }
704
  }
705
  }
706
-
707
- if ( ! dgoraAsfwFs()->is_premium()) {
708
-
709
-
710
- foreach ($settingsFields as $key => $sections) {
711
-
712
- foreach ($sections as $keyl2 => $option) {
713
- if (self::isOptionPremium($option)) {
714
-
715
- $settingsFields[$key][$keyl2]['label'] = Helpers::getSettingsProLabel($option['label'], 'option-label');
716
  }
717
  }
718
  }
719
  }
720
-
721
- $settingsFields = apply_filters('dgwt/wcas/settings', $settingsFields);
722
-
723
- foreach ($settingsFields as $key => $sections) {
724
- ksort($settingsFields[$key]);
725
  }
726
-
727
  return $settingsFields;
728
  }
729
-
730
  /*
731
  * Option value
732
  *
@@ -735,52 +670,47 @@ class Settings
735
  *
736
  * @return string
737
  */
738
-
739
- public function getOption($option_key, $default = '')
740
  {
741
-
742
  $value = '';
743
-
744
- if (is_string($option_key) && ! empty($option_key)) {
745
-
746
- if (!empty($this->settingsCache)) {
747
  $settings = $this->settingsCache;
748
  } else {
749
- $settings = get_option($this->settingSlug);
750
  }
751
-
752
- if ( ! empty($settings) && is_array($settings)) {
753
-
754
  $this->settingsCache = $settings;
755
-
756
- if (array_key_exists($option_key, $settings)) {
757
  $value = $settings[$option_key];
758
  } else {
759
-
760
  // Catch default
761
- if (empty($default)) {
762
- foreach ($this->defaults as $key => $defaultValue) {
763
- if ($key === $option_key) {
764
  $value = $defaultValue;
765
  }
766
  }
767
  }
768
-
769
  }
 
770
  }
771
-
772
  }
773
-
774
- if (empty($value) && ! empty($default)) {
775
  $value = $default;
776
  }
777
-
778
- $value = apply_filters('dgwt/wcas/settings/load_value', $value, $option_key);
779
- $value = apply_filters('dgwt/wcas/settings/load_value/key=' . $option_key, $value);
780
-
781
  return $value;
782
  }
783
-
784
  /*
785
  * Update option
786
  *
@@ -789,44 +719,38 @@ class Settings
789
  *
790
  * @return bool
791
  */
792
-
793
- public function updateOpt($optionKey, $value = '')
794
  {
795
-
796
  $updated = false;
797
-
798
- if (is_string($optionKey) && ! empty($optionKey)) {
799
-
800
- $settings = get_option($this->settingSlug);
801
-
802
- $value = apply_filters('dgwt/wcas/settings/update_value', $value, $optionKey);
803
- $value = apply_filters('dgwt/wcas/settings/update_value/key=' . $optionKey, $value);
804
-
805
  $canUpdate = false;
806
- if (array_key_exists($optionKey, $this->defaults)) {
 
807
  $settings[$optionKey] = $value;
808
- $canUpdate = true;
809
  }
810
-
811
- if ($canUpdate) {
812
- $updated = update_option($this->settingSlug, $settings);
813
  }
814
  }
815
-
816
  return $updated;
817
  }
818
-
819
  /**
820
  * Handles output of the settings
821
  */
822
  public static function output()
823
  {
824
-
825
  $settings = DGWT_WCAS()->settings->settingsApi;
826
-
827
  include_once DGWT_WCAS_DIR . 'partials/admin/settings.php';
828
  }
829
-
830
  /**
831
  * Restore default option value
832
  *
@@ -836,17 +760,16 @@ class Settings
836
  *
837
  * @return mixed
838
  */
839
- public function restoreDefaultValueForFreePlan($value, $default, $option)
840
  {
841
- if ( ! dgoraAsfwFs()->is_premium()) {
842
- if (self::isOptionPremium($option)) {
843
  $value = $default;
844
  }
845
  }
846
-
847
  return $value;
848
  }
849
-
850
  /**
851
  * Check if user can see advanced settings
852
  *
@@ -854,31 +777,29 @@ class Settings
854
  */
855
  public function canSeeAdvSettings()
856
  {
857
-
858
  $canSee = false;
859
-
860
- if (is_bool($this->canSeeAdvSettings)) {
861
  $canSee = $this->canSeeAdvSettings;
862
  } else {
863
-
864
- $settings = get_option('dgwt_wcas_settings_show_advanced');
865
-
866
- if ( ! empty($settings)) {
867
-
868
- if ($settings === 'on') {
869
  $canSee = true;
870
- } else if ($settings === 'off') {
871
  $canSee = false;
872
  }
873
-
874
  $this->canSeeAdvSettings = $canSee;
875
  }
876
-
877
  }
878
-
879
  return $canSee;
880
  }
881
-
882
  /**
883
  * Toggle visibility of advanced settings
884
  * Ajax endpoint
@@ -887,15 +808,11 @@ class Settings
887
  */
888
  public function toggleAdvancedSettings()
889
  {
890
-
891
- $show = ! empty($_GET['adv_settings_value']) && $_GET['adv_settings_value'] === 'show' ? 'on' : 'off';
892
-
893
- update_option('dgwt_wcas_settings_show_advanced', $show);
894
-
895
  wp_send_json_success();
896
-
897
  }
898
-
899
  /**
900
  * Check if a option is premium
901
  *
@@ -903,13 +820,12 @@ class Settings
903
  *
904
  * @return bool
905
  */
906
- public static function isOptionPremium($option)
907
  {
908
  $is_premium = false;
909
- if ( ! empty($option['class']) && strpos($option['class'], 'dgwt-wcas-premium-only') !== false) {
910
  $is_premium = true;
911
  }
912
-
913
  return $is_premium;
914
  }
915
 
2
 
3
  namespace DgoraWcas;
4
 
5
+ use DgoraWcas\Admin\Promo\Upgrade ;
6
+ use DgoraWcas\Admin\SettingsAPI ;
7
+ use DgoraWcas\Engines\TNTSearchMySQL\Indexer\Builder ;
8
+ use DgoraWcas\Engines\TNTSearchMySQL\Indexer\Scheduler ;
 
9
  // Exit if accessed directly
10
+ if ( !defined( 'ABSPATH' ) ) {
11
  exit;
12
  }
 
13
  /**
14
  * Settings API data
15
  */
19
  * Unique settings slug
20
  * @var string
21
  */
22
+ private $settingSlug = DGWT_WCAS_SETTINGS_KEY ;
 
23
  /**
24
  * All options values in one array
25
  * @var array
26
  */
27
+ public $opt ;
 
28
  /**
29
  * Settings API object
30
  * @var object
31
  */
32
+ public $settingsApi ;
 
33
  /**
34
  * Check if user can see advanced settings
35
  * @var object
36
  */
37
+ public $canSeeAdvSettings = null ;
 
38
  /**
39
  * Settings defaults
40
  * @var array
41
  */
42
+ public $defaults = array() ;
 
43
  /**
44
  * Settings cache
45
  * @var array
46
  */
47
+ private $settingsCache = array() ;
 
48
  public function __construct()
49
  {
50
+ global $dgwtWcasSettings ;
 
51
  // Set global variable with settings
52
+ $settings = get_option( $this->settingSlug );
53
+
54
+ if ( !isset( $settings ) || empty($settings) ) {
55
  $dgwtWcasSettings = array();
56
  } else {
57
  $dgwtWcasSettings = $settings;
58
  }
59
+
60
+ $this->settingsApi = new SettingsAPI( $this->settingSlug );
61
+ add_action( 'admin_init', array( $this, 'settingsInit' ) );
62
+ add_filter(
63
+ 'dgwt/wcas/settings/option_value',
64
+ array( $this, 'restoreDefaultValueForFreePlan' ),
65
+ 10,
66
+ 3
67
+ );
68
+ add_action( 'wp_ajax_dgwt_wcas_adv_settings', array( $this, 'toggleAdvancedSettings' ) );
69
  }
70
+
71
  /**
72
  * Set sections and fields
73
  *
75
  */
76
  public function settingsInit()
77
  {
 
78
  //Set the settings
79
+ $this->settingsApi->set_sections( $this->settings_sections() );
80
+ $this->settingsApi->set_fields( $this->settingsFields() );
 
81
  //Initialize settings
82
  $this->settingsApi->settings_init();
83
  }
84
+
85
  /*
86
  * Set settings sections
87
  *
88
  * @return array settings sections
89
  */
 
90
  public function settings_sections()
91
  {
 
92
  $sections = array(
93
  5 => array(
94
+ 'id' => 'dgwt_wcas_basic',
95
+ 'title' => __( 'Starting', 'ajax-search-for-woocommerce' ),
96
+ ),
97
  10 => array(
98
+ 'id' => 'dgwt_wcas_form_body',
99
+ 'title' => __( 'Search bar', 'ajax-search-for-woocommerce' ),
100
+ ),
101
  15 => array(
102
+ 'id' => 'dgwt_wcas_autocomplete',
103
+ 'title' => __( 'Autocomplete', 'ajax-search-for-woocommerce' ),
104
+ ),
105
  25 => array(
106
+ 'id' => 'dgwt_wcas_search',
107
+ 'title' => __( 'Search config', 'ajax-search-for-woocommerce' ),
108
+ ),
109
  );
110
+
111
+ if ( dgoraAsfwFs()->is_premium() ) {
112
  $sections[30] = array(
113
  'id' => 'dgwt_wcas_performance',
114
+ 'title' => __( 'Indexer', 'ajax-search-for-woocommerce' ),
115
  );
116
  } else {
117
  $sections[30] = array(
118
  'id' => 'dgwt_wcas_performance',
119
+ 'title' => Helpers::getSettingsProLabel( __( 'Increase sales', 'ajax-search-for-woocommerce' ), 'header', __( 'by simple tricks', 'ajax-search-for-woocommerce' ) ),
 
 
 
 
120
  );
121
  }
122
+
123
+ $sections = apply_filters( 'dgwt_wcas_settings_sections', $sections );
124
+ // deprecated since v1.2.0
125
+ $sections = apply_filters( 'dgwt/wcas/settings/sections', $sections );
126
+ ksort( $sections );
 
 
127
  return $sections;
128
  }
129
+
130
  /**
131
  * Create settings fields
132
  *
135
  function settingsFields()
136
  {
137
  $settingsFields = array(
138
+ 'dgwt_wcas_basic' => apply_filters( 'dgwt/wcas/settings/section=basic', array(
139
+ 90 => array(
140
+ 'name' => 'embedding_search_form_head',
141
+ 'label' => __( 'How to add search bar in your theme?', 'ajax-search-for-woocommerce' ),
142
+ 'type' => 'head',
143
+ 'class' => 'dgwt-wcas-sgs-header',
144
+ ),
145
+ 100 => array(
146
+ 'name' => 'how_to_use',
147
+ 'label' => __( 'How to add?', 'ajax-search-for-woocommerce' ),
148
+ 'type' => 'desc',
149
+ 'class' => 'dgwt-wcas-only-desc',
150
+ 'desc' => Helpers::howToUseHtml(),
151
+ ),
152
+ ) ),
153
+ 'dgwt_wcas_form_body' => apply_filters( 'dgwt/wcas/settings/section=form', array(
154
+ 100 => array(
155
+ 'name' => 'form_head',
156
+ 'label' => __( 'Basic', 'ajax-search-for-woocommerce' ),
157
+ 'type' => 'head',
158
+ 'class' => 'dgwt-wcas-sgs-header',
159
+ ),
160
+ 200 => array(
161
+ 'name' => 'min_chars',
162
+ 'label' => __( 'Minimum characters', 'ajax-search-for-woocommerce' ),
163
+ 'type' => 'number',
164
+ 'size' => 'small',
165
+ 'class' => 'js-dgwt-wcas-adv-settings',
166
+ 'desc' => __( 'Min characters to show autocomplete', 'ajax-search-for-woocommerce' ),
167
+ 'default' => 3,
168
+ ),
169
+ 300 => array(
170
+ 'name' => 'max_form_width',
171
+ 'label' => __( 'Max form width', 'ajax-search-for-woocommerce' ),
172
+ 'type' => 'number',
173
+ 'size' => 'small',
174
+ 'desc' => ' px. ' . __( 'To set 100% width leave blank', 'ajax-search-for-woocommerce' ),
175
+ 'class' => 'js-dgwt-wcas-adv-settings',
176
+ 'default' => 600,
177
+ ),
178
+ 400 => array(
179
+ 'name' => 'show_submit_button',
180
+ 'label' => __( 'Show submit button', 'ajax-search-for-woocommerce' ),
181
+ 'type' => 'checkbox',
182
+ 'class' => 'dgwt-wcas-options-cb-toggle js-dgwt-wcas-cbtgroup-submit-btn',
183
+ 'size' => 'small',
184
+ 'default' => 'off',
185
+ ),
186
+ 500 => array(
187
+ 'name' => 'search_submit_text',
188
+ 'label' => __( 'Submit label', 'ajax-search-for-woocommerce' ) . ' ' . Helpers::createQuestionMark( 'search-submit-text', __( 'To display the magnifier icon leave this field empty.', 'ajax-search-for-woocommerce' ) ),
189
+ 'type' => 'text',
190
+ 'class' => 'js-dgwt-wcas-cbtgroup-submit-btn',
191
+ 'default' => __( 'Search', 'ajax-search-for-woocommerce' ),
192
+ ),
193
+ 600 => array(
194
+ 'name' => 'search_placeholder',
195
+ 'label' => __( 'Search input placeholder', 'ajax-search-for-woocommerce' ),
196
+ 'type' => 'text',
197
+ 'default' => __( 'Search for products...', 'ajax-search-for-woocommerce' ),
198
+ ),
199
+ 630 => array(
200
+ 'name' => 'layout_head',
201
+ 'label' => __( 'Layout (beta)', 'ajax-search-for-woocommerce' ),
202
+ 'type' => 'head',
203
+ 'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings',
204
+ ),
205
+ 660 => array(
206
+ 'name' => 'search_layout',
207
+ 'label' => __( 'Layout', 'ajax-search-for-woocommerce' ),
208
+ 'type' => 'select',
209
+ 'options' => array(
210
+ 'classic' => __( 'Search bar only', 'ajax-search-for-woocommerce' ),
211
+ 'icon' => __( 'Search icon', 'ajax-search-for-woocommerce' ),
212
+ 'icon-flexible' => __( 'Icon on mobile, search bar on desktop', 'ajax-search-for-woocommerce' ),
213
+ ),
214
+ 'default' => 'classic',
215
+ 'class' => 'js-dgwt-wcas-adv-settings',
216
+ ),
217
+ 680 => array(
218
+ 'name' => 'enable_mobile_overlay',
219
+ 'label' => __( 'Overlay on mobile', 'ajax-search-for-woocommerce' ),
220
+ 'desc' => __( 'The search will open in overlay on mobile', 'ajax-search-for-woocommerce' ),
221
+ 'type' => 'checkbox',
222
+ 'default' => 'on',
223
+ 'class' => 'js-dgwt-wcas-adv-settings',
224
+ ),
225
+ 690 => array(
226
+ 'name' => 'mobile_breakpoint',
227
+ 'label' => __( 'Mobile breakpoint', 'ajax-search-for-woocommerce' ),
228
+ 'desc' => __( 'px', 'ajax-search-for-woocommerce' ),
229
+ 'type' => 'number',
230
+ 'class' => 'js-dgwt-wcas-adv-settings',
231
+ 'size' => 'small',
232
+ 'default' => 992,
233
+ ),
234
+ 700 => array(
235
+ 'name' => 'search_form',
236
+ 'label' => __( 'Search form colors', 'ajax-search-for-woocommerce' ),
237
+ 'type' => 'head',
238
+ 'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings',
239
+ ),
240
+ 800 => array(
241
+ 'name' => 'bg_input_color',
242
+ 'label' => __( 'Search input background', 'ajax-search-for-woocommerce' ),
243
+ 'type' => 'color',
244
+ 'class' => 'js-dgwt-wcas-adv-settings',
245
+ 'default' => '',
246
+ ),
247
+ 900 => array(
248
+ 'name' => 'text_input_color',
249
+ 'label' => __( 'Search input text', 'ajax-search-for-woocommerce' ),
250
+ 'type' => 'color',
251
+ 'class' => 'js-dgwt-wcas-adv-settings',
252
+ 'default' => '',
253
+ ),
254
+ 1000 => array(
255
+ 'name' => 'border_input_color',
256
+ 'label' => __( 'Search input border', 'ajax-search-for-woocommerce' ),
257
+ 'type' => 'color',
258
+ 'class' => 'js-dgwt-wcas-adv-settings',
259
+ 'default' => '',
260
+ ),
261
+ 1100 => array(
262
+ 'name' => 'bg_submit_color',
263
+ 'label' => __( 'Search submit background', 'ajax-search-for-woocommerce' ),
264
+ 'type' => 'color',
265
+ 'class' => 'js-dgwt-wcas-adv-settings js-dgwt-wcas-cbtgroup-submit-btn',
266
+ 'default' => '',
267
+ ),
268
+ 1200 => array(
269
+ 'name' => 'text_submit_color',
270
+ 'label' => __( 'Search submit text', 'ajax-search-for-woocommerce' ),
271
+ 'type' => 'color',
272
+ 'class' => 'js-dgwt-wcas-adv-settings js-dgwt-wcas-cbtgroup-submit-btn',
273
+ 'default' => '',
274
+ ),
275
+ 1500 => array(
276
+ 'name' => 'preloader_head',
277
+ 'label' => __( 'Preloader', 'ajax-search-for-woocommerce' ),
278
+ 'type' => 'head',
279
+ 'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings',
280
+ ),
281
+ 1700 => array(
282
+ 'name' => 'show_preloader',
283
+ 'label' => __( 'Show preloader', 'ajax-search-for-woocommerce' ),
284
+ 'class' => 'dgwt-wcas-options-cb-toggle js-dgwt-wcas-cbtgroup-preloader js-dgwt-wcas-adv-settings',
285
+ 'type' => 'checkbox',
286
+ 'default' => 'on',
287
+ ),
288
+ 1800 => array(
289
+ 'name' => 'preloader_url',
290
+ 'label' => __( 'Upload preloader image', 'ajax-search-for-woocommerce' ),
291
+ 'class' => 'js-dgwt-wcas-cbtgroup-preloader js-dgwt-wcas-adv-settings',
292
+ 'type' => 'file',
293
+ 'default' => '',
294
+ ),
295
+ ) ),
296
+ 'dgwt_wcas_autocomplete' => apply_filters( 'dgwt/wcas/settings/section=autocomplete', array(
297
+ 20 => array(
298
+ 'name' => 'autocomplete_head',
299
+ 'label' => __( 'Basic', 'ajax-search-for-woocommerce' ),
300
+ 'type' => 'head',
301
+ 'class' => 'dgwt-wcas-sgs-header',
302
+ ),
303
+ 50 => array(
304
+ 'name' => 'suggestions_limit',
305
+ 'label' => __( 'Limit', 'ajax-search-for-woocommerce' ),
306
+ 'type' => 'number',
307
+ 'size' => 'small',
308
+ 'desc' => __( 'Maximum number of suggestions', 'ajax-search-for-woocommerce' ),
309
+ 'default' => 7,
310
+ ),
311
+ 70 => array(
312
+ 'name' => 'show_grouped_results',
313
+ 'label' => __( 'Group results', 'ajax-search-for-woocommerce' ),
314
+ 'type' => 'checkbox',
315
+ 'size' => 'small',
316
+ 'default' => 'on',
317
+ 'class' => 'js-dgwt-wcas-adv-settings',
318
+ ),
319
+ 80 => array(
320
+ 'name' => 'search_no_results_text',
321
+ 'label' => _x( 'No results label', 'admin', 'ajax-search-for-woocommerce' ),
322
+ 'type' => 'text',
323
+ 'default' => __( 'No results', 'ajax-search-for-woocommerce' ),
324
+ ),
325
+ 100 => array(
326
+ 'name' => 'product_suggestion_head',
327
+ 'label' => __( 'Products', 'ajax-search-for-woocommerce' ),
328
+ 'type' => 'head',
329
+ 'class' => 'dgwt-wcas-sgs-header',
330
+ ),
331
+ 300 => array(
332
+ 'name' => 'show_product_image',
333
+ 'label' => __( 'Show product image', 'ajax-search-for-woocommerce' ),
334
+ 'type' => 'checkbox',
335
+ 'default' => 'on',
336
+ ),
337
+ 400 => array(
338
+ 'name' => 'show_product_price',
339
+ 'label' => __( 'Show price', 'ajax-search-for-woocommerce' ),
340
+ 'type' => 'checkbox',
341
+ 'default' => 'off',
342
+ ),
343
+ 500 => array(
344
+ 'name' => 'show_product_desc',
345
+ 'label' => __( 'Show product description', 'ajax-search-for-woocommerce' ),
346
+ 'type' => 'checkbox',
347
+ 'default' => 'off',
348
+ 'class' => 'js-dgwt-wcas-adv-settings',
349
+ ),
350
+ 600 => array(
351
+ 'name' => 'show_product_sku',
352
+ 'label' => __( 'Show SKU', 'ajax-search-for-woocommerce' ),
353
+ 'type' => 'checkbox',
354
+ 'default' => 'off',
355
+ ),
356
+ 900 => array(
357
+ 'name' => 'search_see_all_results_text',
358
+ 'label' => __( 'More results label', 'ajax-search-for-woocommerce' ),
359
+ 'type' => 'text',
360
+ 'default' => __( 'See all products...', 'ajax-search-for-woocommerce' ),
361
+ ),
362
+ 1000 => array(
363
+ 'name' => 'non_products_in_autocomplete_head',
364
+ 'label' => __( 'Non-Products in autocomplete', 'ajax-search-for-woocommerce' ),
365
+ 'type' => 'head',
366
+ 'class' => 'dgwt-wcas-sgs-header',
367
+ ),
368
+ 1100 => array(
369
+ 'name' => 'show_matching_categories',
370
+ 'label' => __( 'Show categories', 'ajax-search-for-woocommerce' ),
371
+ 'type' => 'checkbox',
372
+ 'class' => 'js-dgwt-wcas-settings-margin',
373
+ 'default' => 'on',
374
+ ),
375
+ 1300 => array(
376
+ 'name' => 'show_matching_tags',
377
+ 'label' => __( 'Show tags', 'ajax-search-for-woocommerce' ),
378
+ 'type' => 'checkbox',
379
+ 'class' => 'js-dgwt-wcas-settings-margin js-dgwt-wcas-adv-settings',
380
+ 'default' => 'off',
381
+ ),
382
+ 1600 => array(
383
+ 'name' => 'show_matching_posts',
384
+ 'label' => __( 'Show posts', 'ajax-search-for-woocommerce' ),
385
+ 'type' => 'checkbox',
386
+ 'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
387
+ 'default' => 'off',
388
+ ),
389
+ 1800 => array(
390
+ 'name' => 'show_matching_pages',
391
+ 'label' => __( 'Show pages', 'ajax-search-for-woocommerce' ),
392
+ 'type' => 'checkbox',
393
+ 'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
394
+ 'default' => 'off',
395
+ ),
396
+ 2000 => array(
397
+ 'name' => 'details_box_head',
398
+ 'label' => __( 'Details panel', 'ajax-search-for-woocommerce' ),
399
+ 'type' => 'head',
400
+ 'class' => 'dgwt-wcas-sgs-header',
401
+ ),
402
+ 2100 => array(
403
+ 'name' => 'show_details_box',
404
+ 'label' => __( 'Show Details panel', 'ajax-search-for-woocommerce' ) . ' ' . Helpers::createQuestionMark( 'details-box', __( 'The Details panel is an additional container for extended information. The details are changed dynamically when a user mouse over one of the suggestions.', 'ajax-search-for-woocommerce' ) ),
405
+ 'type' => 'checkbox',
406
+ 'size' => 'small',
407
+ 'default' => 'off',
408
+ ),
409
+ 2500 => array(
410
+ 'name' => 'suggestions_style_head',
411
+ 'label' => __( 'Suggestions colors', 'ajax-search-for-woocommerce' ),
412
+ 'type' => 'head',
413
+ 'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings',
414
+ ),
415
+ 2600 => array(
416
+ 'name' => 'sug_bg_color',
417
+ 'label' => __( 'Suggestion background', 'ajax-search-for-woocommerce' ),
418
+ 'type' => 'color',
419
+ 'class' => 'js-dgwt-wcas-adv-settings',
420
+ 'default' => '',
421
+ ),
422
+ 2700 => array(
423
+ 'name' => 'sug_hover_color',
424
+ 'label' => __( 'Suggestion selected', 'ajax-search-for-woocommerce' ),
425
+ 'type' => 'color',
426
+ 'class' => 'js-dgwt-wcas-adv-settings',
427
+ 'default' => '',
428
+ ),
429
+ 2800 => array(
430
+ 'name' => 'sug_text_color',
431
+ 'label' => __( 'Text color', 'ajax-search-for-woocommerce' ),
432
+ 'type' => 'color',
433
+ 'class' => 'js-dgwt-wcas-adv-settings',
434
+ 'default' => '',
435
+ ),
436
+ 2900 => array(
437
+ 'name' => 'sug_highlight_color',
438
+ 'label' => __( 'Highlight color', 'ajax-search-for-woocommerce' ),
439
+ 'type' => 'color',
440
+ 'class' => 'js-dgwt-wcas-adv-settings',
441
+ 'default' => '',
442
+ ),
443
+ 3000 => array(
444
+ 'name' => 'sug_border_color',
445
+ 'label' => __( 'Border color', 'ajax-search-for-woocommerce' ),
446
+ 'type' => 'color',
447
+ 'class' => 'js-dgwt-wcas-adv-settings',
448
+ 'default' => '',
449
+ ),
450
+ ) ),
451
+ 'dgwt_wcas_search' => apply_filters( 'dgwt/wcas/settings/section=search', array(
452
+ 10 => array(
453
+ 'name' => 'search_search_head',
454
+ 'label' => __( 'Products search scope', 'ajax-search-for-woocommerce' ),
455
+ 'type' => 'head',
456
+ 'class' => 'dgwt-wcas-sgs-header',
457
+ ),
458
+ 50 => array(
459
+ 'name' => 'search_in_product_content',
460
+ 'label' => __( 'Search in description', 'ajax-search-for-woocommerce' ),
461
+ 'type' => 'checkbox',
462
+ 'default' => 'off',
463
+ ),
464
+ 100 => array(
465
+ 'name' => 'search_in_product_excerpt',
466
+ 'label' => __( 'Search in short description', 'ajax-search-for-woocommerce' ),
467
+ 'type' => 'checkbox',
468
+ 'default' => 'off',
469
+ ),
470
+ 150 => array(
471
+ 'name' => 'search_in_product_sku',
472
+ 'label' => __( 'Search in SKU', 'ajax-search-for-woocommerce' ),
473
+ 'type' => 'checkbox',
474
+ 'desc' => ( dgoraAsfwFs()->is_premium() ? __( 'Searching also in variable products SKU', 'ajax-search-for-woocommerce' ) : sprintf( __( 'Searching in variable products SKU is available only in <a target="_blank" href="%s">the pro version</a>.', 'ajax-search-for-woocommerce' ), Upgrade::getUpgradeUrl() ) ),
475
+ 'default' => 'off',
476
+ ),
477
+ 200 => array(
478
+ 'name' => 'search_in_product_attributes',
479
+ 'label' => __( 'Search in attributes', 'ajax-search-for-woocommerce' ),
480
+ 'class' => 'dgwt-wcas-premium-only',
481
+ 'type' => 'checkbox',
482
+ 'default' => 'off',
483
+ ),
484
+ 250 => array(
485
+ 'name' => 'search_in_product_categories',
486
+ 'label' => __( 'Search in categories', 'ajax-search-for-woocommerce' ),
487
+ 'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
488
+ 'type' => 'checkbox',
489
+ 'default' => 'off',
490
+ ),
491
+ 275 => array(
492
+ 'name' => 'search_in_product_tags',
493
+ 'label' => __( 'Search in tags', 'ajax-search-for-woocommerce' ),
494
+ 'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
495
+ 'type' => 'checkbox',
496
+ 'default' => 'off',
497
+ ),
498
+ 300 => array(
499
+ 'name' => 'search_in_custom_fields',
500
+ 'label' => __( 'Search in custom fields', 'ajax-search-for-woocommerce' ),
501
+ 'class' => 'dgwt-wcas-premium-only',
502
+ 'type' => 'text',
503
+ 'default' => '',
504
+ ),
505
+ 350 => array(
506
+ 'name' => 'exclude_out_of_stock',
507
+ 'label' => __( "Exclude 'out of stock' products", 'ajax-search-for-woocommerce' ),
508
+ 'type' => 'checkbox',
509
+ 'default' => 'off',
510
+ ),
511
+ 400 => array(
512
+ 'name' => 'search_scope_fuzziness_head',
513
+ 'label' => __( 'Fuzziness', 'ajax-search-for-woocommerce' ),
514
+ 'type' => 'head',
515
+ 'class' => 'dgwt-wcas-sgs-header',
516
+ ),
517
+ 500 => array(
518
+ 'name' => 'search_synonyms_head',
519
+ 'label' => __( 'Synonyms', 'ajax-search-for-woocommerce' ),
520
+ 'type' => 'head',
521
+ 'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings',
522
+ ),
523
+ 520 => array(
524
+ 'name' => 'search_synonyms',
525
+ 'label' => __( 'Synonyms', 'ajax-search-for-woocommerce' ) . ' ' . Helpers::createQuestionMark( 'synonyms', __( "Synonyms feature allows your users to find more relevant results. If your products have alternative names and users often misspelling them, consider adding synonyms.", 'ajax-search-for-woocommerce' ) ),
526
+ 'type' => 'textarea',
527
+ 'desc' => __( 'Synonyms should be separated by a comma. Each new synonyms group in the new line. You can use a phrase instead of a single word. <br /> <br />Sample list:<br /> <br /><span class="dgwt-wcas-synonyms-sample">sofa, couch, davenport, divan, settee<br />big, grand, great, large, outsize</span>', 'ajax-search-for-woocommerce' ),
528
+ 'class' => 'dgwt-wcas-settings-synonyms js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
529
+ ),
530
+ ) ),
531
+ 'dgwt_wcas_performance' => apply_filters( 'dgwt/wcas/settings/section=performance', array(
532
+ 0 => array(
533
+ 'name' => 'pro_features',
534
+ 'label' => __( 'Pro features', 'ajax-search-for-woocommerce' ),
535
+ 'type' => 'desc',
536
+ 'desc' => Helpers::featuresHtml(),
537
+ ),
538
+ 10 => array(
539
+ 'name' => 'search_engine_head',
540
+ 'label' => __( 'Speed up search!', 'ajax-search-for-woocommerce' ),
541
+ 'type' => 'head',
542
+ 'class' => 'dgwt-wcas-sgs-header',
543
+ ),
544
+ 100 => array(
545
+ 'name' => 'indexer_schedule_head',
546
+ 'label' => __( 'Scheduling Indexing', 'ajax-search-for-woocommerce' ),
547
+ 'type' => 'head',
548
+ 'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings',
549
+ ),
550
+ 110 => array(
551
+ 'name' => 'indexer_schedule',
552
+ 'label' => __( 'Enable Scheduler', 'ajax-search-for-woocommerce' ) . ' ' . Helpers::createQuestionMark( 'indexer-schedule', __( "I most cases you don't need to use the scheduler because The search index is updating when you edit products. If you use import tools or custom code to refresh prices or bulk add/edit products, the indexing scheduler will be helpful.", 'ajax-search-for-woocommerce' ) ),
553
+ 'type' => 'checkbox',
554
+ 'size' => 'small',
555
+ 'class' => 'dgwt-wcas-options-cb-toggle js-dgwt-wcas-cbtgroup-indexer-schedule js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
556
+ 'default' => 'off',
557
+ ),
558
+ 120 => array(
559
+ 'name' => 'indexer_schedule_interval',
560
+ 'label' => __( 'Interval', 'ajax-search-for-woocommerce' ),
561
+ 'type' => 'select',
562
+ 'class' => 'js-dgwt-wcas-cbtgroup-indexer-schedule js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
563
+ 'options' => array(
564
+ 'daily' => __( 'Daily', 'ajax-search-for-woocommerce' ),
565
+ 'weekly' => __( 'Weekly', 'ajax-search-for-woocommerce' ),
566
+ ),
567
+ 'default' => 'weekly',
568
+ ),
569
+ 130 => array(
570
+ 'name' => 'indexer_schedule_start_time',
571
+ 'label' => __( 'What time to rebuild the index?', 'ajax-search-for-woocommerce' ),
572
+ 'type' => 'select',
573
+ 'class' => 'js-dgwt-wcas-cbtgroup-indexer-schedule js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
574
+ 'options' => Helpers::getHours(),
575
+ 'default' => 3,
576
+ ),
577
+ ) ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
578
  );
579
+ $fuzzinesText1 = '<strong>' . __( 'Increases sales conversions', 'ajax-search-for-woocommerce' ) . '</strong>';
580
+ $fuzzinesText2 = __( 'Returns suggestions based on likely relevance even though a search keyword may not exactly match. E.g if you type "ipho<b>m</b>e" you get the same results as for "iphone"', 'ajax-search-for-woocommerce' );
581
+
582
+ if ( dgoraAsfwFs()->is_premium() ) {
 
 
583
  $settingsFields['dgwt_wcas_search'][300] = array(
584
  'name' => 'search_in_custom_fields',
585
+ 'label' => __( 'Search in custom fields', 'ajax-search-for-woocommerce' ),
586
  'type' => 'selectize',
587
+ 'options' => ( Helpers::isSettingsPage() ? Helpers::getSearchableCustomFields() : array() ),
588
+ 'desc' => __( 'Select the custom fields you want to add to the search scope', 'ajax-search-for-woocommerce' ),
589
  );
 
590
  $settingsFields['dgwt_wcas_search'][450] = array(
591
  'name' => 'fuzziness_enabled',
592
+ 'label' => __( 'Fuzzy matching', 'ajax-search-for-woocommerce' ),
593
  'desc' => $fuzzinesText2,
594
  'class' => 'dgwt-wcas-premium-only',
595
  'type' => 'select',
596
  'options' => array(
597
+ 'off' => __( '-- Disabled', 'ajax-search-for-woocommerce' ),
598
+ 'soft' => __( 'Soft', 'ajax-search-for-woocommerce' ),
599
+ 'normal' => __( 'Normal', 'ajax-search-for-woocommerce' ),
600
+ 'hard' => __( 'Hard', 'ajax-search-for-woocommerce' ),
601
+ ),
602
  'default' => 'normal',
603
  );
604
+ unset( $settingsFields['dgwt_wcas_performance'][0] );
 
 
605
  } else {
606
  $settingsFields['dgwt_wcas_search'][450] = array(
607
  'name' => 'fuzziness_enabled_demo',
608
+ 'label' => __( 'Fuzzy matching', 'ajax-search-for-woocommerce' ),
609
  'desc' => $fuzzinesText1 . ' ' . $fuzzinesText2,
610
  'class' => 'dgwt-wcas-premium-only',
611
  'type' => 'select',
612
  'options' => array(
613
+ 'off' => __( '-- Disabled', 'ajax-search-for-woocommerce' ),
614
+ 'soft' => __( 'Soft', 'ajax-search-for-woocommerce' ),
615
+ 'normal' => __( 'Normal', 'ajax-search-for-woocommerce' ),
616
+ 'hard' => __( 'Hard', 'ajax-search-for-woocommerce' ),
617
+ ),
618
  'default' => 'off',
619
  );
 
620
  }
621
+
622
+
623
+ if ( dgoraAsfwFs()->is_premium() ) {
 
624
  $settingsFields['dgwt_wcas_performance'][11] = array(
625
  'name' => 'search_engine_build',
626
+ 'label' => __( 'Index status', 'ajax-search-for-woocommerce' ),
627
  'type' => 'desc',
628
+ 'desc' => ( Helpers::isSettingsPage() ? Builder::renderIndexingStatus() : '' ),
629
+ 'class' => 'dgwt-wcas-premium-only wcas-opt-tntsearch',
630
  );
 
631
  $settingsFields['dgwt_wcas_performance'][110]['desc'] = Scheduler::nextTaskDescription();
 
632
  } else {
633
  $settingsFields['dgwt_wcas_performance'][11] = array(
634
  'name' => 'search_engine_build',
635
+ 'label' => __( 'Index status', 'ajax-search-for-woocommerce' ),
636
  'type' => 'desc',
637
  'desc' => Helpers::indexerDemoHtml(),
638
+ 'class' => 'dgwt-wcas-premium-only wcas-opt-tntsearch',
639
  );
640
  }
641
+
642
+ foreach ( $settingsFields as $key => $sections ) {
643
+ foreach ( $sections as $option ) {
644
+ if ( !empty($option['name']) ) {
645
+ $this->defaults[$option['name']] = ( isset( $option['default'] ) ? $option['default'] : '' );
 
646
  }
647
  }
648
  }
649
+ if ( !dgoraAsfwFs()->is_premium() ) {
650
+ foreach ( $settingsFields as $key => $sections ) {
651
+ foreach ( $sections as $keyl2 => $option ) {
652
+ if ( self::isOptionPremium( $option ) ) {
653
+ $settingsFields[$key][$keyl2]['label'] = Helpers::getSettingsProLabel( $option['label'], 'option-label' );
 
 
 
 
 
654
  }
655
  }
656
  }
657
  }
658
+ $settingsFields = apply_filters( 'dgwt/wcas/settings', $settingsFields );
659
+ foreach ( $settingsFields as $key => $sections ) {
660
+ ksort( $settingsFields[$key] );
 
 
661
  }
 
662
  return $settingsFields;
663
  }
664
+
665
  /*
666
  * Option value
667
  *
670
  *
671
  * @return string
672
  */
673
+ public function getOption( $option_key, $default = '' )
 
674
  {
 
675
  $value = '';
676
+
677
+ if ( is_string( $option_key ) && !empty($option_key) ) {
678
+
679
+ if ( !empty($this->settingsCache) ) {
680
  $settings = $this->settingsCache;
681
  } else {
682
+ $settings = get_option( $this->settingSlug );
683
  }
684
+
685
+
686
+ if ( !empty($settings) && is_array( $settings ) ) {
687
  $this->settingsCache = $settings;
688
+
689
+ if ( array_key_exists( $option_key, $settings ) ) {
690
  $value = $settings[$option_key];
691
  } else {
 
692
  // Catch default
693
+ if ( empty($default) ) {
694
+ foreach ( $this->defaults as $key => $defaultValue ) {
695
+ if ( $key === $option_key ) {
696
  $value = $defaultValue;
697
  }
698
  }
699
  }
 
700
  }
701
+
702
  }
703
+
704
  }
705
+
706
+ if ( empty($value) && !empty($default) ) {
707
  $value = $default;
708
  }
709
+ $value = apply_filters( 'dgwt/wcas/settings/load_value', $value, $option_key );
710
+ $value = apply_filters( 'dgwt/wcas/settings/load_value/key=' . $option_key, $value );
 
 
711
  return $value;
712
  }
713
+
714
  /*
715
  * Update option
716
  *
719
  *
720
  * @return bool
721
  */
722
+ public function updateOpt( $optionKey, $value = '' )
 
723
  {
 
724
  $updated = false;
725
+
726
+ if ( is_string( $optionKey ) && !empty($optionKey) ) {
727
+ $settings = get_option( $this->settingSlug );
728
+ $value = apply_filters( 'dgwt/wcas/settings/update_value', $value, $optionKey );
729
+ $value = apply_filters( 'dgwt/wcas/settings/update_value/key=' . $optionKey, $value );
 
 
 
730
  $canUpdate = false;
731
+
732
+ if ( array_key_exists( $optionKey, $this->defaults ) ) {
733
  $settings[$optionKey] = $value;
734
+ $canUpdate = true;
735
  }
736
+
737
+ if ( $canUpdate ) {
738
+ $updated = update_option( $this->settingSlug, $settings );
739
  }
740
  }
741
+
742
  return $updated;
743
  }
744
+
745
  /**
746
  * Handles output of the settings
747
  */
748
  public static function output()
749
  {
 
750
  $settings = DGWT_WCAS()->settings->settingsApi;
 
751
  include_once DGWT_WCAS_DIR . 'partials/admin/settings.php';
752
  }
753
+
754
  /**
755
  * Restore default option value
756
  *
760
  *
761
  * @return mixed
762
  */
763
+ public function restoreDefaultValueForFreePlan( $value, $default, $option )
764
  {
765
+ if ( !dgoraAsfwFs()->is_premium() ) {
766
+ if ( self::isOptionPremium( $option ) ) {
767
  $value = $default;
768
  }
769
  }
 
770
  return $value;
771
  }
772
+
773
  /**
774
  * Check if user can see advanced settings
775
  *
777
  */
778
  public function canSeeAdvSettings()
779
  {
 
780
  $canSee = false;
781
+
782
+ if ( is_bool( $this->canSeeAdvSettings ) ) {
783
  $canSee = $this->canSeeAdvSettings;
784
  } else {
785
+ $settings = get_option( 'dgwt_wcas_settings_show_advanced' );
786
+
787
+ if ( !empty($settings) ) {
788
+
789
+ if ( $settings === 'on' ) {
 
790
  $canSee = true;
791
+ } elseif ( $settings === 'off' ) {
792
  $canSee = false;
793
  }
794
+
795
  $this->canSeeAdvSettings = $canSee;
796
  }
797
+
798
  }
799
+
800
  return $canSee;
801
  }
802
+
803
  /**
804
  * Toggle visibility of advanced settings
805
  * Ajax endpoint
808
  */
809
  public function toggleAdvancedSettings()
810
  {
811
+ $show = ( !empty($_GET['adv_settings_value']) && $_GET['adv_settings_value'] === 'show' ? 'on' : 'off' );
812
+ update_option( 'dgwt_wcas_settings_show_advanced', $show );
 
 
 
813
  wp_send_json_success();
 
814
  }
815
+
816
  /**
817
  * Check if a option is premium
818
  *
820
  *
821
  * @return bool
822
  */
823
+ public static function isOptionPremium( $option )
824
  {
825
  $is_premium = false;
826
+ if ( !empty($option['class']) && strpos( $option['class'], 'dgwt-wcas-premium-only' ) !== false ) {
827
  $is_premium = true;
828
  }
 
829
  return $is_premium;
830
  }
831
 
includes/Setup.php CHANGED
@@ -3,39 +3,35 @@
3
  namespace DgoraWcas;
4
 
5
  // Exit if accessed directly
6
- if ( ! defined('ABSPATH')) {
7
- exit;
8
  }
9
 
10
- class Setup
11
- {
12
-
13
- public function init()
14
- {
15
- add_action('init', array($this, 'setImageSize'));
16
- add_filter('body_class', array($this, 'addMobileDeviceInfo'));
17
- }
18
-
19
- /**
20
- * Register custom image size
21
- * @return void
22
- */
23
- public function setImageSize()
24
- {
25
- add_image_size('dgwt-wcas-product-suggestion', 64, 0, false);
26
- }
27
-
28
- public function addMobileDeviceInfo($classes)
29
- {
30
-
31
- if (DGWT_WCAS()->mobileDetect->isMobile()) {
32
- $classes[] = 'dgwt-wcas-is-mobile';
33
- }
34
- if (DGWT_WCAS()->mobileDetect->isiOS()) {
35
- $classes[] = 'dgwt-wcas-is-ios';
36
- }
37
-
38
- return $classes;
39
-
40
- }
41
- }
3
  namespace DgoraWcas;
4
 
5
  // Exit if accessed directly
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
  }
9
 
10
+ class Setup {
11
+
12
+ public function init() {
13
+ add_action( 'init', array( $this, 'setImageSize' ) );
14
+ add_filter( 'body_class', array( $this, 'addMobileDeviceInfo' ) );
15
+ }
16
+
17
+ /**
18
+ * Register custom image size
19
+ * @return void
20
+ */
21
+ public function setImageSize() {
22
+ add_image_size( 'dgwt-wcas-product-suggestion', 64, 0, false );
23
+ }
24
+
25
+ public function addMobileDeviceInfo( $classes ) {
26
+
27
+ if ( DGWT_WCAS()->mobileDetect->isMobile() ) {
28
+ $classes[] = 'dgwt-wcas-is-mobile';
29
+ }
30
+ if ( DGWT_WCAS()->mobileDetect->isiOS() ) {
31
+ $classes[] = 'dgwt-wcas-is-ios';
32
+ }
33
+
34
+ return $classes;
35
+
36
+ }
37
+ }
 
 
 
 
includes/Shortcode.php CHANGED
@@ -3,68 +3,66 @@
3
  namespace DgoraWcas;
4
 
5
  // Exit if accessed directly
6
- if ( ! defined('ABSPATH')) {
7
- exit;
8
  }
9
 
10
- class Shortcode
11
- {
12
 
13
- public static function register()
14
- {
15
 
16
- add_shortcode('wcas-search-form', array(__CLASS__, 'addBody'));
17
 
18
- }
19
 
20
- /**
21
- * Register Woo Ajax Search shortcode
22
- *
23
- * @param array $atts bool show_details_box
24
- */
25
- public static function addBody($atts)
26
- {
27
 
28
- $searchArgs = shortcode_atts(array(
29
- 'class' => '',
30
- 'type' => '',
31
- 'details_box' => 'hide'
32
- ), $atts, 'wcas-search-form');
33
 
34
- $searchArgs['class'] .= empty($search_args['class']) ? 'woocommerce' : ' woocommerce';
35
 
36
- $args = apply_filters('dgwt/wcas/shortcode/args', $searchArgs);
37
 
38
- return self::getForm($args);
39
- }
40
 
41
- /**
42
- * Display search form
43
- *
44
- * @param array args
45
- *
46
- * @return string
47
- */
48
 
49
- public static function getForm($args)
50
- {
51
 
52
- // Enqueue required scripts
53
- wp_enqueue_script('woocommerce-general');
54
- wp_enqueue_script('jquery-dgwt-wcas');
 
 
55
 
56
- ob_start();
57
- $filename = apply_filters('dgwt/wcas/form/partial_path', DGWT_WCAS_DIR . 'partials/search-form.php');
58
- if (file_exists($filename)) {
59
- include $filename;
60
 
61
- if (function_exists('opcache_invalidate')) {
62
- @opcache_invalidate($filename, true);
63
- }
64
- }
65
- $html = ob_get_clean();
66
 
67
- return apply_filters('dgwt/wcas/form/html', $html, $args);
68
- }
69
 
70
  }
3
  namespace DgoraWcas;
4
 
5
  // Exit if accessed directly
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
  }
9
 
10
+ class Shortcode {
 
11
 
12
+ public static function register() {
 
13
 
14
+ add_shortcode( 'wcas-search-form', array( __CLASS__, 'addBody' ) );
15
 
16
+ }
17
 
18
+ /**
19
+ * Register Woo Ajax Search shortcode
20
+ *
21
+ * @param array $atts bool show_details_box
22
+ */
23
+ public static function addBody( $atts ) {
 
24
 
25
+ $searchArgs = shortcode_atts( array(
26
+ 'class' => '',
27
+ 'layout' => DGWT_WCAS()->settings->getOption( 'search_layout' ),
28
+ 'details_box' => 'hide'
29
+ ), $atts, 'wcas-search-form' );
30
 
31
+ $searchArgs['class'] .= empty( $search_args['class'] ) ? 'woocommerce' : ' woocommerce';
32
 
33
+ $args = apply_filters( 'dgwt/wcas/shortcode/args', $searchArgs );
34
 
35
+ return self::getForm( $args );
36
+ }
37
 
38
+ /**
39
+ * Display search form
40
+ *
41
+ * @param array args
42
+ *
43
+ * @return string
44
+ */
45
 
46
+ public static function getForm( $args ) {
 
47
 
48
+ // Enqueue required scripts
49
+ wp_enqueue_script( 'jquery-dgwt-wcas' );
50
+ if ( DGWT_WCAS()->settings->getOption( 'show_details_box' ) === 'on' ) {
51
+ wp_enqueue_script( 'woocommerce-general' );
52
+ }
53
 
54
+ ob_start();
55
+ $filename = apply_filters( 'dgwt/wcas/form/partial_path', DGWT_WCAS_DIR . 'partials/search-form.php' );
56
+ if ( file_exists( $filename ) ) {
57
+ include $filename;
58
 
59
+ if ( function_exists( 'opcache_invalidate' ) ) {
60
+ @opcache_invalidate( $filename, true );
61
+ }
62
+ }
63
+ $html = ob_get_clean();
64
 
65
+ return apply_filters( 'dgwt/wcas/form/html', $html, $args );
66
+ }
67
 
68
  }
languages/ajax-search-for-woocommerce.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: PACKAGE VERSION\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2020-01-26 12:04+0000\n"
7
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
  "Last-Translator: Damian Góra <wp@damiangora.com>\n"
9
  "Language-Team: \n"
@@ -14,47 +14,47 @@ msgstr ""
14
  "Content-Transfer-Encoding: 8bit\n"
15
  "X-Generator: Loco https://localise.biz/"
16
 
17
- #: ajax-search-for-woocommerce.php:207
18
  msgid ""
19
  "<b>AJAX Search for WooCommerce</b>: You need PHP version at least 5.3 to run "
20
  "this plugin. You are currently using PHP version "
21
  msgstr ""
22
 
23
- #: ajax-search-for-woocommerce.php:230
24
  msgid ""
25
  "<b>AJAX Search for WooCommerce</b>: You need PHP version at least 5.5 to run "
26
  "this plugin. You are currently using PHP version "
27
  msgstr ""
28
 
29
- #: ajax-search-for-woocommerce.php:259
30
  #, php-format
31
  msgid ""
32
  "<b>AJAX Search for WooCommerce</b>:<br /> Your PHP version <b><i>%s</i></b> "
33
  "will not longer supported in the next plugin releases."
34
  msgstr ""
35
 
36
- #: ajax-search-for-woocommerce.php:261
37
  msgid ""
38
  " You have to update your PHP version to least 5.5 (recommended 7.2 or "
39
  "greater)."
40
  msgstr ""
41
 
42
- #: ajax-search-for-woocommerce.php:264
43
  msgid ""
44
  "If you cannot upgrade your PHP version yourself, you can send an email to "
45
  "your host."
46
  msgstr ""
47
 
48
- #: ajax-search-for-woocommerce.php:267
49
  msgid ""
50
  "If you do not upgrade the php version, the next plugin release will not work!"
51
  msgstr ""
52
 
53
- #: ajax-search-for-woocommerce.php:272
54
  msgid "Remind me again in week."
55
  msgstr ""
56
 
57
- #: ajax-search-for-woocommerce.php:294
58
  #, php-format
59
  msgid ""
60
  "<b>AJAX Search for WooCommerce</b> is enabled but not effective. It requires "
@@ -65,36 +65,49 @@ msgstr ""
65
  msgid "AJAX (live) search form for WooCommerce"
66
  msgstr ""
67
 
68
- #: widget.php:27 includes/EmbeddingViaMenu.php:57
69
- #: includes/EmbeddingViaMenu.php:97
70
- msgid "AJAX Search box"
71
  msgstr ""
72
 
73
  #: widget.php:32
74
  msgid "Title"
75
  msgstr ""
76
 
77
- #: partials/search-form.php:16 partials/admin/search-preview.php:25
78
- #: backward-compatibility/1-1-7/search-form.php:67
79
- msgid "Products search"
80
  msgstr ""
81
 
82
- #: partials/search-form.php:23 includes/Settings.php:213
83
- #: partials/admin/search-preview.php:33
84
- #: backward-compatibility/1-1-7/search-form.php:74
85
- msgid "Search for products..."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  msgstr ""
87
 
88
  #: includes/Settings.php:105
89
  msgid "Starting"
90
  msgstr ""
91
 
92
- #: includes/Settings.php:109 includes/EmbeddingViaMenu.php:176
93
- #: partials/admin/search-preview.php:14
94
- msgid "Search box"
95
  msgstr ""
96
 
97
- #: includes/Settings.php:113 partials/admin/search-preview.php:15
98
  msgid "Autocomplete"
99
  msgstr ""
100
 
@@ -114,277 +127,311 @@ msgstr ""
114
  msgid "by simple tricks"
115
  msgstr ""
116
 
117
- #: includes/Settings.php:157
118
- msgid "How to add search box in your theme?"
119
  msgstr ""
120
 
121
- #: includes/Settings.php:163
122
  msgid "How to add?"
123
  msgstr ""
124
 
125
- #: includes/Settings.php:172 includes/Settings.php:293
126
  msgid "Basic"
127
  msgstr ""
128
 
129
- #: includes/Settings.php:178
130
  msgid "Minimum characters"
131
  msgstr ""
132
 
133
- #: includes/Settings.php:182
134
  msgid "Min characters to show autocomplete"
135
  msgstr ""
136
 
137
- #: includes/Settings.php:187
138
  msgid "Max form width"
139
  msgstr ""
140
 
141
- #: includes/Settings.php:190
142
  msgid "To set 100% width leave blank"
143
  msgstr ""
144
 
145
- #: includes/Settings.php:196
146
  msgid "Show submit button"
147
  msgstr ""
148
 
149
- #: includes/Settings.php:204
150
  msgid "Submit label"
151
  msgstr ""
152
 
153
- #: includes/Settings.php:204
154
  msgid "To display the magnifier icon leave this field empty."
155
  msgstr ""
156
 
157
- #: includes/Settings.php:207
158
  msgid "Search"
159
  msgstr ""
160
 
161
- #: includes/Settings.php:211
162
  msgid "Search input placeholder"
163
  msgstr ""
164
 
165
- #: includes/Settings.php:217
166
- msgid "Search form colors"
167
  msgstr ""
168
 
169
- #: includes/Settings.php:223
170
- msgid "Search input background"
171
  msgstr ""
172
 
173
- #: includes/Settings.php:230
174
- msgid "Search input text"
175
  msgstr ""
176
 
177
- #: includes/Settings.php:237
178
- msgid "Search input border"
179
  msgstr ""
180
 
181
- #: includes/Settings.php:244
182
- msgid "Search submit background"
183
  msgstr ""
184
 
185
- #: includes/Settings.php:251
186
- msgid "Search submit text"
187
  msgstr ""
188
 
189
- #: includes/Settings.php:258
190
- msgid "Mobile"
191
  msgstr ""
192
 
193
- #: includes/Settings.php:264
194
- msgid "Overlay search (beta)"
195
  msgstr ""
196
 
197
- #: includes/Settings.php:265
198
- msgid "Enhances user experience on mobile"
199
  msgstr ""
200
 
201
- #: includes/Settings.php:271
202
- msgid "Preloader"
203
  msgstr ""
204
 
205
  #: includes/Settings.php:277
206
- msgid "Show preloader"
207
  msgstr ""
208
 
209
  #: includes/Settings.php:284
 
 
 
 
 
 
 
 
 
 
 
 
210
  msgid "Upload preloader image"
211
  msgstr ""
212
 
213
- #: includes/Settings.php:299
214
  msgid "Limit"
215
  msgstr ""
216
 
217
- #: includes/Settings.php:302
218
  msgid "Maximum number of suggestions"
219
  msgstr ""
220
 
221
- #: includes/Settings.php:307
222
  msgid "Group results"
223
  msgstr ""
224
 
225
- #: includes/Settings.php:314
226
  msgctxt "admin"
227
  msgid "No results label"
228
  msgstr ""
229
 
230
- #: includes/Settings.php:316 includes/Scripts.php:51
231
- #: partials/admin/search-preview.php:6
232
  msgid "No results"
233
  msgstr ""
234
 
235
- #: includes/Settings.php:320 partials/admin/indexer-body.php:52
236
  msgid "Products"
237
  msgstr ""
238
 
239
- #: includes/Settings.php:326
240
  msgid "Show product image"
241
  msgstr ""
242
 
243
- #: includes/Settings.php:332
244
  msgid "Show price"
245
  msgstr ""
246
 
247
- #: includes/Settings.php:338
248
  msgid "Show product description"
249
  msgstr ""
250
 
251
- #: includes/Settings.php:344
252
  msgid "Show SKU"
253
  msgstr ""
254
 
255
- #: includes/Settings.php:362
256
  msgid "More results label"
257
  msgstr ""
258
 
259
- #: includes/Settings.php:364 includes/Scripts.php:50
260
- #: partials/admin/search-preview.php:7
261
- #: includes/Engines/WordPressNative/DetailsBox.php:198
262
  msgid "See all products..."
263
  msgstr ""
264
 
265
- #: includes/Settings.php:368
266
  msgid "Non-Products in autocomplete"
267
  msgstr ""
268
 
269
- #: includes/Settings.php:374
270
  msgid "Show categories"
271
  msgstr ""
272
 
273
- #: includes/Settings.php:381
274
  msgid "Show tags"
275
  msgstr ""
276
 
277
- #: includes/Settings.php:388
278
  msgid "Show posts"
279
  msgstr ""
280
 
281
- #: includes/Settings.php:395
282
  msgid "Show pages"
283
  msgstr ""
284
 
285
- #: includes/Settings.php:402
286
  msgid "Details panel"
287
  msgstr ""
288
 
289
- #: includes/Settings.php:408
290
  msgid "Show Details panel"
291
  msgstr ""
292
 
293
- #: includes/Settings.php:408
294
  msgid ""
295
  "The Details panel is an additional container for extended information. The "
296
  "details are changed dynamically when a user mouse over one of the "
297
  "suggestions."
298
  msgstr ""
299
 
300
- #: includes/Settings.php:455
301
  msgid "Suggestions colors"
302
  msgstr ""
303
 
304
- #: includes/Settings.php:461
305
  msgid "Suggestion background"
306
  msgstr ""
307
 
308
- #: includes/Settings.php:468
309
  msgid "Suggestion selected"
310
  msgstr ""
311
 
312
- #: includes/Settings.php:475
313
  msgid "Text color"
314
  msgstr ""
315
 
316
- #: includes/Settings.php:482
317
  msgid "Highlight color"
318
  msgstr ""
319
 
320
- #: includes/Settings.php:489
321
  msgid "Border color"
322
  msgstr ""
323
 
324
- #: includes/Settings.php:498
325
  msgid "Products search scope"
326
  msgstr ""
327
 
328
- #: includes/Settings.php:504
329
  msgid "Search in description"
330
  msgstr ""
331
 
332
- #: includes/Settings.php:510
333
  msgid "Search in short description"
334
  msgstr ""
335
 
336
- #: includes/Settings.php:516
337
  msgid "Search in SKU"
338
  msgstr ""
339
 
340
- #: includes/Settings.php:518
341
  msgid "Searching also in variable products SKU"
342
  msgstr ""
343
 
344
- #: includes/Settings.php:519
345
  #, php-format
346
  msgid ""
347
  "Searching in variable products SKU is available only in <a href=\"%s\">the "
348
  "pro version</a>."
349
  msgstr ""
350
 
351
- #: includes/Settings.php:525
352
  msgid "Search in attributes"
353
  msgstr ""
354
 
355
- #: includes/Settings.php:532
356
  msgid "Search in categories"
357
  msgstr ""
358
 
359
- #: includes/Settings.php:539 includes/Settings.php:613
 
 
 
 
 
360
  msgid "Search in custom fields"
361
  msgstr ""
362
 
363
- #: includes/Settings.php:546
364
  msgid "Exclude 'out of stock' products"
365
  msgstr ""
366
 
367
- #: includes/Settings.php:552
368
  msgid "Fuzziness"
369
  msgstr ""
370
 
371
- #: includes/Settings.php:560
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
372
  msgid "Pro features"
373
  msgstr ""
374
 
375
- #: includes/Settings.php:566
376
  msgid "Speed up search!"
377
  msgstr ""
378
 
379
- #: includes/Settings.php:572
380
  msgid "Scheduling Indexing"
381
  msgstr ""
382
 
383
- #: includes/Settings.php:578
384
  msgid "Enable Scheduler"
385
  msgstr ""
386
 
387
- #: includes/Settings.php:578
388
  msgid ""
389
  "I most cases you don't need to use the scheduler because The search index is "
390
  "updating when you edit products. If you use import tools or custom code to "
@@ -392,253 +439,121 @@ msgid ""
392
  "helpful."
393
  msgstr ""
394
 
395
- #: includes/Settings.php:586
396
  msgid "Interval"
397
  msgstr ""
398
 
399
- #: includes/Settings.php:590
400
  msgid "Daily"
401
  msgstr ""
402
 
403
- #: includes/Settings.php:591
404
  msgid "Weekly"
405
  msgstr ""
406
 
407
- #: includes/Settings.php:597
408
  msgid "What time to rebuild the index?"
409
  msgstr ""
410
 
411
- #: includes/Settings.php:606
412
  msgid "Increases sales conversions"
413
  msgstr ""
414
 
415
- #: includes/Settings.php:607
416
  msgid ""
417
  "Returns suggestions based on likely relevance even though a search keyword "
418
  "may not exactly match. E.g if you type \"ipho<b>m</b>e\" you get the same "
419
  "results as for \"iphone\""
420
  msgstr ""
421
 
422
- #: includes/Settings.php:616
423
  msgid "Select the custom fields you want to add to the search scope"
424
  msgstr ""
425
 
426
- #: includes/Settings.php:621 includes/Settings.php:639
427
  msgid "Fuzzy matching"
428
  msgstr ""
429
 
430
- #: includes/Settings.php:626 includes/Settings.php:644
431
  msgid "-- Disabled"
432
  msgstr ""
433
 
434
- #: includes/Settings.php:627 includes/Settings.php:645
435
  msgid "Soft"
436
  msgstr ""
437
 
438
- #: includes/Settings.php:628 includes/Settings.php:646
439
  msgid "Normal"
440
  msgstr ""
441
 
442
- #: includes/Settings.php:629 includes/Settings.php:647
443
  msgid "Hard"
444
  msgstr ""
445
 
446
- #: includes/Settings.php:659 includes/Settings.php:670
447
  msgid "Index status"
448
  msgstr ""
449
 
450
- #: includes/BackwardCompatibility.php:336 partials/admin/indexer-header.php:21
451
- msgid "Troubleshooting"
452
- msgstr ""
453
-
454
- #: includes/BackwardCompatibility.php:337
455
- msgid "troubleshooting"
456
- msgstr ""
457
-
458
- #: includes/BackwardCompatibility.php:346
459
- msgid "<span style=\"color:#9b5c8f\">Complete the update process</span>"
460
- msgstr ""
461
-
462
- #: includes/BackwardCompatibility.php:346
463
- msgid ""
464
- "In the last update we have changed the AJAX search form on the frontend (CSS "
465
- "styles, names of the HTML classes etc.). You have to check if the AJAX "
466
- "search form looks correct with your theme after these changes."
467
- msgstr ""
468
-
469
- #: includes/BackwardCompatibility.php:354
470
- msgid "What should you do now?"
471
- msgstr ""
472
-
473
- #: includes/BackwardCompatibility.php:357
474
- msgid ""
475
- "Switch manually to the latest version to check if the AJAX search form "
476
- "displays correctly with your theme"
477
- msgstr ""
478
-
479
- #: includes/BackwardCompatibility.php:362
480
- msgid "You have activated the latest version. Follow the steps below:"
481
- msgstr ""
482
-
483
- #: includes/BackwardCompatibility.php:365
484
- #, php-format
485
- msgid "Visit your <a target=\"_blank\" href=\"%s\">store</a>"
486
- msgstr ""
487
-
488
- #: includes/BackwardCompatibility.php:366
489
- msgid "Check if the AJAX search form displays correctly"
490
- msgstr ""
491
-
492
- #: includes/BackwardCompatibility.php:367
493
- #, php-format
494
- msgid "If it is ok, click %s"
495
- msgstr ""
496
-
497
- #: includes/BackwardCompatibility.php:367
498
- msgid "finish the update"
499
- msgstr ""
500
-
501
- #: includes/BackwardCompatibility.php:368
502
- #, php-format
503
- msgid "If not, switch back to <code>previous version %s</code> and see %s"
504
- msgstr ""
505
-
506
- #: includes/BackwardCompatibility.php:375
507
- msgid "Version switcher"
508
- msgstr ""
509
-
510
- #: includes/BackwardCompatibility.php:376
511
- msgid "Something went wrong. Refresh the page and try again."
512
- msgstr ""
513
-
514
- #: includes/BackwardCompatibility.php:377
515
- msgid "Saved!"
516
- msgstr ""
517
-
518
- #: includes/BackwardCompatibility.php:379
519
- msgid "previous version"
520
- msgstr ""
521
-
522
- #: includes/BackwardCompatibility.php:386
523
- msgid "latest version"
524
- msgstr ""
525
-
526
- #: includes/BackwardCompatibility.php:393
527
- #, php-format
528
- msgid ""
529
- "If the AJAX search form displays incorrectly after switching to the latest "
530
- "version, see the %s"
531
- msgstr ""
532
-
533
- #: includes/BackwardCompatibility.php:400
534
- msgid ""
535
- "Your AJAX search form does not display correctly after manual switching to "
536
- "the latest version."
537
- msgstr ""
538
-
539
- #: includes/BackwardCompatibility.php:404
540
- msgid ""
541
- "Probably your theme uses additional CSS styles to customize the appearance "
542
- "of the AJAX search form. Contact the authors of your theme. Maybe they have "
543
- "to update their CSS styles if necessary."
544
- msgstr ""
545
-
546
- #: includes/BackwardCompatibility.php:410
547
- msgid "Your Theme Details"
548
- msgstr ""
549
-
550
- #: includes/BackwardCompatibility.php:415
551
- msgctxt "Wordpress theme name"
552
- msgid "Name:"
553
- msgstr ""
554
-
555
- #: includes/BackwardCompatibility.php:430
556
- msgid "Author:"
557
- msgstr ""
558
-
559
- #: includes/BackwardCompatibility.php:447
560
- msgid "A sample e-mail message that you can send them:"
561
- msgstr ""
562
-
563
- #: includes/BackwardCompatibility.php:452
564
- #, php-format
565
- msgid ""
566
- "Hello,\n"
567
- " <br /><br />\n"
568
- " I use your %s theme with AJAX Search for WooCommerce "
569
- "plugin - (https://wordpress.org/plugins/ajax-search-for-woocommerce/)\n"
570
- " <br /><br />\n"
571
- " In the lates version of AJAX Search for WooCommerce %s "
572
- "they have changed the search form on the frontend (CSS, HTML etc.).\n"
573
- " <br /><br />\n"
574
- " Could you check it and update your CSS if necessary?"
575
- msgstr ""
576
-
577
- #: includes/BackwardCompatibility.php:468
578
- msgid ""
579
- "If you have any questions, do not hesitate contact <a href=\"mailto:"
580
- "dgoraplugins@gmail.com?subject=Ajax Search for WooCommerce - Update "
581
- "problem\">our support </a> or <a href=\"https://wordpress."
582
- "org/support/plugin/ajax-search-for-woocommerce\" target=\"_blank\">write on "
583
- "the WordPress.org Support</a>."
584
- msgstr ""
585
-
586
- #: includes/BackwardCompatibility.php:475
587
- msgid "Remind me later"
588
  msgstr ""
589
 
590
- #: includes/Helpers.php:478 includes/Helpers.php:482
591
- msgid "Pro"
592
  msgstr ""
593
 
594
- #: includes/EmbeddingViaMenu.php:91
595
- msgid "Add AJAX search box as a menu item."
596
  msgstr ""
597
 
598
- #: includes/EmbeddingViaMenu.php:120
599
- msgid "AJAX search box will be displayed here."
 
600
  msgstr ""
601
 
602
- #: includes/Scripts.php:38 partials/admin/search-preview.php:64
603
- msgid "Brand"
604
  msgstr ""
605
 
606
- #: includes/Scripts.php:44 partials/admin/search-preview.php:58
607
- msgid "Brands"
608
  msgstr ""
609
 
610
- #: includes/Scripts.php:75
611
- msgctxt "in categories fe. in Books > Crime stories"
612
- msgid "in"
613
  msgstr ""
614
 
615
- #: partials/admin/indexer-header.php:8
616
  #, php-format
617
  msgid "Indexed <strong>100&#37;</strong>, <strong>%d products</strong>."
618
  msgstr ""
619
 
620
- #: partials/admin/indexer-header.php:12
621
  #, php-format
622
  msgid "Last build %s"
623
  msgstr ""
624
 
625
- #: partials/admin/indexer-header.php:13
626
  msgid "All products changes will be <strong>re-indexed automatically</strong>"
627
  msgstr ""
628
 
629
- #: partials/admin/indexer-header.php:23
 
 
 
 
630
  #, php-format
631
  msgid "First try to <a class=\"%s\" href=\"#\">build the index again</a>"
632
  msgstr ""
633
 
634
- #: partials/admin/indexer-header.php:24
635
  #, php-format
636
  msgid ""
637
  "Go to <a target=\"_blank\" href=\"%s\">WooCommerce -> Status -> section "
638
  "\"AJAX Search for WooCommerce Pro\"</a>. Is everything green?"
639
  msgstr ""
640
 
641
- #: partials/admin/indexer-header.php:25
642
  #, php-format
643
  msgid ""
644
  "Go to <a target=\"_blank\" href=\"%s\">WooCommerce -> Status -> Logs (tab)"
@@ -646,89 +561,89 @@ msgid ""
646
  "woocommerce\". Did you find anything significant?"
647
  msgstr ""
648
 
649
- #: partials/admin/indexer-header.php:26
650
  #, php-format
651
  msgid ""
652
  "Is it still not working? Write a <a target=\"_blank\" href=\"%s\">support "
653
  "request</a>."
654
  msgstr ""
655
 
656
- #: partials/admin/indexer-header.php:35
657
- #: partials/admin/indexer-header-demo.php:8
658
  msgid "Show details"
659
  msgstr ""
660
 
661
- #: partials/admin/indexer-header.php:36
662
  msgid "Hide details"
663
  msgstr ""
664
 
665
- #: partials/admin/indexer-body.php:10
666
  msgid ""
667
  "Indexing... This process will continue in the background. You can leave this "
668
  "page."
669
  msgstr ""
670
 
671
- #: partials/admin/indexer-body.php:12
672
  msgid "Index build progress"
673
  msgstr ""
674
 
675
- #: partials/admin/indexer-body.php:15
676
  #, php-format
677
  msgid "Finalization... Wait a moment. (%s products)"
678
  msgstr ""
679
 
680
- #: partials/admin/indexer-body.php:19
681
  msgid "Cancellation..."
682
  msgstr ""
683
 
684
- #: partials/admin/indexer-body.php:36
685
  msgid "Build ID"
686
  msgstr ""
687
 
688
- #: partials/admin/indexer-body.php:40
689
  msgid "DB"
690
  msgstr ""
691
 
692
- #: partials/admin/indexer-body.php:44
693
  msgid "Index build start"
694
  msgstr ""
695
 
696
- #: partials/admin/indexer-body.php:48
697
  msgid "Status"
698
  msgstr ""
699
 
700
- #: partials/admin/indexer-body.php:57
701
  msgid "Posts & pages"
702
  msgstr ""
703
 
704
- #: partials/admin/indexer-body.php:62
705
  msgid "Searchable"
706
  msgstr ""
707
 
708
- #: partials/admin/indexer-body.php:66 partials/admin/indexer-body.php:89
709
- #: partials/admin/indexer-body.php:114
710
  msgid "Start"
711
  msgstr ""
712
 
713
- #: partials/admin/indexer-body.php:70 partials/admin/indexer-body.php:93
714
- #: partials/admin/indexer-body.php:118
715
  msgid "End"
716
  msgstr ""
717
 
718
- #: partials/admin/indexer-body.php:75 partials/admin/indexer-body.php:98
719
- #: partials/admin/indexer-body.php:123
720
  msgid "Time"
721
  msgstr ""
722
 
723
- #: partials/admin/indexer-body.php:84
724
  msgid "Readable"
725
  msgstr ""
726
 
727
- #: partials/admin/indexer-body.php:109
728
  msgid "Taxonomies"
729
  msgstr ""
730
 
731
- #: partials/admin/indexer-body.php:137
732
  msgid "Logs"
733
  msgstr ""
734
 
@@ -744,215 +659,203 @@ msgstr ""
744
  msgid "Show advanced settings"
745
  msgstr ""
746
 
747
- #: partials/admin/indexer-header-demo.php:3
748
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:467
749
  msgid "The search index does not exist yet. Build it now."
750
  msgstr ""
751
 
752
- #: partials/admin/indexer-header-demo.php:7
753
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:499
754
  msgid "Build index"
755
  msgstr ""
756
 
757
- #: partials/admin/how-to-use.php:11
758
- msgid "There are four easy ways to display the search box in your theme"
759
  msgstr ""
760
 
761
- #: partials/admin/how-to-use.php:13
762
  #, php-format
763
- msgid "As a menu item - go to the %s and add menu item \"AJAX Search box\""
764
  msgstr ""
765
 
766
- #: partials/admin/how-to-use.php:13
767
  msgid "Menu Screen"
768
  msgstr ""
769
 
770
- #: partials/admin/how-to-use.php:14
771
  #, php-format
772
- msgid "By shortcode - %s"
773
  msgstr ""
774
 
775
- #: partials/admin/how-to-use.php:15
776
  #, php-format
777
- msgid "As a widget - go to the %s and choose \"AJAX Search box\""
778
  msgstr ""
779
 
780
- #: partials/admin/how-to-use.php:15
781
  msgid "Widgets Screen"
782
  msgstr ""
783
 
784
- #: partials/admin/how-to-use.php:16
785
  #, php-format
786
  msgid "By PHP - %s"
787
  msgstr ""
788
 
789
- #: partials/admin/how-to-use.php:19
790
  #, php-format
791
  msgid ""
792
- "Are there any difficulties? <a href=\"%s\">Upgrade now</a> and our "
793
- "developers will help you <b>embed</b>, <b>adjust</b> and <b>configure</b> "
794
- "the search box in your theme."
795
  msgstr ""
796
 
797
- #: partials/admin/system-status.php:5
798
  msgid "Ajax Search for WooCommerce (Pro)"
799
  msgstr ""
800
 
801
- #: partials/admin/system-status.php:6
802
  msgid "This section shows the plugin requirements."
803
  msgstr ""
804
 
805
- #: partials/admin/system-status.php:12
806
  msgid "PHP extension (mbstring)"
807
  msgstr ""
808
 
809
- #: partials/admin/system-status.php:29
810
  msgid "PHP extension (pdo_mysql)"
811
  msgstr ""
812
 
813
- #: partials/admin/system-status.php:45
814
  msgid "Finding wp-load.php from outside"
815
  msgstr ""
816
 
817
- #: partials/admin/system-status.php:54
818
  msgid "The location of wp-load.php is not the default."
819
  msgstr ""
820
 
821
- #: partials/admin/system-status.php:69
822
  msgid "Multisite"
823
  msgstr ""
824
 
825
- #: partials/admin/system-status.php:72
826
  msgid ""
827
  "The Ajax Search for WooCommerce (Pro) does not support multisite yet. "
828
  "Multisite must be disabled."
829
  msgstr ""
830
 
831
- #: partials/admin/system-status.php:77
832
  msgid "disabled"
833
  msgstr ""
834
 
835
- #: partials/admin/system-status.php:79
836
  msgid "enabled"
837
  msgstr ""
838
 
839
- #: partials/admin/system-status.php:86
840
  msgid "Conflicts with other plugins"
841
  msgstr ""
842
 
843
- #: partials/admin/system-status.php:89
844
  msgid ""
845
  "The Ajax Search for WooCommerce (Pro) does not support multilanguages yet."
846
  msgstr ""
847
 
848
- #: partials/admin/system-status.php:95
849
  msgid "no"
850
  msgstr ""
851
 
852
- #: partials/admin/search-preview.php:13
853
  msgid "Preview"
854
  msgstr ""
855
 
856
- #: partials/admin/search-preview.php:65
857
  msgid "Sample brand <strong>name</strong>"
858
  msgstr ""
859
 
860
- #: partials/admin/search-preview.php:78
861
  msgid "Sample category <strong>name</strong>"
862
  msgstr ""
863
 
864
- #: partials/admin/search-preview.php:91
865
  msgid "Sample tag <strong>name</strong>"
866
  msgstr ""
867
 
868
- #: partials/admin/search-preview.php:104
869
  msgid "Sample post <strong>name</strong>"
870
  msgstr ""
871
 
872
- #: partials/admin/search-preview.php:117
873
  msgid "Sample page <strong>name</strong>"
874
  msgstr ""
875
 
876
- #: partials/admin/search-preview.php:133
877
  msgid "Sample product <strong>name</strong>"
878
  msgstr ""
879
 
880
- #: partials/admin/search-preview.php:135 partials/admin/search-preview.php:176
881
  msgid ""
882
  "Lorem <strong>ipsum</strong> dolor sit amet, consectetur adipiscing elit. "
883
  "Quisque gravida lacus nec diam porttitor pharetra. Nulla facilisi. Proin "
884
  "pharetra imperdiet neque, non varius."
885
  msgstr ""
886
 
887
- #: partials/admin/search-preview.php:166
888
  msgid "Sample product name"
889
  msgstr ""
890
 
891
- #: partials/admin/features.php:9
892
  msgid ""
893
  "If users can’t find the product they’re searching for, they can’t buy it. "
894
- "Help your customers to find the right products <span>faster and "
895
- "simpler</span>."
896
  msgstr ""
897
 
898
- #: partials/admin/features.php:11 includes/Admin/Promo/Upgrade.php:62
899
  msgid ""
900
- "Update now and increase your sales. You will receive 14-day satisfaction "
901
- "guarantee. A return on investment will come very quickly."
902
- msgstr ""
903
-
904
- #: partials/admin/features.php:14
905
- msgid "Speed up search! (even <b>10x faster</b>) - users love it!"
906
  msgstr ""
907
 
908
- #: partials/admin/features.php:15
909
  msgid ""
910
- "Help in embedding the search form in your theme. <b>Our developers will do "
911
- "it for you</b>."
912
  msgstr ""
913
 
914
- #: partials/admin/features.php:16
915
  msgid ""
916
- "Efficient with a large number of products. Tested on <b>60 000 products</b>"
917
- msgstr ""
918
-
919
- #: partials/admin/features.php:17 includes/Admin/Promo/Upgrade.php:52
920
- msgid "New modern search engine based on bm25 ranking algorithm"
921
  msgstr ""
922
 
923
- #: partials/admin/features.php:18 includes/Admin/Promo/Upgrade.php:53
924
  msgid "Fuzzy search"
925
  msgstr ""
926
 
927
- #: partials/admin/features.php:19
928
- msgid "Search in variation products SKUs (option)"
929
- msgstr ""
930
-
931
- #: partials/admin/features.php:20
932
- msgid "Search in product attributes (option)"
933
  msgstr ""
934
 
935
- #: partials/admin/features.php:21
936
- msgid "Search in product custom fields (option)"
937
  msgstr ""
938
 
939
- #: partials/admin/features.php:22 includes/Admin/Promo/Upgrade.php:55
940
- msgid "Individual customization of the search form (simple CSS improvements)"
941
  msgstr ""
942
 
943
- #: partials/admin/features.php:23
944
- msgid "Individual tips and support"
945
  msgstr ""
946
 
947
- #: partials/admin/features.php:24
948
  msgid "And more..."
949
  msgstr ""
950
 
951
- #: partials/admin/features.php:24 includes/Admin/Promo/Upgrade.php:67
952
  msgid "See a comparison of all free and premium features!"
953
  msgstr ""
954
 
955
- #: partials/admin/features.php:26
956
  msgid "Upgrade Now!"
957
  msgstr ""
958
 
@@ -968,275 +871,346 @@ msgstr ""
968
 
969
  #: partials/admin/embedding-in-theme.php:20
970
  msgid ""
971
- "We support this theme and you can easly replace all default search bars."
972
  msgstr ""
973
 
974
- #: includes/Integrations/Brands.php:155
975
  msgid "Search in brands"
976
  msgstr ""
977
 
978
- #: includes/Integrations/Brands.php:159 includes/Integrations/Brands.php:175
979
  #, php-format
980
  msgid "based on the plugin %s"
981
  msgstr ""
982
 
983
- #: includes/Integrations/Brands.php:171
984
  msgid "Show brands"
985
  msgstr ""
986
 
987
  #. Name of the plugin
988
- #: includes/Admin/AdminMenu.php:31
989
  msgid "Ajax Search for WooCommerce"
990
  msgstr ""
991
 
992
- #: includes/Admin/AdminMenu.php:32
993
- msgid "AJAX search box"
994
  msgstr ""
995
 
996
- #: includes/Admin/SettingsAPI.php:595
997
  msgid "Contact"
998
  msgstr ""
999
 
1000
- #: includes/Admin/SettingsAPI.php:598
1001
  msgid "Showcase"
1002
  msgstr ""
1003
 
1004
- #: includes/Admin/SettingsAPI.php:602
1005
  msgid "My Account"
1006
  msgstr ""
1007
 
1008
- #: includes/Admin/Requirements.php:56
1009
  #, php-format
1010
  msgid "Required PHP version 5.5 or higher. You use %s"
1011
  msgstr ""
1012
 
1013
- #: includes/Admin/Requirements.php:74 includes/Admin/Requirements.php:79
1014
  #, php-format
1015
  msgid "Required PHP extension: %s"
1016
  msgstr ""
1017
 
1018
- #: includes/Admin/Requirements.php:125
1019
  #, php-format
1020
  msgid ""
1021
  "You use the %s plugin. The Ajax Search for WooCommerce PRO does not support "
1022
  "multilingual yet."
1023
  msgstr ""
1024
 
1025
- #: includes/Admin/Requirements.php:149
1026
  msgid ""
1027
  "Your WordPress use the multisite. The Ajax Search for WooCommerce PRO does "
1028
  "not support multisite yet."
1029
  msgstr ""
1030
 
1031
- #: includes/Admin/Requirements.php:166
1032
  msgid "Attention! Read this before the upgrade."
1033
  msgstr ""
1034
 
1035
- #: includes/Admin/Requirements.php:167
1036
  msgid ""
1037
  "Ajax Search for WooCommerce PRO may not work properly in your environment "
1038
  "for the following reasons:"
1039
  msgstr ""
1040
 
1041
- #: includes/Admin/Requirements.php:177
1042
  msgid "Ajax Search for WooCommerce PRO - Requirements"
1043
  msgstr ""
1044
 
1045
- #: includes/Admin/Requirements.php:178
1046
  #, php-format
1047
  msgid ""
1048
  "If you have any questions, do not hesitate contact <a href=\"%s\">our "
1049
  "support</a>."
1050
  msgstr ""
1051
 
1052
- #: includes/Admin/Promo/Upgrade.php:51
 
 
 
 
 
 
 
 
 
1053
  msgid "Speed up search! (even 10x faster) - users love it!"
1054
  msgstr ""
1055
 
1056
- #: includes/Admin/Promo/Upgrade.php:54
 
 
 
 
1057
  msgid "Search in attributes and variation products SKUs (option)"
1058
  msgstr ""
1059
 
1060
- #: includes/Admin/Promo/Upgrade.php:56
 
 
 
 
1061
  msgid "Individual tips and support by Damian Góra - the author of the plugin"
1062
  msgstr ""
1063
 
1064
- #: includes/Admin/Promo/Upgrade.php:58
1065
  msgid "Ajax Search for WooCommerce PRO - Upgrade Now"
1066
  msgstr ""
1067
 
1068
- #: includes/Admin/Promo/Upgrade.php:67
 
 
 
 
 
 
1069
  msgid "and more..."
1070
  msgstr ""
1071
 
1072
- #: includes/Admin/Promo/Upgrade.php:69
1073
  msgid "You can upgrade without leaving the admin panel by clicking below."
1074
  msgstr ""
1075
 
1076
- #: includes/Admin/Promo/Upgrade.php:70
1077
  msgid "Free updates and email support included."
1078
  msgstr ""
1079
 
1080
- #: includes/Admin/Promo/Upgrade.php:71
1081
  msgid "Upgrade Now"
1082
  msgstr ""
1083
 
1084
- #: includes/Admin/Promo/FeedbackNotice.php:77
1085
  #, php-format
1086
  msgid ""
1087
  "Hey %s, it's Damian Góra from %s. You have used this free plugin for some "
1088
  "time now, and I hope you like it!"
1089
  msgstr ""
1090
 
1091
- #: includes/Admin/Promo/FeedbackNotice.php:82
1092
  #, php-format
1093
  msgid ""
1094
  "I have spent countless hours developing it, and it would mean a lot to me if "
1095
  "you %ssupport it with a quick review on WordPress.org.%s"
1096
  msgstr ""
1097
 
1098
- #: includes/Admin/Promo/FeedbackNotice.php:88
1099
  #, php-format
1100
  msgid "Review %s"
1101
  msgstr ""
1102
 
1103
- #: includes/Admin/Promo/FeedbackNotice.php:92
1104
  msgid "No thanks"
1105
  msgstr ""
1106
 
1107
- #: includes/Engines/TNTSearchMySQL/Indexer/Scheduler.php:271
1108
  #, php-format
1109
  msgid "The next index rebuild: %s"
1110
  msgstr ""
1111
 
1112
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:144
1113
  msgctxt "Admin, logs"
1114
  msgid "Indexer already running"
1115
  msgstr ""
1116
 
1117
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:158
1118
  #, php-format
1119
  msgctxt "Admin, logs"
1120
  msgid "Multilingual: Yes, Provider: %s, Default: %s, Langs: %s"
1121
  msgstr ""
1122
 
1123
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:163
1124
  msgctxt "Admin, logs"
1125
  msgid "Indexer started"
1126
  msgstr ""
1127
 
1128
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:238
1129
  msgctxt "Admin, logs"
1130
  msgid "[Readable index] Building..."
1131
  msgstr ""
1132
 
1133
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:246
1134
  msgctxt "Admin, logs"
1135
  msgid "[Searchable index] Building..."
1136
  msgstr ""
1137
 
1138
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:445
1139
  msgid "Wait... Indexing in progress"
1140
  msgstr ""
1141
 
1142
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:446
1143
  msgid "This process will continue in the background. You can leave this page!"
1144
  msgstr ""
1145
 
1146
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:451
1147
  msgid "Wait... The index build process is canceling"
1148
  msgstr ""
1149
 
1150
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:452
1151
  msgid "Canceling..."
1152
  msgstr ""
1153
 
1154
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:457
1155
  msgid "The search index was built successfully."
1156
  msgstr ""
1157
 
1158
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:458
1159
  msgid "Completed. Works."
1160
  msgstr ""
1161
 
1162
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:462
1163
  msgid "The search index could not be built."
1164
  msgstr ""
1165
 
1166
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:463
1167
  msgid "Errors"
1168
  msgstr ""
1169
 
1170
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:468
1171
  msgid "Not exist"
1172
  msgstr ""
1173
 
1174
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:490
1175
  msgid "Stop process"
1176
  msgstr ""
1177
 
1178
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:493
1179
  msgid "Rebuild index"
1180
  msgstr ""
1181
 
1182
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:496
1183
  msgid "Try to build the index again."
1184
  msgstr ""
1185
 
1186
- #: includes/Integrations/Themes/Flatsome/Flatsome.php:35
1187
- msgid "Replace Flatsome search box"
1188
  msgstr ""
1189
 
1190
- #: includes/Integrations/Themes/Flatsome/Flatsome.php:42
1191
- msgid "Flatsome Theme"
1192
  msgstr ""
1193
 
1194
- #: includes/Integrations/Themes/Flatsome/Flatsome.php:55
1195
- #: includes/Integrations/Themes/Storefront/Storefront.php:56
 
 
1196
  msgid "Replace"
1197
  msgstr ""
1198
 
1199
- #: includes/Integrations/Themes/Flatsome/Flatsome.php:56
1200
- msgid "Replaces all Flatsome search boxes to the Ajax Search for WooCommerce."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1201
  msgstr ""
1202
 
1203
- #: includes/Integrations/Themes/Flatsome/Flatsome.php:63
1204
- #: includes/Integrations/Themes/Storefront/Storefront.php:64
1205
- msgid "Alternative ways to embed a search box"
1206
  msgstr ""
1207
 
1208
- #: includes/Integrations/Themes/Storefront/Storefront.php:36
1209
- msgid "Replace Storefront search box"
1210
  msgstr ""
1211
 
1212
- #: includes/Integrations/Themes/Storefront/Storefront.php:43
1213
  msgid "Storefront Theme"
1214
  msgstr ""
1215
 
1216
- #: includes/Integrations/Themes/Storefront/Storefront.php:57
1217
  msgid ""
1218
- "Replaces the Storefront default product search to the Ajax Search for "
1219
  "WooCommerce form."
1220
  msgstr ""
1221
 
1222
- #: includes/Engines/TNTSearchMySQL/Indexer/Taxonomy/Indexer.php:189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1223
  msgctxt "Admin, logs"
1224
  msgid "[Taxonomy index] Cleared"
1225
  msgstr ""
1226
 
1227
- #: includes/Engines/TNTSearchMySQL/Indexer/Taxonomy/Request.php:42
1228
  #, php-format
1229
  msgctxt "Admin, logs"
1230
  msgid "[Taxonomy index] Building %s..."
1231
  msgstr ""
1232
 
1233
- #: includes/Engines/TNTSearchMySQL/Indexer/Taxonomy/Request.php:55
1234
  #, php-format
1235
  msgctxt "Admin, logs"
1236
  msgid "[Taxonomy index] Completed: %s, Not indexed: %s"
1237
  msgstr ""
1238
 
1239
- #: includes/Engines/TNTSearchMySQL/Indexer/Searchable/Indexer.php:269
1240
  msgctxt "Admin, logs"
1241
  msgid "[Searchable index] Cleared"
1242
  msgstr ""
@@ -1247,52 +1221,52 @@ msgctxt "Admin, logs"
1247
  msgid "[Searchable index] The queue <code>%s</code> was deleted "
1248
  msgstr ""
1249
 
1250
- #: includes/Engines/TNTSearchMySQL/Indexer/Searchable/AsyncProcess.php:131
1251
  #, php-format
1252
  msgctxt "Admin, logs"
1253
  msgid "[Searchable index] Schedule <code>%s</code> was created "
1254
  msgstr ""
1255
 
1256
- #: includes/Engines/TNTSearchMySQL/Indexer/Searchable/AsyncProcess.php:147
1257
  #, php-format
1258
  msgctxt "Admin, logs"
1259
  msgid "[Searchable index] The queue <code>%s</code> was created"
1260
  msgstr ""
1261
 
1262
- #: includes/Engines/TNTSearchMySQL/Indexer/Searchable/AsyncProcess.php:165
1263
  msgctxt "Admin, logs"
1264
  msgid "[Searchable index] Completed"
1265
  msgstr ""
1266
 
1267
- #: includes/Engines/TNTSearchMySQL/Indexer/Variation/Indexer.php:141
1268
  msgctxt "Admin, logs"
1269
  msgid "[Variations index] Cleared"
1270
  msgstr ""
1271
 
1272
- #: includes/Engines/TNTSearchMySQL/Indexer/Readable/Indexer.php:209
1273
  msgctxt "Admin, logs"
1274
  msgid "[Readable index] Cleared"
1275
  msgstr ""
1276
 
1277
- #: includes/Engines/TNTSearchMySQL/Indexer/Readable/AsyncProcess.php:129
1278
  #, php-format
1279
  msgctxt "Admin, logs"
1280
  msgid "[Readable index] The queue <code>%s</code> was deleted "
1281
  msgstr ""
1282
 
1283
- #: includes/Engines/TNTSearchMySQL/Indexer/Readable/AsyncProcess.php:142
1284
  #, php-format
1285
  msgctxt "Admin, logs"
1286
  msgid "[Readable index] Schedule <code>%s</code> was created "
1287
  msgstr ""
1288
 
1289
- #: includes/Engines/TNTSearchMySQL/Indexer/Readable/AsyncProcess.php:159
1290
  #, php-format
1291
  msgctxt "Admin, logs"
1292
  msgid "[Readable index] The queue <code>%s</code> was created"
1293
  msgstr ""
1294
 
1295
- #: includes/Engines/TNTSearchMySQL/Indexer/Readable/AsyncProcess.php:177
1296
  msgctxt "Admin, logs"
1297
  msgid "[Readable index] Completed"
1298
  msgstr ""
@@ -1303,8 +1277,8 @@ msgstr ""
1303
 
1304
  #. Description of the plugin
1305
  msgid ""
1306
- "Allows your customers to search products easily and quickly. It will display "
1307
- "the results instantly while typing in an inputbox."
1308
  msgstr ""
1309
 
1310
  #. URI of the plugin
3
  msgstr ""
4
  "Project-Id-Version: PACKAGE VERSION\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2020-05-15 13:28+0000\n"
7
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
  "Last-Translator: Damian Góra <wp@damiangora.com>\n"
9
  "Language-Team: \n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
  "X-Generator: Loco https://localise.biz/"
16
 
17
+ #: ajax-search-for-woocommerce.php:216
18
  msgid ""
19
  "<b>AJAX Search for WooCommerce</b>: You need PHP version at least 5.3 to run "
20
  "this plugin. You are currently using PHP version "
21
  msgstr ""
22
 
23
+ #: ajax-search-for-woocommerce.php:239
24
  msgid ""
25
  "<b>AJAX Search for WooCommerce</b>: You need PHP version at least 5.5 to run "
26
  "this plugin. You are currently using PHP version "
27
  msgstr ""
28
 
29
+ #: ajax-search-for-woocommerce.php:268
30
  #, php-format
31
  msgid ""
32
  "<b>AJAX Search for WooCommerce</b>:<br /> Your PHP version <b><i>%s</i></b> "
33
  "will not longer supported in the next plugin releases."
34
  msgstr ""
35
 
36
+ #: ajax-search-for-woocommerce.php:270
37
  msgid ""
38
  " You have to update your PHP version to least 5.5 (recommended 7.2 or "
39
  "greater)."
40
  msgstr ""
41
 
42
+ #: ajax-search-for-woocommerce.php:273
43
  msgid ""
44
  "If you cannot upgrade your PHP version yourself, you can send an email to "
45
  "your host."
46
  msgstr ""
47
 
48
+ #: ajax-search-for-woocommerce.php:276
49
  msgid ""
50
  "If you do not upgrade the php version, the next plugin release will not work!"
51
  msgstr ""
52
 
53
+ #: ajax-search-for-woocommerce.php:281
54
  msgid "Remind me again in week."
55
  msgstr ""
56
 
57
+ #: ajax-search-for-woocommerce.php:303
58
  #, php-format
59
  msgid ""
60
  "<b>AJAX Search for WooCommerce</b> is enabled but not effective. It requires "
65
  msgid "AJAX (live) search form for WooCommerce"
66
  msgstr ""
67
 
68
+ #: widget.php:27 includes/EmbeddingViaMenu.php:53
69
+ #: includes/EmbeddingViaMenu.php:91
70
+ msgid "AJAX Search bar"
71
  msgstr ""
72
 
73
  #: widget.php:32
74
  msgid "Title"
75
  msgstr ""
76
 
77
+ #: widget.php:38
78
+ msgid "Default"
 
79
  msgstr ""
80
 
81
+ #: widget.php:39 includes/Settings.php:225
82
+ msgid "Search bar only"
83
+ msgstr ""
84
+
85
+ #: widget.php:40 includes/Settings.php:226
86
+ msgid "Search icon"
87
+ msgstr ""
88
+
89
+ #: widget.php:41 includes/Settings.php:227
90
+ msgid "Icon on mobile, search bar on desktop"
91
+ msgstr ""
92
+
93
+ #: widget.php:43 includes/Settings.php:222
94
+ msgid "Layout"
95
+ msgstr ""
96
+
97
+ #: partials/search-form.php:30 partials/admin/search-preview.php:34
98
+ msgid "Products search"
99
  msgstr ""
100
 
101
  #: includes/Settings.php:105
102
  msgid "Starting"
103
  msgstr ""
104
 
105
+ #: includes/Settings.php:109 includes/EmbeddingViaMenu.php:167
106
+ #: partials/admin/search-preview.php:23
107
+ msgid "Search bar"
108
  msgstr ""
109
 
110
+ #: includes/Settings.php:113 partials/admin/search-preview.php:24
111
  msgid "Autocomplete"
112
  msgstr ""
113
 
127
  msgid "by simple tricks"
128
  msgstr ""
129
 
130
+ #: includes/Settings.php:156
131
+ msgid "How to add search bar in your theme?"
132
  msgstr ""
133
 
134
+ #: includes/Settings.php:162
135
  msgid "How to add?"
136
  msgstr ""
137
 
138
+ #: includes/Settings.php:171 includes/Settings.php:313
139
  msgid "Basic"
140
  msgstr ""
141
 
142
+ #: includes/Settings.php:177
143
  msgid "Minimum characters"
144
  msgstr ""
145
 
146
+ #: includes/Settings.php:181
147
  msgid "Min characters to show autocomplete"
148
  msgstr ""
149
 
150
+ #: includes/Settings.php:186
151
  msgid "Max form width"
152
  msgstr ""
153
 
154
+ #: includes/Settings.php:189
155
  msgid "To set 100% width leave blank"
156
  msgstr ""
157
 
158
+ #: includes/Settings.php:195
159
  msgid "Show submit button"
160
  msgstr ""
161
 
162
+ #: includes/Settings.php:203
163
  msgid "Submit label"
164
  msgstr ""
165
 
166
+ #: includes/Settings.php:203
167
  msgid "To display the magnifier icon leave this field empty."
168
  msgstr ""
169
 
170
+ #: includes/Settings.php:206
171
  msgid "Search"
172
  msgstr ""
173
 
174
+ #: includes/Settings.php:210
175
  msgid "Search input placeholder"
176
  msgstr ""
177
 
178
+ #: includes/Settings.php:212 includes/Helpers.php:937
179
+ msgid "Search for products..."
180
  msgstr ""
181
 
182
+ #: includes/Settings.php:216
183
+ msgid "Layout (beta)"
184
  msgstr ""
185
 
186
+ #: includes/Settings.php:234
187
+ msgid "Overlay on mobile"
188
  msgstr ""
189
 
190
+ #: includes/Settings.php:235
191
+ msgid "The search will open in overlay on mobile"
192
  msgstr ""
193
 
194
+ #: includes/Settings.php:241
195
+ msgid "Mobile breakpoint"
196
  msgstr ""
197
 
198
+ #: includes/Settings.php:242
199
+ msgid "px"
200
  msgstr ""
201
 
202
+ #: includes/Settings.php:250
203
+ msgid "Search form colors"
204
  msgstr ""
205
 
206
+ #: includes/Settings.php:256
207
+ msgid "Search input background"
208
  msgstr ""
209
 
210
+ #: includes/Settings.php:263
211
+ msgid "Search input text"
212
  msgstr ""
213
 
214
+ #: includes/Settings.php:270
215
+ msgid "Search input border"
216
  msgstr ""
217
 
218
  #: includes/Settings.php:277
219
+ msgid "Search submit background"
220
  msgstr ""
221
 
222
  #: includes/Settings.php:284
223
+ msgid "Search submit text"
224
+ msgstr ""
225
+
226
+ #: includes/Settings.php:291
227
+ msgid "Preloader"
228
+ msgstr ""
229
+
230
+ #: includes/Settings.php:297
231
+ msgid "Show preloader"
232
+ msgstr ""
233
+
234
+ #: includes/Settings.php:304
235
  msgid "Upload preloader image"
236
  msgstr ""
237
 
238
+ #: includes/Settings.php:319
239
  msgid "Limit"
240
  msgstr ""
241
 
242
+ #: includes/Settings.php:322
243
  msgid "Maximum number of suggestions"
244
  msgstr ""
245
 
246
+ #: includes/Settings.php:327
247
  msgid "Group results"
248
  msgstr ""
249
 
250
+ #: includes/Settings.php:334
251
  msgctxt "admin"
252
  msgid "No results label"
253
  msgstr ""
254
 
255
+ #: includes/Settings.php:336 includes/Helpers.php:934
 
256
  msgid "No results"
257
  msgstr ""
258
 
259
+ #: includes/Settings.php:340 partials/admin/indexer-body.php:58
260
  msgid "Products"
261
  msgstr ""
262
 
263
+ #: includes/Settings.php:346
264
  msgid "Show product image"
265
  msgstr ""
266
 
267
+ #: includes/Settings.php:352
268
  msgid "Show price"
269
  msgstr ""
270
 
271
+ #: includes/Settings.php:358
272
  msgid "Show product description"
273
  msgstr ""
274
 
275
+ #: includes/Settings.php:364
276
  msgid "Show SKU"
277
  msgstr ""
278
 
279
+ #: includes/Settings.php:382
280
  msgid "More results label"
281
  msgstr ""
282
 
283
+ #: includes/Settings.php:384 includes/Helpers.php:935 includes/Helpers.php:936
 
 
284
  msgid "See all products..."
285
  msgstr ""
286
 
287
+ #: includes/Settings.php:388
288
  msgid "Non-Products in autocomplete"
289
  msgstr ""
290
 
291
+ #: includes/Settings.php:394
292
  msgid "Show categories"
293
  msgstr ""
294
 
295
+ #: includes/Settings.php:401
296
  msgid "Show tags"
297
  msgstr ""
298
 
299
+ #: includes/Settings.php:408
300
  msgid "Show posts"
301
  msgstr ""
302
 
303
+ #: includes/Settings.php:415
304
  msgid "Show pages"
305
  msgstr ""
306
 
307
+ #: includes/Settings.php:422
308
  msgid "Details panel"
309
  msgstr ""
310
 
311
+ #: includes/Settings.php:428
312
  msgid "Show Details panel"
313
  msgstr ""
314
 
315
+ #: includes/Settings.php:429
316
  msgid ""
317
  "The Details panel is an additional container for extended information. The "
318
  "details are changed dynamically when a user mouse over one of the "
319
  "suggestions."
320
  msgstr ""
321
 
322
+ #: includes/Settings.php:476
323
  msgid "Suggestions colors"
324
  msgstr ""
325
 
326
+ #: includes/Settings.php:482
327
  msgid "Suggestion background"
328
  msgstr ""
329
 
330
+ #: includes/Settings.php:489
331
  msgid "Suggestion selected"
332
  msgstr ""
333
 
334
+ #: includes/Settings.php:496
335
  msgid "Text color"
336
  msgstr ""
337
 
338
+ #: includes/Settings.php:503
339
  msgid "Highlight color"
340
  msgstr ""
341
 
342
+ #: includes/Settings.php:510
343
  msgid "Border color"
344
  msgstr ""
345
 
346
+ #: includes/Settings.php:519
347
  msgid "Products search scope"
348
  msgstr ""
349
 
350
+ #: includes/Settings.php:525
351
  msgid "Search in description"
352
  msgstr ""
353
 
354
+ #: includes/Settings.php:531
355
  msgid "Search in short description"
356
  msgstr ""
357
 
358
+ #: includes/Settings.php:537
359
  msgid "Search in SKU"
360
  msgstr ""
361
 
362
+ #: includes/Settings.php:539
363
  msgid "Searching also in variable products SKU"
364
  msgstr ""
365
 
366
+ #: includes/Settings.php:540
367
  #, php-format
368
  msgid ""
369
  "Searching in variable products SKU is available only in <a href=\"%s\">the "
370
  "pro version</a>."
371
  msgstr ""
372
 
373
+ #: includes/Settings.php:546 partials/admin/features.php:23
374
  msgid "Search in attributes"
375
  msgstr ""
376
 
377
+ #: includes/Settings.php:553 partials/admin/features.php:24
378
  msgid "Search in categories"
379
  msgstr ""
380
 
381
+ #: includes/Settings.php:560 partials/admin/features.php:25
382
+ msgid "Search in tags"
383
+ msgstr ""
384
+
385
+ #: includes/Settings.php:567 includes/Settings.php:658
386
+ #: partials/admin/features.php:22
387
  msgid "Search in custom fields"
388
  msgstr ""
389
 
390
+ #: includes/Settings.php:574
391
  msgid "Exclude 'out of stock' products"
392
  msgstr ""
393
 
394
+ #: includes/Settings.php:580
395
  msgid "Fuzziness"
396
  msgstr ""
397
 
398
+ #: includes/Settings.php:586 includes/Settings.php:592
399
+ #: partials/admin/features.php:29
400
+ msgid "Synonyms"
401
+ msgstr ""
402
+
403
+ #: includes/Settings.php:593
404
+ msgid ""
405
+ "Synonyms feature allows your users to find more relevant results. If your "
406
+ "products have alternative names and users often misspelling them, consider "
407
+ "adding synonyms."
408
+ msgstr ""
409
+
410
+ #: includes/Settings.php:595
411
+ msgid ""
412
+ "Synonyms should be separated by a comma. Each new synonyms group in the new "
413
+ "line. You can use a phrase instead of a single word. <br /> <br />Sample "
414
+ "list:<br /> <br /><span class=\"dgwt-wcas-synonyms-sample\">sofa, couch, "
415
+ "davenport, divan, settee<br />big, grand, great, large, outsize</span>"
416
+ msgstr ""
417
+
418
+ #: includes/Settings.php:603
419
  msgid "Pro features"
420
  msgstr ""
421
 
422
+ #: includes/Settings.php:609
423
  msgid "Speed up search!"
424
  msgstr ""
425
 
426
+ #: includes/Settings.php:616
427
  msgid "Scheduling Indexing"
428
  msgstr ""
429
 
430
+ #: includes/Settings.php:622
431
  msgid "Enable Scheduler"
432
  msgstr ""
433
 
434
+ #: includes/Settings.php:623
435
  msgid ""
436
  "I most cases you don't need to use the scheduler because The search index is "
437
  "updating when you edit products. If you use import tools or custom code to "
439
  "helpful."
440
  msgstr ""
441
 
442
+ #: includes/Settings.php:631
443
  msgid "Interval"
444
  msgstr ""
445
 
446
+ #: includes/Settings.php:635
447
  msgid "Daily"
448
  msgstr ""
449
 
450
+ #: includes/Settings.php:636
451
  msgid "Weekly"
452
  msgstr ""
453
 
454
+ #: includes/Settings.php:642
455
  msgid "What time to rebuild the index?"
456
  msgstr ""
457
 
458
+ #: includes/Settings.php:651
459
  msgid "Increases sales conversions"
460
  msgstr ""
461
 
462
+ #: includes/Settings.php:652
463
  msgid ""
464
  "Returns suggestions based on likely relevance even though a search keyword "
465
  "may not exactly match. E.g if you type \"ipho<b>m</b>e\" you get the same "
466
  "results as for \"iphone\""
467
  msgstr ""
468
 
469
+ #: includes/Settings.php:661
470
  msgid "Select the custom fields you want to add to the search scope"
471
  msgstr ""
472
 
473
+ #: includes/Settings.php:666 includes/Settings.php:684
474
  msgid "Fuzzy matching"
475
  msgstr ""
476
 
477
+ #: includes/Settings.php:671 includes/Settings.php:689
478
  msgid "-- Disabled"
479
  msgstr ""
480
 
481
+ #: includes/Settings.php:672 includes/Settings.php:690
482
  msgid "Soft"
483
  msgstr ""
484
 
485
+ #: includes/Settings.php:673 includes/Settings.php:691
486
  msgid "Normal"
487
  msgstr ""
488
 
489
+ #: includes/Settings.php:674 includes/Settings.php:692
490
  msgid "Hard"
491
  msgstr ""
492
 
493
+ #: includes/Settings.php:704 includes/Settings.php:715
494
  msgid "Index status"
495
  msgstr ""
496
 
497
+ #: includes/Helpers.php:432 includes/Helpers.php:436
498
+ msgid "Pro"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
499
  msgstr ""
500
 
501
+ #: includes/Helpers.php:920
502
+ msgid "Brand"
503
  msgstr ""
504
 
505
+ #: includes/Helpers.php:926
506
+ msgid "Brands"
507
  msgstr ""
508
 
509
+ #: includes/Helpers.php:932
510
+ msgctxt "in categories fe. in Books > Crime stories"
511
+ msgid "in"
512
  msgstr ""
513
 
514
+ #: includes/Helpers.php:933
515
+ msgid "continue reading"
516
  msgstr ""
517
 
518
+ #: includes/EmbeddingViaMenu.php:85
519
+ msgid "Add AJAX search bar as a menu item."
520
  msgstr ""
521
 
522
+ #: includes/EmbeddingViaMenu.php:113
523
+ msgid "AJAX search bar will be displayed here."
 
524
  msgstr ""
525
 
526
+ #: partials/admin/indexer-header.php:16
527
  #, php-format
528
  msgid "Indexed <strong>100&#37;</strong>, <strong>%d products</strong>."
529
  msgstr ""
530
 
531
+ #: partials/admin/indexer-header.php:20
532
  #, php-format
533
  msgid "Last build %s"
534
  msgstr ""
535
 
536
+ #: partials/admin/indexer-header.php:21
537
  msgid "All products changes will be <strong>re-indexed automatically</strong>"
538
  msgstr ""
539
 
540
+ #: partials/admin/indexer-header.php:29
541
+ msgid "Troubleshooting"
542
+ msgstr ""
543
+
544
+ #: partials/admin/indexer-header.php:31
545
  #, php-format
546
  msgid "First try to <a class=\"%s\" href=\"#\">build the index again</a>"
547
  msgstr ""
548
 
549
+ #: partials/admin/indexer-header.php:32
550
  #, php-format
551
  msgid ""
552
  "Go to <a target=\"_blank\" href=\"%s\">WooCommerce -> Status -> section "
553
  "\"AJAX Search for WooCommerce Pro\"</a>. Is everything green?"
554
  msgstr ""
555
 
556
+ #: partials/admin/indexer-header.php:33
557
  #, php-format
558
  msgid ""
559
  "Go to <a target=\"_blank\" href=\"%s\">WooCommerce -> Status -> Logs (tab)"
561
  "woocommerce\". Did you find anything significant?"
562
  msgstr ""
563
 
564
+ #: partials/admin/indexer-header.php:35
565
  #, php-format
566
  msgid ""
567
  "Is it still not working? Write a <a target=\"_blank\" href=\"%s\">support "
568
  "request</a>."
569
  msgstr ""
570
 
571
+ #: partials/admin/indexer-header.php:44
572
+ #: partials/admin/indexer-header-demo.php:16
573
  msgid "Show details"
574
  msgstr ""
575
 
576
+ #: partials/admin/indexer-header.php:45
577
  msgid "Hide details"
578
  msgstr ""
579
 
580
+ #: partials/admin/indexer-body.php:16
581
  msgid ""
582
  "Indexing... This process will continue in the background. You can leave this "
583
  "page."
584
  msgstr ""
585
 
586
+ #: partials/admin/indexer-body.php:18
587
  msgid "Index build progress"
588
  msgstr ""
589
 
590
+ #: partials/admin/indexer-body.php:21
591
  #, php-format
592
  msgid "Finalization... Wait a moment. (%s products)"
593
  msgstr ""
594
 
595
+ #: partials/admin/indexer-body.php:25
596
  msgid "Cancellation..."
597
  msgstr ""
598
 
599
+ #: partials/admin/indexer-body.php:42
600
  msgid "Build ID"
601
  msgstr ""
602
 
603
+ #: partials/admin/indexer-body.php:46
604
  msgid "DB"
605
  msgstr ""
606
 
607
+ #: partials/admin/indexer-body.php:50
608
  msgid "Index build start"
609
  msgstr ""
610
 
611
+ #: partials/admin/indexer-body.php:54
612
  msgid "Status"
613
  msgstr ""
614
 
615
+ #: partials/admin/indexer-body.php:63
616
  msgid "Posts & pages"
617
  msgstr ""
618
 
619
+ #: partials/admin/indexer-body.php:68
620
  msgid "Searchable"
621
  msgstr ""
622
 
623
+ #: partials/admin/indexer-body.php:72 partials/admin/indexer-body.php:95
624
+ #: partials/admin/indexer-body.php:120
625
  msgid "Start"
626
  msgstr ""
627
 
628
+ #: partials/admin/indexer-body.php:76 partials/admin/indexer-body.php:99
629
+ #: partials/admin/indexer-body.php:124
630
  msgid "End"
631
  msgstr ""
632
 
633
+ #: partials/admin/indexer-body.php:81 partials/admin/indexer-body.php:104
634
+ #: partials/admin/indexer-body.php:129
635
  msgid "Time"
636
  msgstr ""
637
 
638
+ #: partials/admin/indexer-body.php:90
639
  msgid "Readable"
640
  msgstr ""
641
 
642
+ #: partials/admin/indexer-body.php:115
643
  msgid "Taxonomies"
644
  msgstr ""
645
 
646
+ #: partials/admin/indexer-body.php:143
647
  msgid "Logs"
648
  msgstr ""
649
 
659
  msgid "Show advanced settings"
660
  msgstr ""
661
 
662
+ #: partials/admin/indexer-header-demo.php:11
663
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:452
664
  msgid "The search index does not exist yet. Build it now."
665
  msgstr ""
666
 
667
+ #: partials/admin/indexer-header-demo.php:15
668
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:483
669
  msgid "Build index"
670
  msgstr ""
671
 
672
+ #: partials/admin/how-to-use.php:14
673
+ msgid "There are four easy ways to display the search bar in your theme"
674
  msgstr ""
675
 
676
+ #: partials/admin/how-to-use.php:16
677
  #, php-format
678
+ msgid "As a menu item - go to %s and add menu item \"AJAX Search box\". Done!"
679
  msgstr ""
680
 
681
+ #: partials/admin/how-to-use.php:16
682
  msgid "Menu Screen"
683
  msgstr ""
684
 
685
+ #: partials/admin/how-to-use.php:17
686
  #, php-format
687
+ msgid "Using a shortcode - %s"
688
  msgstr ""
689
 
690
+ #: partials/admin/how-to-use.php:18
691
  #, php-format
692
+ msgid "As a widget - go to %s and choose \"AJAX Search bar\""
693
  msgstr ""
694
 
695
+ #: partials/admin/how-to-use.php:18
696
  msgid "Widgets Screen"
697
  msgstr ""
698
 
699
+ #: partials/admin/how-to-use.php:19
700
  #, php-format
701
  msgid "By PHP - %s"
702
  msgstr ""
703
 
704
+ #: partials/admin/how-to-use.php:22
705
  #, php-format
706
  msgid ""
707
+ "Are there any difficulties? <b>We will do it for you!</b> We offer free of "
708
+ "charge search bar implementation for Pro users. <a target=\"_blank\" "
709
+ "href=\"%s\">Become one now!</a>"
710
  msgstr ""
711
 
712
+ #: partials/admin/system-status.php:13
713
  msgid "Ajax Search for WooCommerce (Pro)"
714
  msgstr ""
715
 
716
+ #: partials/admin/system-status.php:14
717
  msgid "This section shows the plugin requirements."
718
  msgstr ""
719
 
720
+ #: partials/admin/system-status.php:20
721
  msgid "PHP extension (mbstring)"
722
  msgstr ""
723
 
724
+ #: partials/admin/system-status.php:37
725
  msgid "PHP extension (pdo_mysql)"
726
  msgstr ""
727
 
728
+ #: partials/admin/system-status.php:53
729
  msgid "Finding wp-load.php from outside"
730
  msgstr ""
731
 
732
+ #: partials/admin/system-status.php:62
733
  msgid "The location of wp-load.php is not the default."
734
  msgstr ""
735
 
736
+ #: partials/admin/system-status.php:77
737
  msgid "Multisite"
738
  msgstr ""
739
 
740
+ #: partials/admin/system-status.php:80
741
  msgid ""
742
  "The Ajax Search for WooCommerce (Pro) does not support multisite yet. "
743
  "Multisite must be disabled."
744
  msgstr ""
745
 
746
+ #: partials/admin/system-status.php:85
747
  msgid "disabled"
748
  msgstr ""
749
 
750
+ #: partials/admin/system-status.php:87
751
  msgid "enabled"
752
  msgstr ""
753
 
754
+ #: partials/admin/system-status.php:94
755
  msgid "Conflicts with other plugins"
756
  msgstr ""
757
 
758
+ #: partials/admin/system-status.php:97
759
  msgid ""
760
  "The Ajax Search for WooCommerce (Pro) does not support multilanguages yet."
761
  msgstr ""
762
 
763
+ #: partials/admin/system-status.php:103
764
  msgid "no"
765
  msgstr ""
766
 
767
+ #: partials/admin/search-preview.php:22
768
  msgid "Preview"
769
  msgstr ""
770
 
771
+ #: partials/admin/search-preview.php:74
772
  msgid "Sample brand <strong>name</strong>"
773
  msgstr ""
774
 
775
+ #: partials/admin/search-preview.php:87
776
  msgid "Sample category <strong>name</strong>"
777
  msgstr ""
778
 
779
+ #: partials/admin/search-preview.php:100
780
  msgid "Sample tag <strong>name</strong>"
781
  msgstr ""
782
 
783
+ #: partials/admin/search-preview.php:113
784
  msgid "Sample post <strong>name</strong>"
785
  msgstr ""
786
 
787
+ #: partials/admin/search-preview.php:126
788
  msgid "Sample page <strong>name</strong>"
789
  msgstr ""
790
 
791
+ #: partials/admin/search-preview.php:142
792
  msgid "Sample product <strong>name</strong>"
793
  msgstr ""
794
 
795
+ #: partials/admin/search-preview.php:144 partials/admin/search-preview.php:189
796
  msgid ""
797
  "Lorem <strong>ipsum</strong> dolor sit amet, consectetur adipiscing elit. "
798
  "Quisque gravida lacus nec diam porttitor pharetra. Nulla facilisi. Proin "
799
  "pharetra imperdiet neque, non varius."
800
  msgstr ""
801
 
802
+ #: partials/admin/search-preview.php:178
803
  msgid "Sample product name"
804
  msgstr ""
805
 
806
+ #: partials/admin/features.php:14
807
  msgid ""
808
  "If users can’t find the product they’re searching for, they can’t buy it. "
809
+ "Help your customers to find the right products even <span>10x faster</span>."
 
810
  msgstr ""
811
 
812
+ #: partials/admin/features.php:16
813
  msgid ""
814
+ "Update now and boosts your sales. You will receive <b>14-day satisfaction "
815
+ "guarantee</b>. A return on investment will come very quickly."
 
 
 
 
816
  msgstr ""
817
 
818
+ #: partials/admin/features.php:19
819
  msgid ""
820
+ "<b>New Ultra-Fast Search Engine</b> works very fast even with 100,000+ "
821
+ "products "
822
  msgstr ""
823
 
824
+ #: partials/admin/features.php:20
825
  msgid ""
826
+ "Professional and fast <b>help with embedding</b> or <b>replacing</b> the "
827
+ "search bar in your theme"
 
 
 
828
  msgstr ""
829
 
830
+ #: partials/admin/features.php:21 includes/Admin/Promo/Upgrade.php:49
831
  msgid "Fuzzy search"
832
  msgstr ""
833
 
834
+ #: partials/admin/features.php:26
835
+ msgid "Search by variation product SKU"
 
 
 
 
836
  msgstr ""
837
 
838
+ #: partials/admin/features.php:27
839
+ msgid "Search in brands (WooCommerce Brands or YITH WooCommerce Brands)"
840
  msgstr ""
841
 
842
+ #: partials/admin/features.php:28
843
+ msgid "Search for posts and pages"
844
  msgstr ""
845
 
846
+ #: partials/admin/features.php:30
847
+ msgid "Individual customization of the search bar (simple CSS improvements)"
848
  msgstr ""
849
 
850
+ #: partials/admin/features.php:31
851
  msgid "And more..."
852
  msgstr ""
853
 
854
+ #: partials/admin/features.php:31 includes/Admin/Promo/Upgrade.php:63
855
  msgid "See a comparison of all free and premium features!"
856
  msgstr ""
857
 
858
+ #: partials/admin/features.php:33
859
  msgid "Upgrade Now!"
860
  msgstr ""
861
 
871
 
872
  #: partials/admin/embedding-in-theme.php:20
873
  msgid ""
874
+ "We support this theme and you can easily replace all default search bars."
875
  msgstr ""
876
 
877
+ #: includes/Integrations/Brands.php:165
878
  msgid "Search in brands"
879
  msgstr ""
880
 
881
+ #: includes/Integrations/Brands.php:169 includes/Integrations/Brands.php:185
882
  #, php-format
883
  msgid "based on the plugin %s"
884
  msgstr ""
885
 
886
+ #: includes/Integrations/Brands.php:181
887
  msgid "Show brands"
888
  msgstr ""
889
 
890
  #. Name of the plugin
891
+ #: includes/Admin/AdminMenu.php:28
892
  msgid "Ajax Search for WooCommerce"
893
  msgstr ""
894
 
895
+ #: includes/Admin/AdminMenu.php:29
896
+ msgid "AJAX search bar"
897
  msgstr ""
898
 
899
+ #: includes/Admin/SettingsAPI.php:598
900
  msgid "Contact"
901
  msgstr ""
902
 
903
+ #: includes/Admin/SettingsAPI.php:601
904
  msgid "Showcase"
905
  msgstr ""
906
 
907
+ #: includes/Admin/SettingsAPI.php:605
908
  msgid "My Account"
909
  msgstr ""
910
 
911
+ #: includes/Admin/Requirements.php:52
912
  #, php-format
913
  msgid "Required PHP version 5.5 or higher. You use %s"
914
  msgstr ""
915
 
916
+ #: includes/Admin/Requirements.php:69 includes/Admin/Requirements.php:74
917
  #, php-format
918
  msgid "Required PHP extension: %s"
919
  msgstr ""
920
 
921
+ #: includes/Admin/Requirements.php:118
922
  #, php-format
923
  msgid ""
924
  "You use the %s plugin. The Ajax Search for WooCommerce PRO does not support "
925
  "multilingual yet."
926
  msgstr ""
927
 
928
+ #: includes/Admin/Requirements.php:141
929
  msgid ""
930
  "Your WordPress use the multisite. The Ajax Search for WooCommerce PRO does "
931
  "not support multisite yet."
932
  msgstr ""
933
 
934
+ #: includes/Admin/Requirements.php:157
935
  msgid "Attention! Read this before the upgrade."
936
  msgstr ""
937
 
938
+ #: includes/Admin/Requirements.php:158
939
  msgid ""
940
  "Ajax Search for WooCommerce PRO may not work properly in your environment "
941
  "for the following reasons:"
942
  msgstr ""
943
 
944
+ #: includes/Admin/Requirements.php:168
945
  msgid "Ajax Search for WooCommerce PRO - Requirements"
946
  msgstr ""
947
 
948
+ #: includes/Admin/Requirements.php:169
949
  #, php-format
950
  msgid ""
951
  "If you have any questions, do not hesitate contact <a href=\"%s\">our "
952
  "support</a>."
953
  msgstr ""
954
 
955
+ #: includes/Admin/RegenerateImages.php:95
956
+ #, php-format
957
+ msgid ""
958
+ "<b>AJAX Search for WooCommerce</b>: It is recommended to generate a special "
959
+ "small image size for existing products to ensure a better user experience. "
960
+ "This is a one-time action. <br /><br />You can do it by clicking %s or use "
961
+ "external plugin e.g. %s."
962
+ msgstr ""
963
+
964
+ #: includes/Admin/Promo/Upgrade.php:47
965
  msgid "Speed up search! (even 10x faster) - users love it!"
966
  msgstr ""
967
 
968
+ #: includes/Admin/Promo/Upgrade.php:48
969
+ msgid "New modern search engine based on bm25 ranking algorithm"
970
+ msgstr ""
971
+
972
+ #: includes/Admin/Promo/Upgrade.php:50
973
  msgid "Search in attributes and variation products SKUs (option)"
974
  msgstr ""
975
 
976
+ #: includes/Admin/Promo/Upgrade.php:51
977
+ msgid "Individual customization of the search form (simple CSS improvements)"
978
+ msgstr ""
979
+
980
+ #: includes/Admin/Promo/Upgrade.php:52
981
  msgid "Individual tips and support by Damian Góra - the author of the plugin"
982
  msgstr ""
983
 
984
+ #: includes/Admin/Promo/Upgrade.php:54
985
  msgid "Ajax Search for WooCommerce PRO - Upgrade Now"
986
  msgstr ""
987
 
988
+ #: includes/Admin/Promo/Upgrade.php:58
989
+ msgid ""
990
+ "Update now and increase your sales. You will receive 14-day satisfaction "
991
+ "guarantee. A return on investment will come very quickly."
992
+ msgstr ""
993
+
994
+ #: includes/Admin/Promo/Upgrade.php:63
995
  msgid "and more..."
996
  msgstr ""
997
 
998
+ #: includes/Admin/Promo/Upgrade.php:65
999
  msgid "You can upgrade without leaving the admin panel by clicking below."
1000
  msgstr ""
1001
 
1002
+ #: includes/Admin/Promo/Upgrade.php:66
1003
  msgid "Free updates and email support included."
1004
  msgstr ""
1005
 
1006
+ #: includes/Admin/Promo/Upgrade.php:67
1007
  msgid "Upgrade Now"
1008
  msgstr ""
1009
 
1010
+ #: includes/Admin/Promo/FeedbackNotice.php:73
1011
  #, php-format
1012
  msgid ""
1013
  "Hey %s, it's Damian Góra from %s. You have used this free plugin for some "
1014
  "time now, and I hope you like it!"
1015
  msgstr ""
1016
 
1017
+ #: includes/Admin/Promo/FeedbackNotice.php:78
1018
  #, php-format
1019
  msgid ""
1020
  "I have spent countless hours developing it, and it would mean a lot to me if "
1021
  "you %ssupport it with a quick review on WordPress.org.%s"
1022
  msgstr ""
1023
 
1024
+ #: includes/Admin/Promo/FeedbackNotice.php:84
1025
  #, php-format
1026
  msgid "Review %s"
1027
  msgstr ""
1028
 
1029
+ #: includes/Admin/Promo/FeedbackNotice.php:88
1030
  msgid "No thanks"
1031
  msgstr ""
1032
 
1033
+ #: includes/Engines/TNTSearchMySQL/Indexer/Scheduler.php:256
1034
  #, php-format
1035
  msgid "The next index rebuild: %s"
1036
  msgstr ""
1037
 
1038
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:140
1039
  msgctxt "Admin, logs"
1040
  msgid "Indexer already running"
1041
  msgstr ""
1042
 
1043
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:154
1044
  #, php-format
1045
  msgctxt "Admin, logs"
1046
  msgid "Multilingual: Yes, Provider: %s, Default: %s, Langs: %s"
1047
  msgstr ""
1048
 
1049
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:159
1050
  msgctxt "Admin, logs"
1051
  msgid "Indexer started"
1052
  msgstr ""
1053
 
1054
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:235
1055
  msgctxt "Admin, logs"
1056
  msgid "[Readable index] Building..."
1057
  msgstr ""
1058
 
1059
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:243
1060
  msgctxt "Admin, logs"
1061
  msgid "[Searchable index] Building..."
1062
  msgstr ""
1063
 
1064
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:430
1065
  msgid "Wait... Indexing in progress"
1066
  msgstr ""
1067
 
1068
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:431
1069
  msgid "This process will continue in the background. You can leave this page!"
1070
  msgstr ""
1071
 
1072
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:436
1073
  msgid "Wait... The index build process is canceling"
1074
  msgstr ""
1075
 
1076
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:437
1077
  msgid "Canceling..."
1078
  msgstr ""
1079
 
1080
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:442
1081
  msgid "The search index was built successfully."
1082
  msgstr ""
1083
 
1084
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:443
1085
  msgid "Completed. Works."
1086
  msgstr ""
1087
 
1088
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:447
1089
  msgid "The search index could not be built."
1090
  msgstr ""
1091
 
1092
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:448
1093
  msgid "Errors"
1094
  msgstr ""
1095
 
1096
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:453
1097
  msgid "Not exist"
1098
  msgstr ""
1099
 
1100
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:474
1101
  msgid "Stop process"
1102
  msgstr ""
1103
 
1104
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:477
1105
  msgid "Rebuild index"
1106
  msgstr ""
1107
 
1108
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:480
1109
  msgid "Try to build the index again."
1110
  msgstr ""
1111
 
1112
+ #: includes/Integrations/Themes/TheGem/TheGem.php:72
1113
+ msgid "Replace a search bar in TheGem "
1114
  msgstr ""
1115
 
1116
+ #: includes/Integrations/Themes/TheGem/TheGem.php:79
1117
+ msgid "TheGem Theme"
1118
  msgstr ""
1119
 
1120
+ #: includes/Integrations/Themes/TheGem/TheGem.php:92
1121
+ #: includes/Integrations/Themes/Flatsome/Flatsome.php:56
1122
+ #: includes/Integrations/Themes/Storefront/Storefront.php:57
1123
+ #: includes/Integrations/Themes/Woodmart/Woodmart.php:74
1124
  msgid "Replace"
1125
  msgstr ""
1126
 
1127
+ #: includes/Integrations/Themes/TheGem/TheGem.php:93
1128
+ msgid "Replace the TheGem default search"
1129
+ msgstr ""
1130
+
1131
+ #: includes/Integrations/Themes/TheGem/TheGem.php:100
1132
+ #: includes/Integrations/Themes/TheGem/TheGem.php:108
1133
+ #: includes/Integrations/Themes/Impreza/Impreza.php:60
1134
+ #: includes/Integrations/Themes/Flatsome/Flatsome.php:64
1135
+ #: includes/Integrations/Themes/Storefront/Storefront.php:65
1136
+ #: includes/Integrations/Themes/Woodmart/Woodmart.php:82
1137
+ msgid "Alternative ways to embed a search bar"
1138
+ msgstr ""
1139
+
1140
+ #: includes/Integrations/Themes/Impreza/Impreza.php:35
1141
+ #, php-format
1142
+ msgid ""
1143
+ "Here is <a href=\"%s\" target=\"_blank\">article</a> about how to do it "
1144
+ "using Impreza child-theme."
1145
+ msgstr ""
1146
+
1147
+ #: includes/Integrations/Themes/Impreza/Impreza.php:39
1148
+ msgid "Replace Impreza search bar"
1149
+ msgstr ""
1150
+
1151
+ #: includes/Integrations/Themes/Impreza/Impreza.php:46
1152
+ msgid "Impreza Theme"
1153
+ msgstr ""
1154
+
1155
+ #: includes/Integrations/Themes/Flatsome/Flatsome.php:36
1156
+ msgid "Replace Flatsome search bar"
1157
+ msgstr ""
1158
+
1159
+ #: includes/Integrations/Themes/Flatsome/Flatsome.php:43
1160
+ msgid "Flatsome Theme"
1161
  msgstr ""
1162
 
1163
+ #: includes/Integrations/Themes/Flatsome/Flatsome.php:57
1164
+ msgid "Replace all Flatsome search bars with the Ajax Search for WooCommerce."
 
1165
  msgstr ""
1166
 
1167
+ #: includes/Integrations/Themes/Storefront/Storefront.php:37
1168
+ msgid "Replace Storefront search bar"
1169
  msgstr ""
1170
 
1171
+ #: includes/Integrations/Themes/Storefront/Storefront.php:44
1172
  msgid "Storefront Theme"
1173
  msgstr ""
1174
 
1175
+ #: includes/Integrations/Themes/Storefront/Storefront.php:58
1176
  msgid ""
1177
+ "Replace the Storefront default product search to the Ajax Search for "
1178
  "WooCommerce form."
1179
  msgstr ""
1180
 
1181
+ #: includes/Integrations/Themes/Woodmart/Woodmart.php:54
1182
+ #, php-format
1183
+ msgid "Replace %s search bar"
1184
+ msgstr ""
1185
+
1186
+ #: includes/Integrations/Themes/Woodmart/Woodmart.php:61
1187
+ #, php-format
1188
+ msgid "%s Theme"
1189
+ msgstr ""
1190
+
1191
+ #: includes/Integrations/Themes/Woodmart/Woodmart.php:75
1192
+ #, php-format
1193
+ msgid "Replace all %s search bars with the Ajax Search for WooCommerce."
1194
+ msgstr ""
1195
+
1196
+ #: includes/Engines/TNTSearchMySQL/Indexer/Taxonomy/Indexer.php:181
1197
  msgctxt "Admin, logs"
1198
  msgid "[Taxonomy index] Cleared"
1199
  msgstr ""
1200
 
1201
+ #: includes/Engines/TNTSearchMySQL/Indexer/Taxonomy/Request.php:39
1202
  #, php-format
1203
  msgctxt "Admin, logs"
1204
  msgid "[Taxonomy index] Building %s..."
1205
  msgstr ""
1206
 
1207
+ #: includes/Engines/TNTSearchMySQL/Indexer/Taxonomy/Request.php:52
1208
  #, php-format
1209
  msgctxt "Admin, logs"
1210
  msgid "[Taxonomy index] Completed: %s, Not indexed: %s"
1211
  msgstr ""
1212
 
1213
+ #: includes/Engines/TNTSearchMySQL/Indexer/Searchable/Indexer.php:267
1214
  msgctxt "Admin, logs"
1215
  msgid "[Searchable index] Cleared"
1216
  msgstr ""
1221
  msgid "[Searchable index] The queue <code>%s</code> was deleted "
1222
  msgstr ""
1223
 
1224
+ #: includes/Engines/TNTSearchMySQL/Indexer/Searchable/AsyncProcess.php:130
1225
  #, php-format
1226
  msgctxt "Admin, logs"
1227
  msgid "[Searchable index] Schedule <code>%s</code> was created "
1228
  msgstr ""
1229
 
1230
+ #: includes/Engines/TNTSearchMySQL/Indexer/Searchable/AsyncProcess.php:145
1231
  #, php-format
1232
  msgctxt "Admin, logs"
1233
  msgid "[Searchable index] The queue <code>%s</code> was created"
1234
  msgstr ""
1235
 
1236
+ #: includes/Engines/TNTSearchMySQL/Indexer/Searchable/AsyncProcess.php:162
1237
  msgctxt "Admin, logs"
1238
  msgid "[Searchable index] Completed"
1239
  msgstr ""
1240
 
1241
+ #: includes/Engines/TNTSearchMySQL/Indexer/Variation/Indexer.php:136
1242
  msgctxt "Admin, logs"
1243
  msgid "[Variations index] Cleared"
1244
  msgstr ""
1245
 
1246
+ #: includes/Engines/TNTSearchMySQL/Indexer/Readable/Indexer.php:223
1247
  msgctxt "Admin, logs"
1248
  msgid "[Readable index] Cleared"
1249
  msgstr ""
1250
 
1251
+ #: includes/Engines/TNTSearchMySQL/Indexer/Readable/AsyncProcess.php:112
1252
  #, php-format
1253
  msgctxt "Admin, logs"
1254
  msgid "[Readable index] The queue <code>%s</code> was deleted "
1255
  msgstr ""
1256
 
1257
+ #: includes/Engines/TNTSearchMySQL/Indexer/Readable/AsyncProcess.php:124
1258
  #, php-format
1259
  msgctxt "Admin, logs"
1260
  msgid "[Readable index] Schedule <code>%s</code> was created "
1261
  msgstr ""
1262
 
1263
+ #: includes/Engines/TNTSearchMySQL/Indexer/Readable/AsyncProcess.php:140
1264
  #, php-format
1265
  msgctxt "Admin, logs"
1266
  msgid "[Readable index] The queue <code>%s</code> was created"
1267
  msgstr ""
1268
 
1269
+ #: includes/Engines/TNTSearchMySQL/Indexer/Readable/AsyncProcess.php:157
1270
  msgctxt "Admin, logs"
1271
  msgid "[Readable index] Completed"
1272
  msgstr ""
1277
 
1278
  #. Description of the plugin
1279
  msgid ""
1280
+ "The most popular WooCommerce product search. Gives your users a well-"
1281
+ "designed advanced AJAX search bar with live search suggestions."
1282
  msgstr ""
1283
 
1284
  #. URI of the plugin
partials/admin/embedding-in-theme.php CHANGED
@@ -3,19 +3,19 @@
3
  use DgoraWcas\Admin\Promo\Upgrade;
4
 
5
  // Exit if accessed directly
6
- if ( !defined( 'DGWT_WCAS_FILE' ) ) {
7
- exit;
8
  }
9
 
10
- if (DGWT_WCAS()->themeCompatibility->isCurrentThemeSupported()):
11
 
12
- $theme = DGWT_WCAS()->themeCompatibility->getTheme();
13
- $name = ! empty($theme->name) ? $theme->name : '';
14
- $parentName = ! empty($theme->parent_theme) ? $theme->parent_theme : '';
15
 
16
- $parentLabel = !empty($parentName) ? ', ' . sprintf(__('child theme of <b>%s</b>', 'ajax-search-for-woocommerce'), $parentName) : '';
17
 
18
- ?>
19
- <h2><?php printf(__('You use <b>%s</b> theme%s. Fantastic!', 'ajax-search-for-woocommerce'), $name, $parentLabel); ?></h2>
20
- <p><?php _e('We support this theme and you can easly replace all default search bars.', 'ajax-search-for-woocommerce'); ?></p>
21
- <?php endif; ?>
3
  use DgoraWcas\Admin\Promo\Upgrade;
4
 
5
  // Exit if accessed directly
6
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
7
+ exit;
8
  }
9
 
10
+ if ( DGWT_WCAS()->themeCompatibility->isCurrentThemeSupported() ):
11
 
12
+ $theme = DGWT_WCAS()->themeCompatibility->getTheme();
13
+ $name = ! empty( $theme->name ) ? $theme->name : '';
14
+ $parentName = ! empty( $theme->parent_theme ) ? $theme->parent_theme : '';
15
 
16
+ $parentLabel = ! empty( $parentName ) ? ', ' . sprintf( __( 'child theme of <b>%s</b>', 'ajax-search-for-woocommerce' ), $parentName ) : '';
17
 
18
+ ?>
19
+ <h2><?php printf( __( 'You use <b>%s</b> theme%s. Fantastic!', 'ajax-search-for-woocommerce' ), $name, $parentLabel ); ?></h2>
20
+ <p><?php _e( 'We support this theme and you can easily replace all default search bars.', 'ajax-search-for-woocommerce' ); ?></p>
21
+ <?php endif; ?>
partials/admin/features.php CHANGED
@@ -3,32 +3,32 @@
3
  use DgoraWcas\Admin\Promo\Upgrade;
4
 
5
  // Exit if accessed directly
6
- if ( !defined( 'DGWT_WCAS_FILE' ) ) {
7
- exit;
8
  }
9
 
10
  $utmLink = 'https://ajaxsearch.pro/?utm_source=wp-admin&utm_medium=referral&utm_campaign=settings&utm_content=features&utm_gen=utmdc#features-comparison';
11
  ?>
12
 
13
  <div class="dgwt-wcas-upgrade-s">
14
- <h2 class="dgwt-wcas-upgrade-s__title"><?php _e('If users can’t find the product they’re searching for, they can’t buy it. Help your customers to find the right products even <span>10x faster</span>.', 'ajax-search-for-woocommerce'); ?></h2>
15
- <p class="dgwt-wcas-upgrade-s__subtitle">
16
- <?php _e('Update now and boosts your sales. You will receive <b>14-day satisfaction guarantee</b>. A return on investment will come very quickly.', 'ajax-search-for-woocommerce'); ?>
17
- </p>
18
- <ul>
19
- <li><strong>+ <?php _e('<b>New Ultra-Fast Search Engine</b> – works very fast even with 100,000+ products ', 'ajax-search-for-woocommerce'); ?></strong></li>
20
- <li><strong>+ <?php _e('Professional and fast <b>help with embedding</b> or <b>replacing</b> the search bar in your theme', 'ajax-search-for-woocommerce'); ?></strong></li>
21
- <li><strong>+ <?php _e('Fuzzy search', 'ajax-search-for-woocommerce'); ?></strong></li>
22
- <li><strong>+ <?php _e('Search in custom fields', 'ajax-search-for-woocommerce'); ?></strong></li>
23
- <li><strong>+ <?php _e('Search in attributes', 'ajax-search-for-woocommerce'); ?></strong></li>
24
- <li><strong>+ <?php _e('Search in categories', 'ajax-search-for-woocommerce'); ?></strong></li>
25
- <li><strong>+ <?php _e('Search in tags', 'ajax-search-for-woocommerce'); ?></strong></li>
26
- <li><strong>+ <?php _e('Search by variation product SKU', 'ajax-search-for-woocommerce'); ?></strong></li>
27
- <li><strong>+ <?php _e('Search in brands (WooCommerce Brands or YITH WooCommerce Brands)', 'ajax-search-for-woocommerce'); ?></strong></li>
28
- <li><strong>+ <?php _e('Search for posts and pages', 'ajax-search-for-woocommerce'); ?></strong></li>
29
- <li><strong>+ <?php _e('Synonyms', 'ajax-search-for-woocommerce'); ?></strong></li>
30
- <li><strong>+ <?php _e('Individual customization of the search bar (simple CSS improvements)', 'ajax-search-for-woocommerce'); ?></strong></li>
31
- <li><strong>+ <?php _e('And more...', 'ajax-search-for-woocommerce'); ?> <a target="_blank" href="<?php echo $utmLink; ?>"><?php _e('See a comparison of all free and premium features!', 'ajax-search-for-woocommerce'); ?></a></strong></li>
32
- </ul>
33
- <a href="<?php echo Upgrade::getUpgradeUrl(); ?>" class="button ajax-build-index-primary"><?php _e('Upgrade Now!', 'ajax-search-for-woocommerce'); ?></a>
34
- </div>
3
  use DgoraWcas\Admin\Promo\Upgrade;
4
 
5
  // Exit if accessed directly
6
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
7
+ exit;
8
  }
9
 
10
  $utmLink = 'https://ajaxsearch.pro/?utm_source=wp-admin&utm_medium=referral&utm_campaign=settings&utm_content=features&utm_gen=utmdc#features-comparison';
11
  ?>
12
 
13
  <div class="dgwt-wcas-upgrade-s">
14
+ <h2 class="dgwt-wcas-upgrade-s__title"><?php _e( 'If users can’t find the product they’re searching for, they can’t buy it. Help your customers to find the right products even <span>10x faster</span>.', 'ajax-search-for-woocommerce' ); ?></h2>
15
+ <p class="dgwt-wcas-upgrade-s__subtitle">
16
+ <?php _e( 'Update now and boosts your sales. You will receive <b>14-day satisfaction guarantee</b>. A return on investment will come very quickly.', 'ajax-search-for-woocommerce' ); ?>
17
+ </p>
18
+ <ul>
19
+ <li><strong>+ <?php _e( '<b>New Ultra-Fast Search Engine</b> – works very fast even with 100,000+ products ', 'ajax-search-for-woocommerce' ); ?></strong></li>
20
+ <li><strong>+ <?php _e( 'Professional and fast <b>help with embedding</b> or <b>replacing</b> the search bar in your theme', 'ajax-search-for-woocommerce' ); ?></strong></li>
21
+ <li><strong>+ <?php _e( 'Fuzzy search', 'ajax-search-for-woocommerce' ); ?></strong></li>
22
+ <li><strong>+ <?php _e( 'Search in custom fields', 'ajax-search-for-woocommerce' ); ?></strong></li>
23
+ <li><strong>+ <?php _e( 'Search in attributes', 'ajax-search-for-woocommerce' ); ?></strong></li>
24
+ <li><strong>+ <?php _e( 'Search in categories', 'ajax-search-for-woocommerce' ); ?></strong></li>
25
+ <li><strong>+ <?php _e( 'Search in tags', 'ajax-search-for-woocommerce' ); ?></strong></li>
26
+ <li><strong>+ <?php _e( 'Search by variation product SKU', 'ajax-search-for-woocommerce' ); ?></strong></li>
27
+ <li><strong>+ <?php _e( 'Search in brands (WooCommerce Brands or YITH WooCommerce Brands)', 'ajax-search-for-woocommerce' ); ?></strong></li>
28
+ <li><strong>+ <?php _e( 'Search for posts and pages', 'ajax-search-for-woocommerce' ); ?></strong></li>
29
+ <li><strong>+ <?php _e( 'Synonyms', 'ajax-search-for-woocommerce' ); ?></strong></li>
30
+ <li><strong>+ <?php _e( 'Individual customization of the search bar (simple CSS improvements)', 'ajax-search-for-woocommerce' ); ?></strong></li>
31
+ <li><strong>+ <?php _e( 'And more...', 'ajax-search-for-woocommerce' ); ?> <a target="_blank" href="<?php echo $utmLink; ?>"><?php _e( 'See a comparison of all free and premium features!', 'ajax-search-for-woocommerce' ); ?></a></strong></li>
32
+ </ul>
33
+ <a target="_blank" href="<?php echo Upgrade::getUpgradeUrl(); ?>" class="button ajax-build-index-primary"><?php _e( 'Upgrade Now!', 'ajax-search-for-woocommerce' ); ?></a>
34
+ </div>
partials/admin/how-to-use.php CHANGED
@@ -3,21 +3,21 @@
3
  use DgoraWcas\Admin\Promo\Upgrade;
4
 
5
  // Exit if accessed directly
6
- if ( !defined( 'DGWT_WCAS_FILE' ) ) {
7
- exit;
8
  }
9
 
10
 
11
  $utmLink = 'https://ajaxsearch.pro/pricing/?utm_source=wp-admin&utm_medium=referral&utm_campaign=upgrade-link&utm_content=how-to-use';
12
 
13
  ?>
14
- <h4><?php _e('There are four easy ways to display the search bar in your theme', 'ajax-search-for-woocommerce'); ?>: </h4>
15
- <ol>
16
- <li><?php printf(__('As a menu item - go to %s and add menu item "AJAX Search box". Done!', 'ajax-search-for-woocommerce'), '<a href="' . admin_url('nav-menus.php') . '" target="_blank">' . __('Menu Screen', 'ajax-search-for-woocommerce') . '</a>') ?>
17
- <li><?php printf(__('Using a shortcode - %s', 'ajax-search-for-woocommerce'), '<code>[wcas-search-form]</code>'); ?></li>
18
- <li><?php printf(__('As a widget - go to %s and choose "AJAX Search bar"', 'ajax-search-for-woocommerce'), '<a href="' . admin_url('widgets.php') . '" target="_blank">' . __('Widgets Screen', 'ajax-search-for-woocommerce') . '</a>') ?>
19
- <li><?php printf(__('By PHP - %s', 'ajax-search-for-woocommerce'), '<code>&lt;?php echo do_shortcode(\'[wcas-search-form]\'); ?&gt;</code>'); ?></li>
20
- </ol>
21
- <?php if ( ! dgoraAsfwFs()->is_premium()): ?>
22
- <span class="dgwt-wcas-our-devs"><?php printf(__('Are there any difficulties? <b>We will do it for you!</b> We offer free of charge search bar implementation for Pro users. <a target="_blank" href="%s">Become one now!</a>', 'ajax-search-for-woocommerce'), $utmLink); ?></span>
23
- <?php endif; ?>
3
  use DgoraWcas\Admin\Promo\Upgrade;
4
 
5
  // Exit if accessed directly
6
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
7
+ exit;
8
  }
9
 
10
 
11
  $utmLink = 'https://ajaxsearch.pro/pricing/?utm_source=wp-admin&utm_medium=referral&utm_campaign=upgrade-link&utm_content=how-to-use';
12
 
13
  ?>
14
+ <h4><?php _e( 'There are four easy ways to display the search bar in your theme', 'ajax-search-for-woocommerce' ); ?>: </h4>
15
+ <ol>
16
+ <li><?php printf( __( 'As a menu item - go to %s and add menu item "AJAX Search bar". Done!', 'ajax-search-for-woocommerce' ), '<a href="' . admin_url( 'nav-menus.php' ) . '" target="_blank">' . __( 'Menu Screen', 'ajax-search-for-woocommerce' ) . '</a>' ) ?>
17
+ <li><?php printf( __( 'Using a shortcode - %s', 'ajax-search-for-woocommerce' ), '<code>[wcas-search-form]</code>' ); ?></li>
18
+ <li><?php printf( __( 'As a widget - go to %s and choose "AJAX Search bar"', 'ajax-search-for-woocommerce' ), '<a href="' . admin_url( 'widgets.php' ) . '" target="_blank">' . __( 'Widgets Screen', 'ajax-search-for-woocommerce' ) . '</a>' ) ?>
19
+ <li><?php printf( __( 'By PHP - %s', 'ajax-search-for-woocommerce' ), '<code>&lt;?php echo do_shortcode(\'[wcas-search-form]\'); ?&gt;</code>' ); ?></li>
20
+ </ol>
21
+ <?php if ( ! dgoraAsfwFs()->is_premium() ): ?>
22
+ <span class="dgwt-wcas-our-devs"><?php printf( __( 'Are there any difficulties? <b>We will do it for you!</b> We offer free of charge search bar implementation for Pro users. <a target="_blank" href="%s">Become one now!</a>', 'ajax-search-for-woocommerce' ), $utmLink ); ?></span>
23
+ <?php endif; ?>
partials/admin/indexer-header-demo.php CHANGED
@@ -1,21 +1,20 @@
1
  <?php
2
 
3
  // Exit if accessed directly
4
- if ( !defined( 'DGWT_WCAS_FILE' ) ) {
5
- exit;
6
  }
7
 
8
  ?>
9
  <div class="js-dgwt-wcas-indexing-wrapper">
10
- <div class="dgwt-wcas-indexing-header">
11
- <span class="dgwt-wcas-indexing-header__title" style="color:#aaaaaa"><?php _e('The search index does not exist yet. Build it now.', 'ajax-search-for-woocommerce'); ?></span>
12
 
13
 
14
- <div class="dgwt-wcas-indexing-header__actions">
15
- <a class="button dgwt-wcas-premium-only--trigger" href="#"><?php _e('Build index', 'ajax-search-for-woocommerce'); ?></a>
16
- <a href="#" class="show dgwt-wcas-premium-only--trigger dgwt-wcas-indexing-details-trigger"><?php _e('Show details', 'ajax-search-for-woocommerce'); ?></a>
 
17
 
18
- </div>
19
-
20
- </div>
21
  </div>
1
  <?php
2
 
3
  // Exit if accessed directly
4
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
5
+ exit;
6
  }
7
 
8
  ?>
9
  <div class="js-dgwt-wcas-indexing-wrapper">
10
+ <div class="dgwt-wcas-indexing-header">
11
+ <span class="dgwt-wcas-indexing-header__title" style="color:#aaaaaa"><?php _e( 'The search index does not exist yet. Build it now.', 'ajax-search-for-woocommerce' ); ?></span>
12
 
13
 
14
+ <div class="dgwt-wcas-indexing-header__actions">
15
+ <a class="button dgwt-wcas-premium-only--trigger" href="#"><?php _e( 'Build index', 'ajax-search-for-woocommerce' ); ?></a>
16
+ <a href="#" class="show dgwt-wcas-premium-only--trigger dgwt-wcas-indexing-details-trigger"><?php _e( 'Show details', 'ajax-search-for-woocommerce' ); ?></a>
17
+ </div>
18
 
19
+ </div>
 
 
20
  </div>
partials/admin/search-preview.php CHANGED
@@ -4,217 +4,217 @@ use DgoraWcas\Helpers;
4
 
5
 
6
  // Exit if accessed directly
7
- if (!defined('DGWT_WCAS_FILE')) {
8
- exit;
9
  }
10
 
11
 
12
- $submitText = Helpers::getLabel('submit');
13
- $hasSubmit = DGWT_WCAS()->settings->getOption('show_submit_button');
14
 
15
- $labelNoResults = Helpers::getLabel('no_results');
16
- $labelSeeAll = Helpers::getLabel('show_more');
17
 
18
  ?>
19
  <div class="dgwt-wcas-preview js-dgwt-wcas-preview">
20
 
21
- <div class="dgwt-wcas-preview-head">
22
- <span class="dgwt-wcas-preview-header"><?php _e('Preview', 'ajax-search-for-woocommerce'); ?></span>
23
- <span class="dgwt-wcas-preview-subheader dgwt-wcas-preview-subheader__sb"><?php _e('Search bar', 'ajax-search-for-woocommerce'); ?></span>
24
- <span class="dgwt-wcas-preview-subheader dgwt-wcas-preview-subheader__ac"><?php _e('Autocomplete', 'ajax-search-for-woocommerce'); ?></span>
25
- </div>
26
 
27
- <div class="js-dgwt-wcas-preview-source dgwt-wcas-preview-source">
28
 
29
- <div class="js-dgwt-wcas-search-wrapp dgwt-wcas-search-wrapp <?php echo Helpers::searchWrappClasses(); ?>" data-wcas-context="75c2">
30
- <form class="dgwt-wcas-search-form" role="search" action="http://dev.damiangora.com/" method="get">
31
- <div class="dgwt-wcas-sf-wrapp">
32
- <?php echo Helpers::getMagnifierIco(); ?>
33
 
34
- <label class="screen-reader-text"><?php _e('Products search', 'ajax-search-for-woocommerce'); ?></label>
35
 
36
- <input
37
- type="search"
38
- class="js-dgwt-wcas-search-input dgwt-wcas-search-input"
39
- name="<?php echo Helpers::getSearchInputName(); ?>"
40
- value="<?php echo get_search_query() ?>"
41
- autocomplete="off"
42
- placeholder="<?php echo Helpers::getLabel('search_placeholder'); ?>"
43
- />
44
- <div class="dgwt-wcas-preloader"></div>
45
 
46
- <button type="submit" name="dgwt-wcas-search-submit" class="js-dgwt-wcas-search-submit dgwt-wcas-search-submit"><?php
47
- echo '<span class="js-dgwt-wcas-search-submit-l">' . esc_html($submitText) . '</span>';
48
- echo '<span class="js-dgwt-wcas-search-submit-m">' . Helpers::getMagnifierIco() . '</span>';
49
- ?>
50
- </button>
51
 
52
- <input type="hidden" name="post_type" value="product">
53
- <input type="hidden" name="dgwt_wcas" value="1">
54
 
55
- <input type="hidden" name="lang" value="en">
56
 
57
- </div>
58
- </form>
59
- </div>
60
 
61
- <div class="dgwt-wcas-autocomplete">
62
 
63
- <div class="dgwt-wcas-suggestions-wrapp js-dgwt-wcas-suggestions-wrapp woocommerce dgwt-wcas-has-price dgwt-wcas-has-desc dgwt-wcas-has-sku" unselectable="on">
64
 
65
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-brand dgwt-wcas-suggestion-headline">
66
  <span class="dgwt-wcas-st">
67
- <?php echo Helpers::getLabel('brand_plu'); ?>
68
  </span>
69
- </div>
70
 
71
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-brand">
72
  <span class="dgwt-wcas-st">
73
- <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel('brand'); ?></span>
74
- <?php _e('Sample brand <strong>name</strong>', 'ajax-search-for-woocommerce'); ?>
75
  </span>
76
- </div>
77
 
78
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-cat dgwt-wcas-suggestion-headline">
79
  <span class="dgwt-wcas-st">
80
- <?php echo Helpers::getLabel('product_cat_plu'); ?>
81
  </span>
82
- </div>
83
 
84
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-cat">
85
  <span class="dgwt-wcas-st">
86
- <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel('category'); ?></span>
87
- <?php _e('Sample category <strong>name</strong>', 'ajax-search-for-woocommerce'); ?>
88
  </span>
89
- </div>
90
 
91
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-tag dgwt-wcas-suggestion-headline">
92
  <span class="dgwt-wcas-st">
93
- <?php echo Helpers::getLabel('product_tag_plu'); ?>
94
  </span>
95
- </div>
96
 
97
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-tag">
98
  <span class="dgwt-wcas-st">
99
- <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel('tag'); ?></span>
100
- <?php _e('Sample tag <strong>name</strong>', 'ajax-search-for-woocommerce'); ?>
101
  </span>
102
- </div>
103
 
104
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-post dgwt-wcas-suggestion-headline">
105
  <span class="dgwt-wcas-st">
106
- <?php echo Helpers::getLabel('post_plu'); ?>
107
  </span>
108
- </div>
109
 
110
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-post">
111
  <span class="dgwt-wcas-st">
112
- <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel('post'); ?></span>
113
- <?php _e('Sample post <strong>name</strong>', 'ajax-search-for-woocommerce'); ?>
114
  </span>
115
- </div>
116
 
117
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-page dgwt-wcas-suggestion-headline">
118
  <span class="dgwt-wcas-st">
119
- <?php echo Helpers::getLabel('page_plu'); ?>
120
  </span>
121
- </div>
122
 
123
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-page">
124
  <span class="dgwt-wcas-st">
125
- <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel('page'); ?></span>
126
- <?php _e('Sample page <strong>name</strong>', 'ajax-search-for-woocommerce'); ?>
127
  </span>
128
- </div>
129
 
130
- <div class="dgwt-wcas-suggestion js-dgwt-wcas-suggestion-headline dgwt-wcas-suggestion-headline">
131
  <span class="dgwt-wcas-st">
132
- <?php echo Helpers::getLabel('product_plu'); ?>
133
  </span>
134
- </div>
135
 
136
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-product">
137
  <span class="js-dgwt-wcas-si dgwt-wcas-si">
138
  <img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png">
139
  </span>
140
- <div class="js-dgwt-wcas-content-wrapp dgwt-wcas-content-wrapp">
141
  <span class="dgwt-wcas-st">
142
- <span class="dgwt-wcas-st-title"><?php _e('Sample product <strong>name</strong>', 'ajax-search-for-woocommerce'); ?></span>
143
- <span class="dgwt-wcas-sku js-dgwt-wcas-sku">(<?php echo Helpers::getLabel('sku_label'); ?> 0001)</span>
144
- <span class="dgwt-wcas-sd js-dgwt-wcas-sd"><?php _e('Lorem <strong>ipsum</strong> dolor sit amet, consectetur adipiscing elit. Quisque gravida lacus nec diam porttitor pharetra. Nulla facilisi. Proin pharetra imperdiet neque, non varius.', 'ajax-search-for-woocommerce'); ?></span>
145
  </span>
146
- <span class="dgwt-wcas-sp js-dgwt-wcas-sp">
147
- <?php echo wc_price(99); ?>
148
  </span>
149
- </div>
150
- </div>
151
 
152
 
153
- <div class="dgwt-wcas-suggestion js-dgwt-wcas-suggestion-more dgwt-wcas-suggestion-more dgwt-wcas-suggestion-no-border-bottom" data-index="7">
154
- <span class="dgwt-wcas-st-more"><span class="js-dgwt-wcas-st-more-label"><?php echo $labelSeeAll; ?></span> (73)</span>
155
- </div>
156
 
157
- <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-nores js-dgwt-wcas-suggestion-nores dgwt-wcas-hide">
158
- <span class="dgwt-wcas-st"><?php echo $labelNoResults; ?></span>
159
- </div>
160
 
161
- </div>
162
 
163
- <div class="dgwt-wcas-details-wrapp js-dgwt-wcas-details-wrapp woocommerce">
164
 
165
- <div class="dgwt-wcas-details-inner">
166
 
167
- <div class="dgwt-wcas-product-details">
168
 
169
- <a href="#">
170
- <div class="dgwt-wcas-details-main-image">
171
- <img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png"/>
172
- </div>
173
- </a>
174
 
175
- <div class="dgwt-wcas-details-space">
176
 
177
- <a class="dgwt-wcas-details-product-title" href="#">
178
- <?php _e('Sample product name', 'ajax-search-for-woocommerce'); ?>
179
- </a>
180
- <span class="dgwt-wcas-details-product-sku">0001</span>
181
 
182
- <div class="dgwt-wcas-pd-price">
183
- <?php echo wc_price(99); ?>
184
- </div>
185
 
186
- <div class="dgwt-wcas-details-hr"></div>
187
 
188
- <div class="dgwt-wcas-pd-desc">
189
- <?php _e('Lorem <strong>ipsum</strong> dolor sit amet, consectetur adipiscing elit. Quisque gravida lacus nec diam porttitor pharetra. Nulla facilisi. Proin pharetra imperdiet neque, non varius.',
190
- 'ajax-search-for-woocommerce'); ?>
191
- </div>
192
 
193
- <div class="dgwt-wcas-details-hr"></div>
194
 
195
- <div class="dgwt-wcas-pd-addtc js-dgwt-wcas-pd-addtc">
196
- <form class="dgwt-wcas-pd-addtc-form" action="" method="post" enctype="multipart/form-data">
197
- <div class="quantity buttons_added">
198
- <input type="button" value="-" class="minus button is-form">
199
- <input type="number" class="input-text qty text" step="1" min="0" max="9999" name="js-dgwt-wcas-quantity" value="1" title="Qty" size="4" inputmode="numeric">
200
- <input type="button" value="+" class="plus button is-form">
201
- </div>
202
- <p class="product woocommerce add_to_cart_inline " style="">
203
- <a href="#" data-quantity="1" class="button product_type_simple add_to_cart_button ajax_add_to_cart" rel="nofollow"><?php _e('Add to cart', 'woocommerce'); ?></a>
204
- </p>
205
- </form>
206
- </div>
207
 
208
- </div>
209
 
210
 
211
- </div>
212
 
213
- </div>
214
 
215
- </div>
216
 
217
- </div>
218
 
219
- </div>
220
- </div>
4
 
5
 
6
  // Exit if accessed directly
7
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
8
+ exit;
9
  }
10
 
11
 
12
+ $submitText = Helpers::getLabel( 'submit' );
13
+ $hasSubmit = DGWT_WCAS()->settings->getOption( 'show_submit_button' );
14
 
15
+ $labelNoResults = Helpers::getLabel( 'no_results' );
16
+ $labelSeeAll = Helpers::getLabel( 'show_more' );
17
 
18
  ?>
19
  <div class="dgwt-wcas-preview js-dgwt-wcas-preview">
20
 
21
+ <div class="dgwt-wcas-preview-head">
22
+ <span class="dgwt-wcas-preview-header"><?php _e( 'Preview', 'ajax-search-for-woocommerce' ); ?></span>
23
+ <span class="dgwt-wcas-preview-subheader dgwt-wcas-preview-subheader__sb"><?php _e( 'Search bar', 'ajax-search-for-woocommerce' ); ?></span>
24
+ <span class="dgwt-wcas-preview-subheader dgwt-wcas-preview-subheader__ac"><?php _e( 'Autocomplete', 'ajax-search-for-woocommerce' ); ?></span>
25
+ </div>
26
 
27
+ <div class="js-dgwt-wcas-preview-source dgwt-wcas-preview-source">
28
 
29
+ <div class="js-dgwt-wcas-search-wrapp dgwt-wcas-search-wrapp <?php echo Helpers::searchWrappClasses(); ?>" data-wcas-context="75c2">
30
+ <form class="dgwt-wcas-search-form" role="search" action="http://dev.damiangora.com/" method="get">
31
+ <div class="dgwt-wcas-sf-wrapp">
32
+ <?php echo Helpers::getMagnifierIco(); ?>
33
 
34
+ <label class="screen-reader-text"><?php _e( 'Products search', 'ajax-search-for-woocommerce' ); ?></label>
35
 
36
+ <input
37
+ type="search"
38
+ class="js-dgwt-wcas-search-input dgwt-wcas-search-input"
39
+ name="<?php echo Helpers::getSearchInputName(); ?>"
40
+ value="<?php echo get_search_query() ?>"
41
+ autocomplete="off"
42
+ placeholder="<?php echo Helpers::getLabel( 'search_placeholder' ); ?>"
43
+ />
44
+ <div class="dgwt-wcas-preloader"></div>
45
 
46
+ <button type="submit" name="dgwt-wcas-search-submit" class="js-dgwt-wcas-search-submit dgwt-wcas-search-submit"><?php
47
+ echo '<span class="js-dgwt-wcas-search-submit-l">' . esc_html( $submitText ) . '</span>';
48
+ echo '<span class="js-dgwt-wcas-search-submit-m">' . Helpers::getMagnifierIco() . '</span>';
49
+ ?>
50
+ </button>
51
 
52
+ <input type="hidden" name="post_type" value="product">
53
+ <input type="hidden" name="dgwt_wcas" value="1">
54
 
55
+ <input type="hidden" name="lang" value="en">
56
 
57
+ </div>
58
+ </form>
59
+ </div>
60
 
61
+ <div class="dgwt-wcas-autocomplete">
62
 
63
+ <div class="dgwt-wcas-suggestions-wrapp js-dgwt-wcas-suggestions-wrapp woocommerce dgwt-wcas-has-price dgwt-wcas-has-desc dgwt-wcas-has-sku" unselectable="on">
64
 
65
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-brand dgwt-wcas-suggestion-headline">
66
  <span class="dgwt-wcas-st">
67
+ <?php echo Helpers::getLabel( 'brand_plu' ); ?>
68
  </span>
69
+ </div>
70
 
71
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-brand">
72
  <span class="dgwt-wcas-st">
73
+ <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'brand' ); ?></span>
74
+ <?php _e( 'Sample brand <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
75
  </span>
76
+ </div>
77
 
78
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-cat dgwt-wcas-suggestion-headline">
79
  <span class="dgwt-wcas-st">
80
+ <?php echo Helpers::getLabel( 'product_cat_plu' ); ?>
81
  </span>
82
+ </div>
83
 
84
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-cat">
85
  <span class="dgwt-wcas-st">
86
+ <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'category' ); ?></span>
87
+ <?php _e( 'Sample category <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
88
  </span>
89
+ </div>
90
 
91
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-tag dgwt-wcas-suggestion-headline">
92
  <span class="dgwt-wcas-st">
93
+ <?php echo Helpers::getLabel( 'product_tag_plu' ); ?>
94
  </span>
95
+ </div>
96
 
97
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-tag">
98
  <span class="dgwt-wcas-st">
99
+ <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'tag' ); ?></span>
100
+ <?php _e( 'Sample tag <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
101
  </span>
102
+ </div>
103
 
104
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-post dgwt-wcas-suggestion-headline">
105
  <span class="dgwt-wcas-st">
106
+ <?php echo Helpers::getLabel( 'post_plu' ); ?>
107
  </span>
108
+ </div>
109
 
110
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-post">
111
  <span class="dgwt-wcas-st">
112
+ <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'post' ); ?></span>
113
+ <?php _e( 'Sample post <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
114
  </span>
115
+ </div>
116
 
117
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-page dgwt-wcas-suggestion-headline">
118
  <span class="dgwt-wcas-st">
119
+ <?php echo Helpers::getLabel( 'page_plu' ); ?>
120
  </span>
121
+ </div>
122
 
123
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-page">
124
  <span class="dgwt-wcas-st">
125
+ <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'page' ); ?></span>
126
+ <?php _e( 'Sample page <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
127
  </span>
128
+ </div>
129
 
130
+ <div class="dgwt-wcas-suggestion js-dgwt-wcas-suggestion-headline dgwt-wcas-suggestion-headline">
131
  <span class="dgwt-wcas-st">
132
+ <?php echo Helpers::getLabel( 'product_plu' ); ?>
133
  </span>
134
+ </div>
135
 
136
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-product">
137
  <span class="js-dgwt-wcas-si dgwt-wcas-si">
138
  <img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png">
139
  </span>
140
+ <div class="js-dgwt-wcas-content-wrapp dgwt-wcas-content-wrapp">
141
  <span class="dgwt-wcas-st">
142
+ <span class="dgwt-wcas-st-title"><?php _e( 'Sample product <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?></span>
143
+ <span class="dgwt-wcas-sku js-dgwt-wcas-sku">(<?php echo Helpers::getLabel( 'sku_label' ); ?> 0001)</span>
144
+ <span class="dgwt-wcas-sd js-dgwt-wcas-sd"><?php _e( 'Lorem <strong>ipsum</strong> dolor sit amet, consectetur adipiscing elit. Quisque gravida lacus nec diam porttitor pharetra. Nulla facilisi. Proin pharetra imperdiet neque, non varius.', 'ajax-search-for-woocommerce' ); ?></span>
145
  </span>
146
+ <span class="dgwt-wcas-sp js-dgwt-wcas-sp">
147
+ <?php echo wc_price( 99 ); ?>
148
  </span>
149
+ </div>
150
+ </div>
151
 
152
 
153
+ <div class="dgwt-wcas-suggestion js-dgwt-wcas-suggestion-more dgwt-wcas-suggestion-more dgwt-wcas-suggestion-no-border-bottom" data-index="7">
154
+ <span class="dgwt-wcas-st-more"><span class="js-dgwt-wcas-st-more-label"><?php echo $labelSeeAll; ?></span> (73)</span>
155
+ </div>
156
 
157
+ <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-nores js-dgwt-wcas-suggestion-nores dgwt-wcas-hide">
158
+ <span class="dgwt-wcas-st"><?php echo $labelNoResults; ?></span>
159
+ </div>
160
 
161
+ </div>
162
 
163
+ <div class="dgwt-wcas-details-wrapp js-dgwt-wcas-details-wrapp woocommerce">
164
 
165
+ <div class="dgwt-wcas-details-inner">
166
 
167
+ <div class="dgwt-wcas-product-details">
168
 
169
+ <a href="#">
170
+ <div class="dgwt-wcas-details-main-image">
171
+ <img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png"/>
172
+ </div>
173
+ </a>
174
 
175
+ <div class="dgwt-wcas-details-space">
176
 
177
+ <a class="dgwt-wcas-details-product-title" href="#">
178
+ <?php _e( 'Sample product name', 'ajax-search-for-woocommerce' ); ?>
179
+ </a>
180
+ <span class="dgwt-wcas-details-product-sku">0001</span>
181
 
182
+ <div class="dgwt-wcas-pd-price">
183
+ <?php echo wc_price( 99 ); ?>
184
+ </div>
185
 
186
+ <div class="dgwt-wcas-details-hr"></div>
187
 
188
+ <div class="dgwt-wcas-pd-desc">
189
+ <?php _e( 'Lorem <strong>ipsum</strong> dolor sit amet, consectetur adipiscing elit. Quisque gravida lacus nec diam porttitor pharetra. Nulla facilisi. Proin pharetra imperdiet neque, non varius.',
190
+ 'ajax-search-for-woocommerce' ); ?>
191
+ </div>
192
 
193
+ <div class="dgwt-wcas-details-hr"></div>
194
 
195
+ <div class="dgwt-wcas-pd-addtc js-dgwt-wcas-pd-addtc">
196
+ <form class="dgwt-wcas-pd-addtc-form" action="" method="post" enctype="multipart/form-data">
197
+ <div class="quantity buttons_added">
198
+ <input type="button" value="-" class="minus button is-form">
199
+ <input type="number" class="input-text qty text" step="1" min="0" max="9999" name="js-dgwt-wcas-quantity" value="1" title="Qty" size="4" inputmode="numeric">
200
+ <input type="button" value="+" class="plus button is-form">
201
+ </div>
202
+ <p class="product woocommerce add_to_cart_inline " style="">
203
+ <a href="#" data-quantity="1" class="button product_type_simple add_to_cart_button ajax_add_to_cart" rel="nofollow"><?php _e( 'Add to cart', 'woocommerce' ); ?></a>
204
+ </p>
205
+ </form>
206
+ </div>
207
 
208
+ </div>
209
 
210
 
211
+ </div>
212
 
213
+ </div>
214
 
215
+ </div>
216
 
217
+ </div>
218
 
219
+ </div>
220
+ </div>
partials/admin/settings.php CHANGED
@@ -1,50 +1,46 @@
1
  <?php
2
  // Exit if accessed directly
3
- if ( ! defined('ABSPATH')) {
4
- exit;
5
  }
6
 
7
  $advSettings = DGWT_WCAS()->settings->canSeeAdvSettings();
8
 
9
  $classes = array();
10
- if(dgoraAsfwFs()->is_premium()){
11
- $classes[] = 'dgwt-wcas-settings-pro';
12
  }
13
- if(DGWT_WCAS()->themeCompatibility->isCurrentThemeSupported()){
14
- $classes[] = 'dgwt-wcas-settings-theme-supported';
15
  }
16
  ?>
17
- <div class="wrap dgwt-wcas-settings <?php echo implode(' ', $classes); ?>">
18
 
19
 
20
- <h2 class="dgwt-wcas-settings__head">
21
- <img class="dgwt-wcas-settings__logo" src="<?php echo DGWT_WCAS_URL; ?>assets/img/logo-nobg-50.png" />
22
- <span class="dgwt-wcas-settings__title">
23
  <?php
24
- if (dgoraAsfwFs()->is_premium()) {
25
- _e('AJAX Search for WooCommerce (PRO) Settings', 'ajax-search-for-woocommerce');
26
  } else {
27
- _e('AJAX Search for WooCommerce Settings', 'ajax-search-for-woocommerce');
28
  }
29
  ?>
30
  </span>
31
- <span class="dgwt-wcas-settings__advanced js-dgwt-wcas-settings__advanced">
32
- <span class="js-dgwt-wcas-adv-settings-toggle woocommerce-input-toggle woocommerce-input-toggle--<?php echo $advSettings ? 'enabled' : 'disabled'; ?>"><?php _e('Show advanced settings', 'ajax-search-for-woocommerce'); ?></span>
33
- <span class="dgwt-wcas-adv-settings-label"><?php _e('Show advanced settings', 'ajax-search-for-woocommerce'); ?></span>
34
  </span>
35
- </h2>
36
 
 
37
 
38
- <?php echo DGWT_WCAS()->backwardCompatibility->notice(); ?>
 
 
 
 
 
39
 
40
-
41
- <?php $settings->show_navigation(); ?>
42
-
43
- <div class="dgwt-wcas-settings-body js-dgwt-wcas-settings-body">
44
- <?php
45
- require DGWT_WCAS_DIR . 'partials/admin/search-preview.php';
46
- $settings->show_forms();
47
- ?>
48
- </div>
49
-
50
- </div>
1
  <?php
2
  // Exit if accessed directly
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
  }
6
 
7
  $advSettings = DGWT_WCAS()->settings->canSeeAdvSettings();
8
 
9
  $classes = array();
10
+ if ( dgoraAsfwFs()->is_premium() ) {
11
+ $classes[] = 'dgwt-wcas-settings-pro';
12
  }
13
+ if ( DGWT_WCAS()->themeCompatibility->isCurrentThemeSupported() ) {
14
+ $classes[] = 'dgwt-wcas-settings-theme-supported';
15
  }
16
  ?>
17
+ <div class="wrap dgwt-wcas-settings <?php echo implode( ' ', $classes ); ?>">
18
 
19
 
20
+ <h2 class="dgwt-wcas-settings__head">
21
+ <img class="dgwt-wcas-settings__logo" src="<?php echo DGWT_WCAS_URL; ?>assets/img/logo-nobg-50.png"/>
22
+ <span class="dgwt-wcas-settings__title">
23
  <?php
24
+ if ( dgoraAsfwFs()->is_premium() ) {
25
+ _e( 'AJAX Search for WooCommerce (PRO) Settings', 'ajax-search-for-woocommerce' );
26
  } else {
27
+ _e( 'AJAX Search for WooCommerce Settings', 'ajax-search-for-woocommerce' );
28
  }
29
  ?>
30
  </span>
31
+ <span class="dgwt-wcas-settings__advanced js-dgwt-wcas-settings__advanced">
32
+ <span class="js-dgwt-wcas-adv-settings-toggle woocommerce-input-toggle woocommerce-input-toggle--<?php echo $advSettings ? 'enabled' : 'disabled'; ?>"><?php _e( 'Show advanced settings', 'ajax-search-for-woocommerce' ); ?></span>
33
+ <span class="dgwt-wcas-adv-settings-label"><?php _e( 'Show advanced settings', 'ajax-search-for-woocommerce' ); ?></span>
34
  </span>
35
+ </h2>
36
 
37
+ <?php $settings->show_navigation(); ?>
38
 
39
+ <div class="dgwt-wcas-settings-body js-dgwt-wcas-settings-body">
40
+ <?php
41
+ require DGWT_WCAS_DIR . 'partials/admin/search-preview.php';
42
+ $settings->show_forms();
43
+ ?>
44
+ </div>
45
 
46
+ </div>
 
 
 
 
 
 
 
 
 
 
partials/details-panel/product.php CHANGED
@@ -1,75 +1,75 @@
1
  <?php
2
 
3
  // Exit if accessed directly
4
- if ( ! defined('DGWT_WCAS_FILE')) {
5
- exit;
6
  }
7
 
8
  ?>
9
  <div class="dgwt-wcas-details-inner dgwt-wcas-details-inner-product">
10
- <div class="dgwt-wcas-product-details">
11
-
12
- <a href="<?php echo esc_url($vars->link); ?>" title="<?php echo $vars->name; ?>">
13
- <div class="dgwt-wcas-details-main-image">
14
- <img src="<?php echo esc_url($vars->imageSrc); ?>" alt="<?php echo esc_attr($vars->name); ?>">
15
- </div>
16
- </a>
17
-
18
- <div class="dgwt-wcas-details-space">
19
- <a class="dgwt-wcas-details-product-title" href="<?php echo esc_url($vars->link); ?>" title="<?php echo $vars->name; ?>">
20
- <?php echo $vars->name; ?>
21
- </a>
22
- <?php if ( ! empty($vars->sku)): ?>
23
- <span class="dgwt-wcas-details-product-sku"><?php echo $vars->sku; ?></span>
24
- <?php endif; ?>
25
-
26
- <?php if ($vars->reviewCount > 0): ?>
27
-
28
- <div class="dgwt-wcas-pd-rating">
29
- <?php echo $vars->ratingHtml . ' <span class="dgwt-wcas-pd-review">(' . $vars->reviewCount . ')</span>'; ?>
30
- </div>
31
-
32
- <?php endif; ?>
33
-
34
- <div class="dgwt-wcas-pd-price">
35
- <?php echo $vars->priceHtml; ?>
36
- </div>
37
-
38
- <div class="dgwt-wcas-details-hr"></div>
39
-
40
- <?php if ( ! empty($vars->desc)): ?>
41
- <div class="dgwt-wcas-details-desc">
42
- <?php echo wp_kses_post($vars->desc); ?>
43
- </div>
44
- <?php endif; ?>
45
-
46
- <div class="dgwt-wcas-details-hr"></div>
47
-
48
- <?php if ( ! empty($vars->stockAvailability)) {
49
- echo $vars->stockAvailability;
50
- }; ?>
51
-
52
- <div class="dgwt-wcas-pd-addtc js-dgwt-wcas-pd-addtc">
53
- <form class="dgwt-wcas-pd-addtc-form" action="" method="post" enctype="multipart/form-data">
54
- <?php
55
-
56
- if ($vars->showQuantity) {
57
- woocommerce_quantity_input(array(
58
- 'input_name' => 'js-dgwt-wcas-quantity',
59
- ), $vars->wooObject, true);
60
- }
61
-
62
- echo WC_Shortcodes::product_add_to_cart(array(
63
- 'id' => $vars->ID,
64
- 'show_price' => false,
65
- 'style' => '',
66
- ));
67
- ?>
68
- </form>
69
- </div>
70
-
71
- </div>
72
-
73
- </div>
74
  </div>
75
 
1
  <?php
2
 
3
  // Exit if accessed directly
4
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
5
+ exit;
6
  }
7
 
8
  ?>
9
  <div class="dgwt-wcas-details-inner dgwt-wcas-details-inner-product">
10
+ <div class="dgwt-wcas-product-details">
11
+
12
+ <a href="<?php echo esc_url( $vars->link ); ?>" title="<?php echo $vars->name; ?>">
13
+ <div class="dgwt-wcas-details-main-image">
14
+ <img src="<?php echo esc_url( $vars->imageSrc ); ?>" alt="<?php echo esc_attr( $vars->name ); ?>">
15
+ </div>
16
+ </a>
17
+
18
+ <div class="dgwt-wcas-details-space">
19
+ <a class="dgwt-wcas-details-product-title" href="<?php echo esc_url( $vars->link ); ?>" title="<?php echo $vars->name; ?>">
20
+ <?php echo $vars->name; ?>
21
+ </a>
22
+ <?php if ( ! empty( $vars->sku ) ): ?>
23
+ <span class="dgwt-wcas-details-product-sku"><?php echo $vars->sku; ?></span>
24
+ <?php endif; ?>
25
+
26
+ <?php if ( $vars->reviewCount > 0 ): ?>
27
+
28
+ <div class="dgwt-wcas-pd-rating">
29
+ <?php echo $vars->ratingHtml . ' <span class="dgwt-wcas-pd-review">(' . $vars->reviewCount . ')</span>'; ?>
30
+ </div>
31
+
32
+ <?php endif; ?>
33
+
34
+ <div class="dgwt-wcas-pd-price">
35
+ <?php echo $vars->priceHtml; ?>
36
+ </div>
37
+
38
+ <div class="dgwt-wcas-details-hr"></div>
39
+
40
+ <?php if ( ! empty( $vars->desc ) ): ?>
41
+ <div class="dgwt-wcas-details-desc">
42
+ <?php echo wp_kses_post( $vars->desc ); ?>
43
+ </div>
44
+ <?php endif; ?>
45
+
46
+ <div class="dgwt-wcas-details-hr"></div>
47
+
48
+ <?php if ( ! empty( $vars->stockAvailability ) ) {
49
+ echo $vars->stockAvailability;
50
+ }; ?>
51
+
52
+ <div class="dgwt-wcas-pd-addtc js-dgwt-wcas-pd-addtc">
53
+ <form class="dgwt-wcas-pd-addtc-form" action="" method="post" enctype="multipart/form-data">
54
+ <?php
55
+
56
+ if ( $vars->showQuantity ) {
57
+ woocommerce_quantity_input( array(
58
+ 'input_name' => 'js-dgwt-wcas-quantity',
59
+ ), $vars->wooObject, true );
60
+ }
61
+
62
+ echo WC_Shortcodes::product_add_to_cart( array(
63
+ 'id' => $vars->ID,
64
+ 'show_price' => false,
65
+ 'style' => '',
66
+ ) );
67
+ ?>
68
+ </form>
69
+ </div>
70
+
71
+ </div>
72
+
73
+ </div>
74
  </div>
75
 
partials/details-panel/term-product.php CHANGED
@@ -1,34 +1,34 @@
1
  <?php
2
 
3
  // Exit if accessed directly
4
- if ( !defined( 'DGWT_WCAS_FILE' ) ) {
5
- exit;
6
  }
7
 
8
  $rewCount = $product->getReviewCount();
9
  ?>
10
 
11
- <a class="dgwt-wcas-tax-product-details" href="<?php echo esc_url($product->getPermalink()); ?>" title="<?php echo esc_attr($product->getName()); ?>">
12
 
13
- <div class="dgwt-wcas-tpd-image">
14
- <?php echo $product->getThumbnail(); ?>
15
- </div>
16
 
17
- <div class="dgwt-wcas-tpd-rest">
18
 
19
- <span class="dgwt-wcas-tpd-rest-title"><?php echo esc_attr($product->getName()); ?></span>
20
 
21
- <?php if ($rewCount > 0): ?>
22
 
23
- <div class="dgwt-wcas-pd-rating">
24
- <?php echo $product->getRatingHtml() . ' <span class="dgwt-wcas-pd-review">(' . $rewCount . ')</span>'; ?>
25
- </div>
26
 
27
- <?php endif; ?>
28
 
29
- <div class="dgwt-wcas-tpd-price">
30
- <?php echo $product->getPriceHTML(); ?>
31
- </div>
32
 
33
- </div>
34
  </a>
1
  <?php
2
 
3
  // Exit if accessed directly
4
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
5
+ exit;
6
  }
7
 
8
  $rewCount = $product->getReviewCount();
9
  ?>
10
 
11
+ <a class="dgwt-wcas-tax-product-details" href="<?php echo esc_url( $product->getPermalink() ); ?>" title="<?php echo esc_attr( $product->getName() ); ?>">
12
 
13
+ <div class="dgwt-wcas-tpd-image">
14
+ <?php echo $product->getThumbnail(); ?>
15
+ </div>
16
 
17
+ <div class="dgwt-wcas-tpd-rest">
18
 
19
+ <span class="dgwt-wcas-tpd-rest-title"><?php echo esc_attr( $product->getName() ); ?></span>
20
 
21
+ <?php if ( $rewCount > 0 ): ?>
22
 
23
+ <div class="dgwt-wcas-pd-rating">
24
+ <?php echo $product->getRatingHtml() . ' <span class="dgwt-wcas-pd-review">(' . $rewCount . ')</span>'; ?>
25
+ </div>
26
 
27
+ <?php endif; ?>
28
 
29
+ <div class="dgwt-wcas-tpd-price">
30
+ <?php echo $product->getPriceHTML(); ?>
31
+ </div>
32
 
33
+ </div>
34
  </a>
partials/search-form.php CHANGED
@@ -1,48 +1,59 @@
1
  <?php
2
 
3
  use DgoraWcas\Helpers;
 
4
 
5
  // Exit if accessed directly
6
- if ( !defined( 'DGWT_WCAS_FILE' ) ) {
7
  exit;
8
  }
9
 
10
- $submitText = Helpers::getLabel('submit');
11
- $hasSubmit = DGWT_WCAS()->settings->getOption( 'show_submit_button' );
12
- $uniqueID = ++DGWT_WCAS()->searchInstances . substr(uniqid(), 10, 3);
13
- ?>
 
 
14
 
 
 
 
15
  <div class="dgwt-wcas-search-wrapp <?php echo Helpers::searchWrappClasses( $args ); ?>">
16
- <form class="dgwt-wcas-search-form" role="search" action="<?php echo Helpers::searchFormAction(); ?>" method="get">
17
- <div class="dgwt-wcas-sf-wrapp">
18
- <?php echo $hasSubmit !== 'on' ? Helpers::getMagnifierIco() : ''; ?>
19
- <label class="screen-reader-text" for="dgwt-wcas-search-input-<?php echo $uniqueID; ?>"><?php _e( 'Products search', 'ajax-search-for-woocommerce' ) ?></label>
20
-
21
- <input id="dgwt-wcas-search-input-<?php echo $uniqueID; ?>"
22
- type="search"
23
- class="dgwt-wcas-search-input"
24
- name="<?php echo Helpers::getSearchInputName(); ?>"
25
- value="<?php echo get_search_query() ?>"
26
- placeholder="<?php echo Helpers::getLabel('search_placeholder'); ?>"
27
- autocomplete="off"
28
- />
 
 
 
 
 
 
 
29
  <div class="dgwt-wcas-preloader"></div>
30
-
31
- <?php if($hasSubmit === 'on'): ?>
32
- <button type="submit" name="dgwt-wcas-search-submit" class="dgwt-wcas-search-submit"><?php echo empty( $submitText ) ? Helpers::getMagnifierIco() : esc_html( $submitText ); ?></button>
 
33
  <?php endif; ?>
34
-
35
- <input type="hidden" name="post_type" value="product" />
36
- <input type="hidden" name="dgwt_wcas" value="1" />
37
-
38
- <?php
39
- // WPML compatible
40
- if ( defined( 'ICL_LANGUAGE_CODE' ) ):
41
- ?>
42
- <input type="hidden" name="lang" value="<?php echo( ICL_LANGUAGE_CODE ); ?>" />
43
  <?php endif ?>
44
 
45
- <?php do_action('dgwt/wcas/form'); ?>
46
- </div>
47
- </form>
48
- </div>
1
  <?php
2
 
3
  use DgoraWcas\Helpers;
4
+ use DgoraWcas\Multilingual;
5
 
6
  // Exit if accessed directly
7
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
8
  exit;
9
  }
10
 
11
+ $layout = Helpers::getLayoutSettings();
12
+
13
+ $submitText = Helpers::getLabel( 'submit' );
14
+ $hasSubmit = DGWT_WCAS()->settings->getOption( 'show_submit_button' );
15
+ $uniqueID = ++ DGWT_WCAS()->searchInstances . substr( uniqid(), 10, 3 );
16
+ $layoutType = !empty($args['layout']) ? $args['layout'] : $layout->layout;
17
 
18
+ $customParams = apply_filters( 'dgwt/wcas/search_bar/custom_params', array(), DGWT_WCAS()->searchInstances );
19
+
20
+ ?>
21
  <div class="dgwt-wcas-search-wrapp <?php echo Helpers::searchWrappClasses( $args ); ?>">
22
+ <?php if(in_array($layoutType, array('icon', 'icon-flexible'))): ?>
23
+ <div class="dgwt-wcas-search-icon js-dgwt-wcas-search-icon-handler"><?php echo Helpers::getMagnifierIco('dgwt-wcas-ico-magnifier-handler'); ?></div>
24
+ <div class="dgwt-wcas-search-icon-arrow"></div>
25
+ <?php endif; ?>
26
+ <form class="dgwt-wcas-search-form" role="search" action="<?php echo Helpers::searchFormAction(); ?>" method="get">
27
+ <div class="dgwt-wcas-sf-wrapp">
28
+ <?php echo $hasSubmit !== 'on' ? Helpers::getMagnifierIco() : ''; ?>
29
+ <label class="screen-reader-text"
30
+ for="dgwt-wcas-search-input-<?php echo $uniqueID; ?>"><?php _e( 'Products search',
31
+ 'ajax-search-for-woocommerce' ) ?></label>
32
+
33
+ <input id="dgwt-wcas-search-input-<?php echo $uniqueID; ?>"
34
+ type="search"
35
+ class="dgwt-wcas-search-input"
36
+ name="<?php echo Helpers::getSearchInputName(); ?>"
37
+ value="<?php echo get_search_query() ?>"
38
+ placeholder="<?php echo Helpers::getLabel( 'search_placeholder' ); ?>"
39
+ autocomplete="off"
40
+ <?php echo ! empty( $customParams ) ? ' data-custom-params="' . htmlspecialchars(json_encode( (object) $customParams)) . '"' : ''; ?>
41
+ />
42
  <div class="dgwt-wcas-preloader"></div>
43
+
44
+ <?php if ( $hasSubmit === 'on' ): ?>
45
+ <button type="submit" name="dgwt-wcas-search-submit"
46
+ class="dgwt-wcas-search-submit"><?php echo empty( $submitText ) ? Helpers::getMagnifierIco() : esc_html( $submitText ); ?></button>
47
  <?php endif; ?>
48
+
49
+ <input type="hidden" name="post_type" value="product"/>
50
+ <input type="hidden" name="dgwt_wcas" value="1"/>
51
+
52
+ <?php if ( Multilingual::isWPML() ): ?>
53
+ <input type="hidden" name="lang" value="<?php echo Multilingual::getCurrentLanguage(); ?>"/>
 
 
 
54
  <?php endif ?>
55
 
56
+ <?php do_action( 'dgwt/wcas/form' ); ?>
57
+ </div>
58
+ </form>
59
+ </div>
partials/themes/storefront.php CHANGED
@@ -1,46 +1,44 @@
1
  <?php
2
 
3
  // Exit if accessed directly
4
- if ( !defined( 'DGWT_WCAS_FILE' ) ) {
5
- exit;
6
  }
7
 
8
- if (!function_exists('storefront_product_search')) {
9
- function storefront_product_search()
10
- {
11
- if (storefront_is_woocommerce_activated()) { ?>
12
- <div class="site-search">
13
- <?php echo do_shortcode('[wcas-search-form]'); ?>
14
- </div>
15
- <?php
16
- }
17
- }
18
  }
19
 
20
- add_action('wp_footer', 'dgwt_wcas_storefront_inverse_orientation', 100);
21
 
22
- function dgwt_wcas_storefront_inverse_orientation()
23
- {
24
- if (DGWT_WCAS()->settings->getOption('enable_mobile_overlay') === 'on') {
25
 
26
- ?>
27
- <script>
28
- (function ($) {
29
- $(window).on('load', function () {
30
- var $searchHandheld = $('.storefront-handheld-footer-bar .search a');
31
 
32
- $(document).on('click', '.storefront-handheld-footer-bar .search > a', function (e) {
33
- var $wrapper = $(this).parent();
34
- $wrapper.removeClass('active');
35
 
36
- setTimeout(function(){
37
- $wrapper.find('.js-dgwt-wcas-enable-mobile-form')[0].click();
38
- }, 200);
39
- e.preventDefault();
40
- });
41
- });
42
- }(jQuery));
43
- </script>
44
- <?php
45
- }
46
- }
1
  <?php
2
 
3
  // Exit if accessed directly
4
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
5
+ exit;
6
  }
7
 
8
+ if ( ! function_exists( 'storefront_product_search' ) ) {
9
+ function storefront_product_search() {
10
+ if ( storefront_is_woocommerce_activated() ) { ?>
11
+ <div class="site-search">
12
+ <?php echo do_shortcode( '[wcas-search-form]' ); ?>
13
+ </div>
14
+ <?php
15
+ }
16
+ }
 
17
  }
18
 
19
+ add_action( 'wp_footer', 'dgwt_wcas_storefront_inverse_orientation', 100 );
20
 
21
+ function dgwt_wcas_storefront_inverse_orientation() {
22
+ if ( DGWT_WCAS()->settings->getOption( 'enable_mobile_overlay' ) === 'on' ) {
 
23
 
24
+ ?>
25
+ <script>
26
+ (function ($) {
27
+ $(window).on('load', function () {
28
+ var $searchHandheld = $('.storefront-handheld-footer-bar .search a');
29
 
30
+ $(document).on('click', '.storefront-handheld-footer-bar .search > a', function (e) {
31
+ var $wrapper = $(this).parent();
32
+ $wrapper.removeClass('active');
33
 
34
+ setTimeout(function () {
35
+ $wrapper.find('.js-dgwt-wcas-enable-mobile-form')[0].click();
36
+ }, 200);
37
+ e.preventDefault();
38
+ });
39
+ });
40
+ }(jQuery));
41
+ </script>
42
+ <?php
43
+ }
44
+ }
partials/themes/woodmart.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
5
+ exit;
6
+ }
7
+
8
+ if ( ! function_exists( 'woodmart_search_form' ) ) {
9
+ function woodmart_search_form( $args = array() ) {
10
+ echo do_shortcode( '[wcas-search-form]' );
11
+ }
12
+ }
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: damian-gora
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LD2ALVRLXPZPC
4
  Tags: woocommerce search, ajax search, search by sku, product search, woocommerce
5
  Requires at least: 5.0
6
- Tested up to: 5.4
7
  Requires PHP: 5.5
8
- Stable tag: 1.6.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -37,6 +37,7 @@ Who doesn’t love instant, as-you-type suggestions? In 2020, customers simply e
37
  &#9989; **Grouping instant search results by type** – displaying e.g. first matching categories, then matching products
38
  &#9989; **Google Analytics** support
39
  &#9989; **WPML** compatible
 
40
  &#9989; **Personalization** of search bar and autocomplete suggestions - labels, colors, preloader, image and more
41
 
42
  = Try the PRO version =
@@ -135,6 +136,29 @@ You can read more and compare Pro and Free features here: [feature comparison](h
135
 
136
  == Changelog ==
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  = 1.6.3, March 11, 2020 =
139
  * ADD: Details panel - display stock quantity
140
  * FIX: Better support for the Elementor including popups and sticky menu
@@ -150,6 +174,8 @@ You can read more and compare Pro and Free features here: [feature comparison](h
150
  = 1.6.2, February 18, 2020 =
151
  * ADD: Details Panel - new layout for product overview and other UX improvements
152
  * ADD: Automatically regenerates images after first plugin activation
 
 
153
  * FIX: Highlighted no results suggestion
154
  * FIX: Better security
155
 
@@ -160,6 +186,7 @@ You can read more and compare Pro and Free features here: [feature comparison](h
160
  * ADD: Details panel - show "more products..." link for taxonomy type suggestion
161
  * ADD: Add &lt;form&gt; to quantity elements in a details panel
162
  * ADD: New filters and actions hook
 
163
  * FIX: Issue related to colors in plugin settings
164
  * FIX: Suggestions groups - improved limits
165
  * FIX: Pricing for taxonomy term in a details panel
@@ -170,6 +197,7 @@ You can read more and compare Pro and Free features here: [feature comparison](h
170
  * FIX: Storefront mobile search - more time for input autofocus
171
  * FIX: Disable quantity for Astra Pro theme - there were broken buttons
172
  * FIX: Minor CSS improvements
 
173
  * CHANGE: Decrease debounce time for better speed effect
174
  * CHANGE: Updated Freemius SDK v2.3.2
175
 
@@ -348,4 +376,4 @@ You can read more and compare Pro and Free features here: [feature comparison](h
348
  * FIX: Incorrect dimensions of the custom preloader
349
 
350
  = 0.9.0, May 17, 2016 =
351
- * ADD: First public release
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LD2ALVRLXPZPC
4
  Tags: woocommerce search, ajax search, search by sku, product search, woocommerce
5
  Requires at least: 5.0
6
+ Tested up to: 5.5
7
  Requires PHP: 5.5
8
+ Stable tag: 1.7.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
37
  &#9989; **Grouping instant search results by type** – displaying e.g. first matching categories, then matching products
38
  &#9989; **Google Analytics** support
39
  &#9989; **WPML** compatible
40
+ &#9989; **Polylang** compatible
41
  &#9989; **Personalization** of search bar and autocomplete suggestions - labels, colors, preloader, image and more
42
 
43
  = Try the PRO version =
136
 
137
  == Changelog ==
138
 
139
+ = 1.7.0, May 17, 2020 =
140
+ * ADD: Icon search instead of search bar (beta)
141
+ * ADD: Improvements on search results pages
142
+ * ADD: Integration with native WooCommerce filters
143
+ * ADD: Integration with Advanced AJAX Product Filters plugin by BeRocket
144
+ * ADD: Integration with WOOF – Products Filter for WooCommerce plugin by realmag777
145
+ * ADD: Integration with Product Filters for WooCommerce plugin by Automattic developed by Nexter
146
+ * ADD: Integration with Woo Product Filter plugin by WooBeWoo
147
+ * ADD: Integration with WooCommerce Product Table plugin by Barn2 media
148
+ * ADD: Support for TheGem theme
149
+ * ADD: Support for Impreza theme
150
+ * ADD: Support for Medicor theme
151
+ * ADD: Support for WoodMart theme
152
+ * ADD: Support for Polylang
153
+ * ADD: New filter and action hooks
154
+ * ADD: Dynamically loaded prices for WPML Multi-currency feature
155
+ * FIX: Mobile search - don't hide suggestions on blur
156
+ * FIX: Bug related to highlight keywords. For some cases it displayed &lt;strong&gt; tag.
157
+ * FIX: Delay on mouse hover effect
158
+ * FIX: Minor CSS improvements
159
+ * FIX: Broken mobile view on cart page in some cases
160
+
161
+
162
  = 1.6.3, March 11, 2020 =
163
  * ADD: Details panel - display stock quantity
164
  * FIX: Better support for the Elementor including popups and sticky menu
174
  = 1.6.2, February 18, 2020 =
175
  * ADD: Details Panel - new layout for product overview and other UX improvements
176
  * ADD: Automatically regenerates images after first plugin activation
177
+
178
+
179
  * FIX: Highlighted no results suggestion
180
  * FIX: Better security
181
 
186
  * ADD: Details panel - show "more products..." link for taxonomy type suggestion
187
  * ADD: Add &lt;form&gt; to quantity elements in a details panel
188
  * ADD: New filters and actions hook
189
+
190
  * FIX: Issue related to colors in plugin settings
191
  * FIX: Suggestions groups - improved limits
192
  * FIX: Pricing for taxonomy term in a details panel
197
  * FIX: Storefront mobile search - more time for input autofocus
198
  * FIX: Disable quantity for Astra Pro theme - there were broken buttons
199
  * FIX: Minor CSS improvements
200
+
201
  * CHANGE: Decrease debounce time for better speed effect
202
  * CHANGE: Updated Freemius SDK v2.3.2
203
 
376
  * FIX: Incorrect dimensions of the custom preloader
377
 
378
  = 0.9.0, May 17, 2016 =
379
+ * ADD: First public release
widget.php CHANGED
@@ -2,14 +2,14 @@
2
 
3
 
4
  // Exit if accessed directly
5
- if ( !defined( 'ABSPATH' ) ) {
6
  exit;
7
  }
8
 
9
  if ( class_exists( 'WC_Widget' ) ) {
10
 
11
 
12
- add_action( 'widgets_init', function() {
13
  register_widget( 'DGWT_WCAS_Search_Widget' );
14
  } );
15
 
@@ -20,23 +20,34 @@ if ( class_exists( 'WC_Widget' ) ) {
20
  */
21
  public function __construct() {
22
 
23
-
24
- $this->widget_cssclass = 'woocommerce dgwt-wcas-widget';
25
- $this->widget_description = __( 'AJAX (live) search form for WooCommerce', 'ajax-search-for-woocommerce' );
26
- $this->widget_id = 'dgwt_wcas_ajax_search';
27
- $this->widget_name = __( 'AJAX Search bar', 'ajax-search-for-woocommerce' );
28
- $this->settings = array(
29
- 'title' => array(
30
- 'type' => 'text',
31
- 'std' => '',
32
- 'label' => __( 'Title', 'ajax-search-for-woocommerce' )
 
 
 
 
 
 
 
 
 
 
 
33
  )
34
  );
35
 
36
-
37
  parent::__construct();
38
  }
39
 
 
40
  /**
41
  * Outputs the content of the widget
42
  *
@@ -47,11 +58,16 @@ if ( class_exists( 'WC_Widget' ) ) {
47
 
48
  $this->widget_start( $args, $instance );
49
 
50
- echo \DgoraWcas\Shortcode::getForm($args);
 
 
 
 
 
51
 
52
  $this->widget_end( $args );
53
  }
54
 
55
  }
56
 
57
- }
2
 
3
 
4
  // Exit if accessed directly
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
  exit;
7
  }
8
 
9
  if ( class_exists( 'WC_Widget' ) ) {
10
 
11
 
12
+ add_action( 'widgets_init', function () {
13
  register_widget( 'DGWT_WCAS_Search_Widget' );
14
  } );
15
 
20
  */
21
  public function __construct() {
22
 
23
+
24
+ $this->widget_cssclass = 'woocommerce dgwt-wcas-widget';
25
+ $this->widget_description = __( 'AJAX (live) search form for WooCommerce', 'ajax-search-for-woocommerce' );
26
+ $this->widget_id = 'dgwt_wcas_ajax_search';
27
+ $this->widget_name = __( 'AJAX Search bar', 'ajax-search-for-woocommerce' );
28
+ $this->settings = array(
29
+ 'title' => array(
30
+ 'type' => 'text',
31
+ 'std' => '',
32
+ 'label' => __( 'Title', 'ajax-search-for-woocommerce' )
33
+ ),
34
+ 'layout' => array(
35
+ 'type' => 'select',
36
+ 'std' => 'default',
37
+ 'options' => array(
38
+ 'default' => __( 'Default', 'ajax-search-for-woocommerce' ),
39
+ 'classic' => __( 'Search bar only', 'ajax-search-for-woocommerce' ),
40
+ 'icon' => __( 'Search icon', 'ajax-search-for-woocommerce' ),
41
+ 'icon-flexible' => __( 'Icon on mobile, search bar on desktop', 'ajax-search-for-woocommerce' ),
42
+ ),
43
+ 'label' => __( 'Layout', 'ajax-search-for-woocommerce' )
44
  )
45
  );
46
 
 
47
  parent::__construct();
48
  }
49
 
50
+
51
  /**
52
  * Outputs the content of the widget
53
  *
58
 
59
  $this->widget_start( $args, $instance );
60
 
61
+ $layoutParam = '';
62
+ if ( ! empty( $instance['layout'] ) && in_array( $instance['layout'], array( 'classic', 'icon', 'icon-flexible' ) ) ) {
63
+ $layoutParam = ' layout="' . $instance['layout'] . '"';
64
+ }
65
+
66
+ echo do_shortcode( '[wcas-search-form' . $layoutParam . ']' );
67
 
68
  $this->widget_end( $args );
69
  }
70
 
71
  }
72
 
73
+ }