Ajax Search for WooCommerce - Version 1.7.2

Version Description

Download this release

Release Info

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

Code changes from version 1.7.1 to 1.7.2

Files changed (52) hide show
  1. ajax-search-for-woocommerce.php +2 -2
  2. assets/css/admin-style.css +3 -2
  3. assets/css/style.css +10 -0
  4. assets/css/style.min.css +1 -1
  5. assets/js/admin.js +7 -0
  6. assets/js/admin.min.js +1 -1
  7. assets/js/search.js +46 -27
  8. assets/js/search.min.js +1 -1
  9. includes/Engines/WordPressNative/DetailsBox.php +47 -15
  10. includes/Engines/WordPressNative/Search.php +19 -6
  11. includes/Helpers.php +45 -4
  12. includes/Integrations/Brands.php +2 -1
  13. includes/Integrations/Plugins/BoosterIO/BoosterIO.php +0 -340
  14. includes/Integrations/Plugins/BoosterIO/Filters.php +0 -222
  15. includes/Integrations/Plugins/FacetWP/FacetWP.php +136 -0
  16. includes/Integrations/Plugins/WooCommerce/WooCommerce.php +0 -104
  17. includes/Integrations/Plugins/WooCommerceAJAXFilters/WooCommerceAJAXFilters.php +0 -47
  18. includes/Integrations/Plugins/WooCommerceProductFilters/WooCommerceProductFilters.php +0 -70
  19. includes/Integrations/Plugins/WooCommerceProductsFilter/WooCommerceProductsFilter.php +0 -132
  20. includes/Integrations/Plugins/WooCommerceProductsVisibility/Filters.php +57 -0
  21. includes/Integrations/Plugins/WooCommerceProductsVisibility/WooCommerceProductsVisibility.php +40 -0
  22. includes/Integrations/Plugins/WooProductFilter/WooProductFilter.php +95 -0
  23. includes/Integrations/Plugins/XforWooCommerceFilter/XforWooCommerceFilter.php +133 -0
  24. includes/Integrations/Solver.php +1 -0
  25. includes/Integrations/Themes/Avada/Avada.php +315 -0
  26. includes/Integrations/Themes/Bridge/Bridge.php +98 -0
  27. includes/Integrations/Themes/Ekommart/Ekommart.php +120 -0
  28. includes/Integrations/Themes/Savoy/Savoy.php +190 -0
  29. includes/Integrations/Themes/ShopIsle/ShopIsle.php +148 -0
  30. includes/Integrations/Themes/Shopical/Shopical.php +117 -0
  31. includes/Integrations/Themes/Shopkeeper/Shopkeeper.php +246 -0
  32. includes/Integrations/Themes/Sober/Sober.php +120 -0
  33. includes/Integrations/Themes/Storefront/Storefront.php +6 -0
  34. includes/Integrations/Themes/The7/The7.php +144 -0
  35. includes/Integrations/Themes/ThemesCompatibility.php +45 -2
  36. includes/Personalization.php +10 -0
  37. includes/Product.php +4 -4
  38. includes/ProductVariation.php +60 -0
  39. includes/Scripts.php +31 -30
  40. includes/Settings.php +8 -1
  41. includes/Shortcode.php +6 -3
  42. partials/details-panel/product-variation.php +76 -0
  43. partials/details-panel/product.php +3 -3
  44. partials/search-form.php +1 -1
  45. partials/themes/bridge.php +114 -0
  46. partials/themes/ekommart.php +48 -0
  47. partials/themes/savoy/product-searchform_nm.php +17 -0
  48. partials/themes/shopical.php +34 -0
  49. partials/themes/sober.php +34 -0
  50. partials/themes/storefront.php +15 -20
  51. partials/themes/the7-searchform.php +8 -0
  52. readme.txt +33 -3
ajax-search-for-woocommerce.php CHANGED
@@ -4,13 +4,13 @@
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.1
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
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.2
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.3
14
  *
15
  */
16
  // Exit if accessed directly
assets/css/admin-style.css CHANGED
@@ -35,8 +35,9 @@
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
 
42
  .dgwt-wcas-settings-hr {
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
+ .dgwt-wcas-settings > .updated:not(.fs-slug-ajax-search-for-woocommerce) {
40
+ display: none!important;
41
  }
42
 
43
  .dgwt-wcas-settings-hr {
assets/css/style.css CHANGED
@@ -50,6 +50,15 @@
50
  box-sizing: border-box;
51
  overflow-y: auto;
52
  }
 
 
 
 
 
 
 
 
 
53
  .dgwt-wcas-details-wrapp a:focus,
54
  .dgwt-wcas-suggestions-wrapp a:focus {
55
  outline:none;
@@ -1079,6 +1088,7 @@ body:not(.dgwt-wcas-is-details) .dgwt-wcas-suggestion:last-child {
1079
 
1080
  .dgwt-wcas-no-submit .dgwt-wcas-ico-magnifier {
1081
  height: 50%;
 
1082
  max-height: 20px;
1083
  width: 100%;
1084
  max-width: 20px;
50
  box-sizing: border-box;
51
  overflow-y: auto;
52
  }
53
+
54
+ .dgwt-wcas-search-wrapp *,
55
+ .dgwt-wcas-suggestions-wrapp *,
56
+ .dgwt-wcas-details-wrapp * {
57
+ -webkit-box-sizing: border-box;
58
+ -moz-box-sizing: border-box;
59
+ box-sizing: border-box;
60
+ }
61
+
62
  .dgwt-wcas-details-wrapp a:focus,
63
  .dgwt-wcas-suggestions-wrapp a:focus {
64
  outline:none;
1088
 
1089
  .dgwt-wcas-no-submit .dgwt-wcas-ico-magnifier {
1090
  height: 50%;
1091
+ margin: auto;
1092
  max-height: 20px;
1093
  width: 100%;
1094
  max-width: 20px;
assets/css/style.min.css CHANGED
@@ -1 +1 @@
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}
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 *,.dgwt-wcas-search-wrapp *,.dgwt-wcas-suggestions-wrapp *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.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%;margin:auto;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
@@ -145,6 +145,8 @@
145
  _this.hideOption(_this.$overlayMobileEl);
146
  _this.hideOption(_this.$mobileBreakpointEl);
147
 
 
 
148
  switch (currentVal) {
149
  case 'icon':
150
  break;
@@ -161,6 +163,8 @@
161
 
162
  _this.showOption(_this.$overlayMobileEl);
163
 
 
 
164
  if (_this.$overlayMobileEl.is(':checked')) {
165
  _this.showOption(_this.$mobileBreakpointEl);
166
  }
@@ -707,6 +711,7 @@
707
  onColorHandler: function () {
708
  var _this = this,
709
  options = [
 
710
  'bg_input_color',
711
  'text_input_color',
712
  'border_input_color',
@@ -1108,6 +1113,8 @@
1108
  _this.detailsWrapp.css('width', '');
1109
  }
1110
  },
 
 
1111
  onColorBgInputColor: function ($el, value) {
1112
  var _this = this;
1113
  if (_this.isColor(value)) {
145
  _this.hideOption(_this.$overlayMobileEl);
146
  _this.hideOption(_this.$mobileBreakpointEl);
147
 
148
+ $("input[id*='bg_search_icon_color']").closest('tr').show();
149
+
150
  switch (currentVal) {
151
  case 'icon':
152
  break;
163
 
164
  _this.showOption(_this.$overlayMobileEl);
165
 
166
+ $("input[id*='bg_search_icon_color']").closest('tr').hide();
167
+
168
  if (_this.$overlayMobileEl.is(':checked')) {
169
  _this.showOption(_this.$mobileBreakpointEl);
170
  }
711
  onColorHandler: function () {
712
  var _this = this,
713
  options = [
714
+ 'search_icon_color',
715
  'bg_input_color',
716
  'text_input_color',
717
  'border_input_color',
1113
  _this.detailsWrapp.css('width', '');
1114
  }
1115
  },
1116
+ onColorSearchIconColor: function ($el, value) {
1117
+ },
1118
  onColorBgInputColor: function ($el, value) {
1119
  var _this = this;
1120
  if (_this.isColor(value)) {
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={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);
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),s("input[id*='bg_search_icon_color']").closest("tr").show(),t){case"icon":break;case"icon-flexible":e&&this.showOption(this.$mobileBreakpointEl);break;default:e&&(this.showOption(this.$overlayMobileEl),s("input[id*='bg_search_icon_color']").closest("tr").hide(),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=["search_icon_color","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",""))},onColorSearchIconColor:function(s,t){},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
@@ -6,6 +6,7 @@
6
  * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
7
  *
8
  * Modified by Damian Góra: http://damiangora.com
 
9
  */
10
 
11
  /*jslint browser: true, white: true, single: true, this: true, multivar: true */
@@ -256,17 +257,18 @@
256
  positionFixed: false,
257
  debounceWaitMs: 400,
258
  sendGAEvents: true,
259
- };
 
260
 
261
  function _lookupFilter(suggestion, originalQuery, queryLowerCase) {
262
  return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
263
- };
264
 
265
  function _transformResult(response) {
266
  return typeof response === 'string' ? $.parseJSON(response) : response;
267
- };
268
 
269
- function _formatResult(suggestionValue, currentValue, highlight) {
270
  // Do not replace anything if there current value is empty
271
  if (!currentValue) {
272
  return suggestionValue;
@@ -276,6 +278,10 @@
276
  suggestionValue = utils.highlight(suggestionValue, currentValue);
277
  }
278
 
 
 
 
 
279
  return suggestionValue.replace(/&/g, '&amp;')
280
  .replace(/</g, '&lt;')
281
  .replace(/>/g, '&gt;')
@@ -283,8 +289,9 @@
283
  .replace(/&lt;sup/g, '<sup')
284
  .replace(/&lt;\/sup/g, '</sup')
285
  .replace(/sup&gt;/g, 'sup>')
286
- .replace(/&lt;(\/?strong)&gt;/g, '<$1>');
287
- };
 
288
 
289
  DgwtWcasAutocompleteSearch.prototype = {
290
  initialize: function () {
@@ -617,14 +624,13 @@
617
  },
618
  initMobileMode: function () {
619
  var that = this;
 
620
 
621
  if (
622
- that.options.overlayMobile
623
  && that.isMobileMode()
624
  ) {
625
 
626
- var $formWrapper = that.getFormWrapper();
627
-
628
  $formWrapper.prepend('<div class="js-dgwt-wcas-enable-mobile-form dgwt-wcas-enable-mobile-form"></div>');
629
 
630
  var $el = $formWrapper.find('.js-dgwt-wcas-enable-mobile-form');
@@ -1841,7 +1847,7 @@
1841
  title = title.length > 0 ? ' title="' + title + '"' : '';
1842
 
1843
  html += '<div class="' + classes + '" data-index="' + i + '">';
1844
- html += '<span' + title + ' class="' + innerClass + '">' + prepend + formatResult(suggestion.value, value, highlight) + append + '</span>';
1845
  html += '</div>';
1846
  } else {
1847
 
@@ -1867,16 +1873,16 @@
1867
 
1868
  // Title
1869
  html += '<span class="dgwt-wcas-st">';
1870
- html += '<span class="dgwt-wcas-st-title">' + formatResult(suggestion.value, value, true) + parent + '</span>';
1871
 
1872
  // SKU
1873
  if (options.showSKU === true && typeof suggestion.sku != 'undefined' && suggestion.sku.length > 0) {
1874
- html += '<span class="dgwt-wcas-sku">(' + dgwt_wcas.labels.sku_label + ' ' + formatResult(suggestion.sku, value, true) + ')</span>';
1875
  }
1876
 
1877
  // Description
1878
  if (options.showDescription === true && typeof suggestion.desc != 'undefined' && suggestion.desc) {
1879
- html += '<span class="dgwt-wcas-sd">' + formatResult(suggestion.desc, value, true) + '</span>';
1880
  }
1881
 
1882
  html += '</span>';
@@ -2416,27 +2422,39 @@
2416
  var that = this;
2417
  if (that.options.sendGAEvents) {
2418
  try {
2419
-
2420
  if (typeof gtag !== 'undefined') {
2421
  gtag('event', 'autocomplete_search', {
2422
  'event_label': label,
2423
  'event_category': category
2424
  });
2425
- return;
2426
- }
2427
-
2428
- if (typeof ga !== 'undefined') {
2429
- ga('send', {
2430
- hitType: 'event',
2431
- eventCategory: category,
2432
- eventAction: 'autocomplete_search',
2433
- eventLabel: label
2434
- });
2435
- }
2436
-
2437
  } catch (error) {
2438
  }
2439
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2440
  }
2441
  };
2442
 
@@ -2512,11 +2530,12 @@
2512
  showHeadings: dgwt_wcas.show_headings == 1 ? true : false,
2513
  isPremium: dgwt_wcas.is_premium == 1 ? true : false,
2514
  taxonomyBrands: dgwt_wcas.taxonomy_brands,
2515
- overlayMobile: dgwt_wcas.overlay_mobile == 1 ? true : false,
2516
  mobileBreakpoint: mobileBreakpoint,
2517
  mobileOverlayWrapper: dgwt_wcas.mobile_overlay_wrapper,
2518
  debounceWaitMs: dgwt_wcas.debounce_wait_ms,
2519
  sendGAEvents: dgwt_wcas.send_ga_events,
 
 
2520
  };
2521
 
2522
  $('.dgwt-wcas-search-input').dgwtWcasAutocomplete(window.dgwt_wcas.config);
6
  * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
7
  *
8
  * Modified by Damian Góra: http://damiangora.com
9
+ * Minify: https://javascript-minifier.com/
10
  */
11
 
12
  /*jslint browser: true, white: true, single: true, this: true, multivar: true */
257
  positionFixed: false,
258
  debounceWaitMs: 400,
259
  sendGAEvents: true,
260
+ enableGASiteSearchModule: false,
261
+ }
262
 
263
  function _lookupFilter(suggestion, originalQuery, queryLowerCase) {
264
  return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
265
+ }
266
 
267
  function _transformResult(response) {
268
  return typeof response === 'string' ? $.parseJSON(response) : response;
269
+ }
270
 
271
+ function _formatResult(suggestionValue, currentValue, highlight, options) {
272
  // Do not replace anything if there current value is empty
273
  if (!currentValue) {
274
  return suggestionValue;
278
  suggestionValue = utils.highlight(suggestionValue, currentValue);
279
  }
280
 
281
+ if(!options.convertHtml){
282
+ return suggestionValue;
283
+ }
284
+
285
  return suggestionValue.replace(/&/g, '&amp;')
286
  .replace(/</g, '&lt;')
287
  .replace(/>/g, '&gt;')
289
  .replace(/&lt;sup/g, '<sup')
290
  .replace(/&lt;\/sup/g, '</sup')
291
  .replace(/sup&gt;/g, 'sup>')
292
+ .replace(/&lt;(\/?(strong|b))&gt;/g, '<$1>');
293
+
294
+ }
295
 
296
  DgwtWcasAutocompleteSearch.prototype = {
297
  initialize: function () {
624
  },
625
  initMobileMode: function () {
626
  var that = this;
627
+ var $formWrapper = that.getFormWrapper();
628
 
629
  if (
630
+ $formWrapper.hasClass('js-dgwt-wcas-mobile-overlay-enabled')
631
  && that.isMobileMode()
632
  ) {
633
 
 
 
634
  $formWrapper.prepend('<div class="js-dgwt-wcas-enable-mobile-form dgwt-wcas-enable-mobile-form"></div>');
635
 
636
  var $el = $formWrapper.find('.js-dgwt-wcas-enable-mobile-form');
1847
  title = title.length > 0 ? ' title="' + title + '"' : '';
1848
 
1849
  html += '<div class="' + classes + '" data-index="' + i + '">';
1850
+ html += '<span' + title + ' class="' + innerClass + '">' + prepend + formatResult(suggestion.value, value, highlight, options) + append + '</span>';
1851
  html += '</div>';
1852
  } else {
1853
 
1873
 
1874
  // Title
1875
  html += '<span class="dgwt-wcas-st">';
1876
+ html += '<span class="dgwt-wcas-st-title">' + formatResult(suggestion.value, value, true, options) + parent + '</span>';
1877
 
1878
  // SKU
1879
  if (options.showSKU === true && typeof suggestion.sku != 'undefined' && suggestion.sku.length > 0) {
1880
+ html += '<span class="dgwt-wcas-sku">(' + dgwt_wcas.labels.sku_label + ' ' + formatResult(suggestion.sku, value, true, options) + ')</span>';
1881
  }
1882
 
1883
  // Description
1884
  if (options.showDescription === true && typeof suggestion.desc != 'undefined' && suggestion.desc) {
1885
+ html += '<span class="dgwt-wcas-sd">' + formatResult(suggestion.desc, value, true, options) + '</span>';
1886
  }
1887
 
1888
  html += '</span>';
2422
  var that = this;
2423
  if (that.options.sendGAEvents) {
2424
  try {
 
2425
  if (typeof gtag !== 'undefined') {
2426
  gtag('event', 'autocomplete_search', {
2427
  'event_label': label,
2428
  'event_category': category
2429
  });
2430
+ } else if (typeof ga !== 'undefined') {
2431
+ var tracker = ga.getAll()[0];
2432
+ if (tracker) tracker.send({
2433
+ hitType: 'event',
2434
+ eventCategory: category,
2435
+ eventAction: 'autocomplete_search',
2436
+ eventLabel: label
2437
+ });
2438
+ }
 
 
 
2439
  } catch (error) {
2440
  }
2441
  }
2442
+ if (that.options.enableGASiteSearchModule) {
2443
+ try {
2444
+ if (typeof gtag !== 'undefined') {
2445
+ gtag('event', 'page_view', {
2446
+ 'page_path': '/?s=' + encodeURI(label) + '&post_type=product&dgwt_wcas=1',
2447
+ });
2448
+ } else if (typeof ga !== 'undefined') {
2449
+ var tracker2 = ga.getAll()[0];
2450
+ if (tracker2) {
2451
+ tracker2.set('page', '/?s=' + encodeURI(label) + '&post_type=product&dgwt_wcas=1');
2452
+ tracker2.send('pageview');
2453
+ }
2454
+ }
2455
+ } catch (error) {
2456
+ }
2457
+ }
2458
  }
2459
  };
2460
 
2530
  showHeadings: dgwt_wcas.show_headings == 1 ? true : false,
2531
  isPremium: dgwt_wcas.is_premium == 1 ? true : false,
2532
  taxonomyBrands: dgwt_wcas.taxonomy_brands,
 
2533
  mobileBreakpoint: mobileBreakpoint,
2534
  mobileOverlayWrapper: dgwt_wcas.mobile_overlay_wrapper,
2535
  debounceWaitMs: dgwt_wcas.debounce_wait_ms,
2536
  sendGAEvents: dgwt_wcas.send_ga_events,
2537
+ convertHtml: dgwt_wcas.convert_html,
2538
+ enableGASiteSearchModule: dgwt_wcas.enable_ga_site_search_module,
2539
  };
2540
 
2541
  $('.dgwt-wcas-search-input').dgwtWcasAutocomplete(window.dgwt_wcas.config);
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,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.actionTriggerSource="",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(){var s=e.getActiveInstance();s.actionTriggerSource="click",s.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.actionTriggerSource="enter",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||"enter"===this.actionTriggerSource&&"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)})})})}()});
1
+ !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports&&"function"==typeof require?e(require("jquery")):e(jQuery)}(function(e){"use strict";var t={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.setAttribute("unselectable","on"),t},highlight:function(e,s){if(dgwt_wcas.is_premium){var i,o=s.split(/ /),a=!1;if(o)for(o=o.sort(function(e,t){return t.length-e.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="("+t.escapeRegExChars(n.trim())+")";e=e.replace(new RegExp(r,"gi"),"^^$1@@"),a=!0}}a&&(e=(e=e.replace(/\^\^/g,"<strong>")).replace(/@@/g,"</strong>"))}else r="("+t.escapeRegExChars(s)+")",e=e.replace(new RegExp(r,"gi"),"<strong>$1</strong>");return e},debounce:function(e,t){var i,o=(new Date).getUTCMilliseconds();if(0===s.id.length)return s.id=o,void e();s.id=o,i=setTimeout(function(){o===s.id?(e(),s.id=""):clearTimeout(i)},t)},mouseHoverDebounce:function(t,s,i){var o;o=setTimeout(function(){e(s+":hover").length>0?t():clearTimeout(o)},i)},getActiveInstance:function(){var t,s=e(".dgwt-wcas-search-wrapp.dgwt-wcas-active");return s.length>0&&s.each(function(){var s=e(this).find(".dgwt-wcas-search-input");if("object"==typeof s.data("autocomplete"))return t=s.data("autocomplete"),!1}),t}},s={id:"",callback:null,ajaxSettings:null,object:null},i=27,o=9,a=13,n=38,r=39,l=40,c=e.noop;function d(t,s){this.element=t,this.el=e(t),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.actionTriggerSource="",this.options=e.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=t,e.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(e,s,i,o){if(!s)return e;i&&(e=t.highlight(e,s));if(!o.convertHtml)return e;return e.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|b))&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(e,t,s){return-1!==e.value.toLowerCase().indexOf(s)},paramName:"query",transformResult:function(t){return"string"==typeof t?e.parseJSON(t):t},noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1,positionFixed:!1,debounceWaitMs:400,sendGAEvents:!0,enableGASiteSearchModule:!1},d.prototype={initialize:function(){var t=this;t.element.setAttribute("autocomplete","off"),t.createContainers(),t.registerEventsSearchBar(),t.registerEventsSuggestions(),t.registerEventsDetailsPanel(),t.registerIconHandler(),t.registerEventsFixedMenu(),t.fixPositionCapture=function(){t.adjustContainerWidth(),t.visible&&t.fixPosition()},e(window).on("resize.autocomplete",t.fixPositionCapture),t.initMobileMode(),t.hideAfterClickOutsideListener(),t.suggestionsContainer.addClass("js-dgwt-wcas-initialized"),t.detailsContainer&&t.detailsContainer.length>0&&t.detailsContainer.addClass("js-dgwt-wcas-initialized")},createContainers:function(t){var s=this.options;0==e("."+s.containerClass).length?(this.suggestionsContainer=e(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=e("."+this.options.containerClass),this.canShowDetailsBox()&&(0==e("."+s.containerDetailsClass).length?(this.detailsContainer=e(d.utils.createNode(s.containerDetailsClass)),this.detailsContainer.appendTo(s.appendTo||"body"),this.detailsContainer.addClass("woocommerce")):this.detailsContainer=e("."+s.containerDetailsClass))},registerEventsSearchBar:function(){var s=this;e(document).on("click.autocomplete","."+s.options.closeTrigger,function(){var s=t.getActiveInstance();s.hide(),s.clear(!1),e(this).removeClass(s.options.closeTrigger),e(this).closest("."+s.options.searchFormClass).find("."+s.options.searchInputClass).val("").focus()}),s.el.closest("."+s.options.formClass).on("submit.autocomplete",function(t){s.suggestions.length>0&&e.each(s.suggestions,function(e,i){if(void 0!==i.type&&"product_variation"==i.type)return s.select(e),t.preventDefault(),!1})}),e(window).on("load",function(){s.positionPreloader()}),s.el.on("keydown.autocomplete",function(e){s.onKeyPress(e)}),s.el.on("keyup.autocomplete",function(e){s.onKeyUp(e)}),s.el.on("blur.autocomplete",function(){s.onBlur()}),s.el.on("focus.autocomplete",function(){s.onFocus()}),s.el.on("change.autocomplete",function(e){s.onKeyUp(e)}),s.el.on("input.autocomplete",function(e){s.onKeyUp(e)})},registerEventsSuggestions:function(){var s="."+this.classes.suggestion;this.getSuggestionsContainer().hasClass("js-dgwt-wcas-initialized")||(e(document).on("mouseenter.autocomplete",s,function(){var s=t.getActiveInstance();if(void 0!==s){var i=e(this).data("index"),o='.dgwt-wcas-suggestion[data-index="'+i+'"]',a=s.canShowDetailsBox()?100:1;s.selectedIndex!=i&&t.mouseHoverDebounce(function(){s.selectedIndex!==i&&(s.latestActivateSource="mouse",s.getDetails(s.suggestions[i]),s.activate(i))},o,a)}}),e(document).on("click.autocomplete",s,function(){var s=t.getActiveInstance();s.actionTriggerSource="click",s.select(e(this).data("index"))}),e(document).on("click.autocomplete","."+this.options.containerClass,function(){var e=t.getActiveInstance();clearTimeout(e.blurTimeoutId)}))},registerEventsDetailsPanel:function(){var s=this.getDetailsContainer();this.canShowDetailsBox()&&!s.hasClass("js-dgwt-wcas-initialized")&&(e(document).on("click.autocomplete","."+this.options.containerDetailsClass,function(){var e=t.getActiveInstance();clearTimeout(e.blurTimeoutId)}),e(document).on("change",'[name="js-dgwt-wcas-quantity"]',function(t){e(this).closest(".js-dgwt-wcas-pd-addtc").find("[data-quantity]").attr("data-quantity",e(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(e){var t=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),t.focus()})}}),0==e(".js-dgwt-wcas-initialized").length&&e(".js-dgwt-wcas-search-icon-handler").length>0&&e(document).click(function(i){if(e(".dgwt-wcas-layout-icon-open").length){var o=e(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=t.getActiveInstance();if(void 0!==a){var n=a.getFormWrapper().find("."+s.options.formClass);n.hide(),a.hide(!0),n.css({left:"0"})}s.hideIconModeSearch()}}}),e(window).on("resize.autocomplete",function(){s.applyFlexibleMode()}),e(window).on("load",function(){s.applyFlexibleMode()})},registerEventsFixedMenu:function(){var t=this;e(window).on("scroll",function(){if(t.suggestions.length>0&&t.elementOrParentIsFixed(t.getFormWrapper()))if(0===e(window).scrollTop()){[1,10,20,30,40,50,60,70,80,90,120,140,170,200,250,400,700,1e3,2e3].forEach(function(e){setTimeout(function(){t.fixHeight(),t.fixPositionCapture()},e)})}else t.fixHeight(),t.fixPositionCapture()})},initMobileMode:function(){var e=this,t=e.getFormWrapper();t.hasClass("js-dgwt-wcas-mobile-overlay-enabled")&&e.isMobileMode()&&(t.prepend('<div class="js-dgwt-wcas-enable-mobile-form dgwt-wcas-enable-mobile-form"></div>'),t.find(".js-dgwt-wcas-enable-mobile-form").on("click",function(t){e.enableOverlayMobile()}))},applyFlexibleMode:function(){var t=e(".js-dgwt-wcas-layout-icon-flexible");t.length&&(this.isMobileMode()?(t.addClass("js-dgwt-wcas-layout-icon"),t.addClass("dgwt-wcas-layout-icon")):(t.removeClass("js-dgwt-wcas-layout-icon"),t.removeClass("dgwt-wcas-layout-icon")),t.addClass("dgwt-wcas-layout-icon-flexible-loaded"))},onFocus:function(){e("."+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 t=this,s=t.options,i=t.el.val(),o=t.getQuery(i);t.isMobileMode()||(t.blurTimeoutId=setTimeout(function(){t.hide(),t.selection&&t.currentValue!==o&&(s.onInvalidateSelection||e.noop).call(t.element)},200))},abortAjax:function(){this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null)},setOptions:function(t){var s=this,i=s.getSuggestionsContainer(),o=e.extend({},s.options,t);(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(e){e&&this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){this.disabled=!0,clearTimeout(this.onChangeTimeout),this.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var e=this.getFormOffset();this.getSuggestionsContainer().css(e),this.canShowDetailsBox()&&this.fixPositionDetailsBox()},fixPositionDetailsBox:function(){var t=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),t.width()>=550)return e("body").removeClass("dgwt-wcas-details-outside"),e("body").removeClass("dgwt-wcas-details-right"),e("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=e(window).width(),c=i.width(),d=i.offset();e("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,e("body").removeClass("dgwt-wcas-details-right"),e("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,e("body").removeClass("dgwt-wcas-details-left"),e("body").addClass("dgwt-wcas-details-right")),u&&g?(e("body").removeClass("dgwt-wcas-details-left"),e("body").removeClass("dgwt-wcas-details-right"),e("body").addClass("dgwt-wcas-details-notfit")):e("body").removeClass("dgwt-wcas-details-notfit")},fixHeight:function(){if(1!=this.options.showDetailsPanel)return!1;var e=this.getSuggestionsContainer(),t=this.getDetailsContainer();e.css("height","auto"),t.css("height","auto");var s=e.outerHeight(),i=t.outerHeight();return e.find(".dgwt-wcas-suggestion:last-child").removeClass("dgwt-wcas-suggestion-no-border-bottom"),!(s<=340&&i<=340)&&(e.find(".dgwt-wcas-suggestion:last-child").addClass("dgwt-wcas-suggestion-no-border-bottom"),i<s&&t.css("height",s+"px"),s<i&&e.css("height",i+"px"),!1)},automaticAlignment:function(){var e=this,t=e.getFormWrapper().find(".dgwt-wcas-search-input"),s=e.getSuggestionsContainer(),i=e.getDetailsContainer();if(null==e.autoAligmentprocess){var o=[t.width(),s.height()];e.options.showDetailsPanel&&(o[2]=i.height()),e.autoAligmentprocess=setInterval(function(){var a=[t.width(),s.height()];e.options.showDetailsPanel&&(a[2]=i.height());for(var n=0;n<o.length;n++)if(o[n]!=a[n]){e.fixHeight(),e.fixPositionCapture(),o=a;break}e.options.showDetailsPanel&&(i.find(".dgwt-wcas-details-inner").height()-i.height()>2&&e.fixHeight())},10)}},getFormOffset:function(){var t=this.getFormWrapper(),s=this.getSuggestionsContainer(),i=this.options.orientation,o=t.outerHeight(),a=this.el.outerHeight(),n=this.el.offset(),r={top:n.top,left:n.left};if("auto"===i){var l=e(window).height(),c=e(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=t[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 e("."+this.options.containerClass)},getDetailsContainer:function(){return e("."+this.options.containerDetailsClass)},scrollDownSuggestions:function(){var e=this.getSuggestionsContainer();e[0].scrollTop=e[0].scrollHeight},isCursorAtEnd:function(){var e,t=this.el.val().length,s=this.element.selectionStart;return"number"==typeof s?s===t:!document.selection||((e=document.selection.createRange()).moveStart("character",-t),t===e.text.length)},onKeyPress:function(e){if(this.disabled||this.visible||e.which!==l||!this.currentValue){if(!this.disabled&&this.visible){switch(e.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.actionTriggerSource="enter",this.select(this.selectedIndex);break;case n:this.moveUp();break;case l:this.moveDown();break;default:return}e.stopImmediatePropagation(),e.preventDefault()}}else this.suggest()},onKeyUp:function(e){var t=this;if(!t.disabled){switch(e.which){case n:case l:return}clearTimeout(t.onChangeTimeout),t.currentValue!==t.el.val()&&(t.findBestHint(),t.options.deferRequestBy>0?t.onChangeTimeout=setTimeout(function(){t.onValueChange()},t.options.deferRequestBy):t.onValueChange())}},onValueChange:function(){if(this.ignoreValueChange)this.ignoreValueChange=!1;else{var t=this.options,s=this.el.val(),i=this.getQuery(s);this.selection&&this.currentValue!==i&&(this.selection=null,(t.onInvalidateSelection||e.noop).call(this.element)),clearTimeout(this.onChangeTimeout),this.currentValue=s,this.selectedIndex=-1,t.triggerSelectOnValidInput&&this.isExactMatch(i)?this.select(0):i.length<t.minChars?(e("."+this.options.closeTrigger).removeClass(this.options.closeTrigger),this.hide()):this.getSuggestions(i)}},isExactMatch:function(e){var t=this.suggestions;return 1===t.length&&t[0].value.toLowerCase()===e.toLowerCase()},canShowDetailsBox:function(){return 1==this.options.showDetailsPanel&&!this.isMobileMode()},isMobileMode:function(){return e(window).width()<this.options.mobileBreakpoint},getQuery:function(t){var s,i=this.options.delimiter;return i?(s=t.split(i),e.trim(s[s.length-1])):t},getSuggestionsLocal:function(t){var s,i=this.options,o=t.toLowerCase(),a=i.lookupFilter,n=parseInt(i.lookupLimit,10);return s={suggestions:e.grep(i.lookup,function(e){return a(e,t,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,e.isFunction(c.lookup)?c.lookup(i,function(e){l.suggestions=e.suggestions,l.suggest(),l.selectFirstSuggestion(e.suggestions),c.onSearchComplete.call(l.element,i,e.suggestions)}):(l.isLocal?o=l.getSuggestionsLocal(i):(e.isFunction(d)&&(d=d.call(l.element,i)),n=d+"?"+e.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},e.extend(r,c.ajaxSettings),s.object=l,s.ajaxSettings=r,t.debounce(function(){var t=s.object,o=s.ajaxSettings;t.currentRequest=e.ajax(o).done(function(e){var s;t.currentRequest=null,void 0!==(s=t.options.transformResult(e,i)).suggestions&&(t.processResponse(s,i,n),t.selectFirstSuggestion(s.suggestions),1===s.suggestions.length&&void 0!==s.suggestions[0].type&&"no-results"===s.suggestions[0].type?t.gaEvent(i,"Autocomplete Search without results"):t.gaEvent(i,"Autocomplete Search with results")),t.fixPositionCapture(),t.options.onSearchComplete.call(t.element,i,s.suggestions),t.updatePrices()}).fail(function(e,s,o){t.options.onSearchError.call(t.element,i,e,s,o)})},c.debounceWaitMs))))},getDetails:function(t){var s=this;if(!s.canShowDetailsBox())return!1;if(null!=t&&void 0!==t.type&&("string"!=typeof t.more_products||"more_products"!==t.more_products)){s.fixHeight();var i,o=s.getDetailsContainer(),a=s.prepareSuggestionObjectID(t);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(e.each(s.suggestions,function(e,t){if(void 0!==t.type&&"more_products"!=t.type&&"headline"!=t.type){var i={objectID:s.prepareSuggestionObjectID(t),value:null!=t.value?t.value:""};n.items.push(i)}}),o.html(""),s.preloader("show","details","",!0),-1!=e.inArray(a,s.detailsRequestsSent))return;s.detailsRequestsSent.push(a),e.ajax({data:n,type:"post",url:dgwt_wcas.ajax_details_endpoint,success:function(e){var t="string"==typeof e?jQuery.parseJSON(e):e;if(void 0!==t.items)for(var i=0;i<t.items.length;i++){var a=t.items[i].objectID;if(s.cachedDetails[a]={html:t.items[i].html},void 0!==t.items[i].price&&t.items[i].price.length>0&&(s.cachedPrices[a]=t.items[i].price),void 0!==t.items[i].imageSrc&&t.items[i].imageSrc.length>0)(new Image).src=t.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(e,t){s.preloader("hide","details","",!0),o.html(e),s.fixPositionCapture(),s.fixHeight()}})}e(document).trigger("dgwtWcasDetailsPanelLoaded",s)}},updatePrices:function(t){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(!t&&a.length>0){var r={action:void 0===dgwt_wcas.action_get_prices?"dgwt_wcas_get_prices":dgwt_wcas.action_get_prices,items:a};e.ajax({data:r,type:"post",url:dgwt_wcas.ajax_prices_endpoint,success:function(e){if(void 0!==e.success&&e.success&&e.data.length>0)for(s=0;s<e.data.length;s++){var t=e.data[s].id,a=e.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==t){var n="product__"+t;o.cachedPrices[n]=a,o.updatePrice(i,a)}}},error:function(e,t){}})}}},updatePrice:function(t,s){if(void 0!==this.suggestions[t]){this.suggestions[t].price=s;var i=e(".dgwt-wcas-suggestions-wrapp").find('[data-index="'+t+'"] .dgwt-wcas-sp');i.length&&i.html(s)}},applyCustomParams:function(e){if("object"==typeof dgwt_wcas.custom_params){var t=dgwt_wcas.custom_params;for(var s in t)e[s]=t[s]}var i=this.el.data("custom-params");if("object"==typeof i)for(var s in i)e[s]=i[s];return e},applyPreloaderForPrice:function(t){if(void 0!==this.suggestions[t]){var s=e(".dgwt-wcas-suggestions-wrapp").find('[data-index="'+t+'"] .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(e){var t="";return void 0!==e&&void 0!==e.type&&(null!=e.post_id&&(t=e.type+"__"+e.post_id,"product_variation"===e.type&&(t+="__"+e.variation_id),void 0!==e.post_type&&(t=e.type+"__"+e.post_id+"__"+e.post_type)),null!=e.term_id&&null!=e.taxonomy&&(t=e.type+"__"+e.term_id+"__"+e.taxonomy)),t},selectFirstSuggestion:function(t){var s=0,i=!1;this.canShowDetailsBox()&&("undefined"!=t&&t.length>0&&e.each(this.suggestions,function(e,t){if(void 0!==t.type&&"more_products"!=t.type&&"headline"!=t.type&&"no-results"!=t.type)return s=e,!1;void 0!==t.type&&"no-results"!==t.type||(i=!0)}),i||(this.latestActivateSource="system",this.getDetails(t[s]),this.activate(s)))},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(t){var s=this.getFormWrapper(),i=this.getSuggestionsContainer(),o=this.getDetailsContainer();if(e.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(),e("body").removeClass("dgwt-wcas-open"),e("body").removeClass("dgwt-wcas-block-scroll"),e("body").removeClass("dgwt-wcas-is-details"),e("body").removeClass("dgwt-wcas-full-width"),e("body").removeClass("dgwt-wcas-nores"),e("body").removeClass("dgwt-wcas-details-outside"),e("body").removeClass("dgwt-wcas-details-right"),e("body").removeClass("dgwt-wcas-details-left"),null!=this.autoAligmentprocess&&(clearInterval(this.autoAligmentprocess),this.autoAligmentprocess=null),"boolean"==typeof t&&t){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(t){var s,i=t.find("."+this.options.formClass),o=i.width(),a=e(window).width(),n=t[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 t=e(".dgwt-wcas-layout-icon-open");t.length>0&&t.removeClass("dgwt-wcas-layout-icon-open")},hideAfterClickOutsideListener:function(){var t=this;t.isMobileMode()||e(document).mouseup(function(s){if(t.visible){t.getSuggestionsContainer(),t.getDetailsContainer();var i=!(e(s.target).closest("."+t.options.searchFormClass).length>0||e(s.target).hasClass(t.options.searchFormClass)),o=!(e(s.target).closest("."+t.options.containerClass).length>0||e(s.target).hasClass(t.options.containerClass));if(t.canShowDetailsBox()){var a=!(e(s.target).closest("."+t.options.containerDetailsClass).length>0||e(s.target).hasClass(t.options.containerDetailsClass));i&&o&&a&&t.hide()}else i&&o&&t.hide()}})},suggest:function(){if(this.suggestions.length){var t,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=e(s.noSuggestionsContainer),u=i.beforeRender,h="";i.triggerSelectOnValidInput&&s.isExactMatch(n)?s.select(0):(e("body").removeClass("dgwt-wcas-nores"),e.each(s.suggestions,function(s,l){var c="",g=!1;if(o&&(h+=function(e,s){var i=e.data[o];return t===i?"":'<div class="autocomplete-group"><strong>'+(t=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(""),e("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,i)+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,i)+"</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,i)+")</span>"),!0===i.showDescription&&void 0!==l.desc&&l.desc&&(h+='<span class="dgwt-wcas-sd">'+a(l.desc,n,!0,i)+"</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),e.isFunction(u)&&u.call(s.element,c,s.suggestions),c.show(),e("body").addClass("dgwt-wcas-open"),s.automaticAlignment(),!0===i.showDetailsPanel&&(e("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),e("body").addClass("dgwt-wcas-block-scroll"),setTimeout(function(){s.scrollDownSuggestions()},300)),s.findBestHint())}else this.hide()},adjustContainerWidth:function(){var t,s=this.options,i=e("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&&(t=this.el.outerWidth(),a.css("width",t+"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(t){var s="object"==typeof t?t.find(".dgwt-wcas-search-submit"):e(".dgwt-wcas-search-submit");s.length>0&&s.each(function(){var t=e(this).closest(".dgwt-wcas-search-wrapp").find(".dgwt-wcas-preloader");1==dgwt_wcas.is_rtl?t.css("left",6+e(this).outerWidth()+"px"):t.css("right",e(this).outerWidth()+"px")})},findBestHint:function(){var t=this.el.val().toLowerCase(),s=null;t&&(e.each(this.suggestions,function(e,i){var o=0===i.value.toLowerCase().indexOf(t);return o&&(s=i),!o}),this.signalHint(s))},signalHint:function(t){var s="";t&&(s=this.currentValue+t.value.substr(this.currentValue.length)),this.hintValue!==s&&(this.hintValue=s,this.hint=t,(this.options.onHint||e.noop)(s))},preloader:function(t,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"!==t){if("show"===t){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 e(r).remove();else"hide"===t?n.removeClass(i):n.addClass(i)},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 i=this.options;e.suggestions=this.verifySuggestionsFormat(e.suggestions),i.noCache||(this.cachedResponse[s]=e,i.preventBadQueries&&!e.suggestions.length&&this.badQueries.push(t)),t===this.getQuery(this.currentValue)&&("top"===this.options.orientation&&e.suggestions.reverse(),this.suggestions=e.suggestions,this.suggest())},activate:function(t){var s,i=this.classes.selected,o=this.getSuggestionsContainer(),a=o.find("."+this.classes.suggestion);return o.find("."+i).removeClass(i),this.selectedIndex=t,-1!==this.selectedIndex&&a.length>this.selectedIndex?(s=a.get(this.selectedIndex),e(s).addClass(i),s):null},selectHint:function(){var t=e.inArray(this.hint,this.suggestions);this.select(t)},select:function(e){this.hide(),this.onSelect(e)},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(t,s){if("headline"===this.suggestions[t].type&&(t="down"===s?t+1:t-1),void 0!==this.suggestions[t]){var i=this.activate(t);if(this.getDetails(this.suggestions[t]),"more_products"!==this.suggestions[t].type&&i&&!this.canShowDetailsBox()){var o,a,n,r=this.getSuggestionsContainer(),l=e(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(t){var s=this.options.onSelect,i=this.suggestions[t];void 0!==i.type&&"more_products"===i.type||"enter"===this.actionTriggerSource&&"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,e.isFunction(s)&&s.call(this.element,i))},getValue:function(e){var t,s,i=this.options.delimiter;return i?1===(s=(t=this.currentValue).split(i)).length?e:t.substr(0,t.length-s[s.length-1].length)+e:e},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete"),e(window).off("resize.autocomplete",this.fixPositionCapture),e("."+this.options.containerClass).remove(),e("."+this.options.containerDetailsClass).remove()},enableOverlayMobile:function(){var t=this;if("on"!==t.overlayMobileState){t.overlayMobileState="on";var s,i=t.getFormWrapper(),o=t.getSuggestionsContainer();e("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>",e(t.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=e(".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("."+t.options.searchInputClass).focus(),e(document).on("click",".js-dgwt-wcas-om-return",function(e){t.disableOverlayMobile(s)})}},disableOverlayMobile:function(t){var s=this,i=s.getSuggestionsContainer(),o=e(".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"),e("html").removeClass("dgwt-wcas-overlay-mobile-on"),i.appendTo("body"),i.removeAttr("body-scroll-lock-ignore"),e(".js-dgwt-wcas-om-hook").after(o),e(".js-dgwt-wcas-overlay-mobile").remove(),e(".js-dgwt-wcas-om-hook").remove(),setTimeout(function(){o.find("."+s.options.searchInputClass).val("");var e=o.find(".dgwt-wcas-close");o.length>0&&e.removeClass("dgwt-wcas-close"),s.hide()},150),s.overlayMobileState="off"},elementOrParentIsFixed:function(t){var s=t.add(t.parents()),i=!1;return s.each(function(){if("fixed"===e(this).css("position"))return i=!0,!1}),i},gaEvent:function(e,t){if(this.options.sendGAEvents)try{if("undefined"!=typeof gtag)gtag("event","autocomplete_search",{event_label:e,event_category:t});else if("undefined"!=typeof ga){var s=ga.getAll()[0];s&&s.send({hitType:"event",eventCategory:t,eventAction:"autocomplete_search",eventLabel:e})}}catch(e){}if(this.options.enableGASiteSearchModule)try{if("undefined"!=typeof gtag)gtag("event","page_view",{page_path:"/?s="+encodeURI(e)+"&post_type=product&dgwt_wcas=1"});else if("undefined"!=typeof ga){var i=ga.getAll()[0];i&&(i.set("page","/?s="+encodeURI(e)+"&post_type=product&dgwt_wcas=1"),i.send("pageview"))}}catch(e){}}},e.fn.dgwtWcasAutocomplete=function(t,s){return arguments.length?this.each(function(){var i=e(this),o=i.data("autocomplete");"string"==typeof t?o&&"function"==typeof o[t]&&o[t](s):(o&&o.dispose&&o.dispose(),o=new d(this,t),i.data("autocomplete",o))}):this.first().data("autocomplete")},e.fn.autocomplete||(e.fn.autocomplete=e.fn.dgwtWcasAutocomplete),function(){function t(){var t=e(".dgwt-wcas-search-input"),s=[];t.length>1&&t.each(function(){var t=e(this).attr("id");if(-1==e.inArray(t,s))s.push(t);else{var i=Math.random().toString(36).substring(2,6);i="dgwt-wcas-search-input-"+i,e(this).attr("id",i),e(this).closest("form").find("label").attr("for",i)}})}function s(){var t=e(".dgwt-wcas-search-input");t.length>0&&t.each(function(){"object"!=typeof e(this).data("autocomplete")&&e(this).dgwtWcasAutocomplete(window.dgwt_wcas.config)})}e(document).ready(function(){var t=1==dgwt_wcas.show_details_box,s=dgwt_wcas.mobile_breakpoint;(jQuery(window).width()<s||"ontouchend"in document)&&(t=!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: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,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,mobileBreakpoint:s,mobileOverlayWrapper:dgwt_wcas.mobile_overlay_wrapper,debounceWaitMs:dgwt_wcas.debounce_wait_ms,sendGAEvents:dgwt_wcas.send_ga_events,convertHtml:dgwt_wcas.convert_html,enableGASiteSearchModule:dgwt_wcas.enable_ga_site_search_module},e(".dgwt-wcas-search-input").dgwtWcasAutocomplete(window.dgwt_wcas.config)}),e(document).ready(function(){setTimeout(function(){t(),s()},500)}),e(window).on("load",function(){setTimeout(function(){t(),s()},500),void 0!==window.elementorFrontend&&void 0!==window.elementorFrontend.documentsManager&&void 0!==window.elementorFrontend.documentsManager.documents&&e.each(elementorFrontend.documentsManager.documents,function(e,t){void 0!==t.getModal&&t.getModal&&t.getModal().on("show",function(){setTimeout(function(){s()},300)})})})}()});
includes/Engines/WordPressNative/DetailsBox.php CHANGED
@@ -5,6 +5,7 @@ namespace DgoraWcas\Engines\WordPressNative;
5
  use DgoraWcas\Post ;
6
  use DgoraWcas\Product ;
7
  use DgoraWcas\Helpers ;
 
8
  // Exit if accessed directly
9
  if ( !defined( 'ABSPATH' ) ) {
10
  exit;
@@ -59,10 +60,12 @@ class DetailsBox
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 );
@@ -70,8 +73,14 @@ class DetailsBox
70
 
71
  // Get product details
72
 
73
- if ( !empty($postID) && !empty($postType) && $postType === 'product' ) {
74
- $productDetails = $this->getProductDetails( $postID );
 
 
 
 
 
 
75
  $items[] = array(
76
  'objectID' => $item['objectID'],
77
  'html' => $productDetails['html'],
@@ -98,13 +107,20 @@ class DetailsBox
98
  /**
99
  * Prepare products details to the ajax output
100
  *
101
- * @param object $product
 
102
  *
103
  * @return array
104
  */
105
- private function getProductDetails( $productID )
106
  {
107
- $product = new Product( $productID );
 
 
 
 
 
 
108
  $details = array(
109
  'html' => '',
110
  'imageSrc' => '',
@@ -127,9 +143,13 @@ class DetailsBox
127
  'priceHtml' => $product->getPriceHTML(),
128
  'showQuantity' => false,
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
  }
135
  $vars = (object) apply_filters(
@@ -138,15 +158,27 @@ class DetailsBox
138
  $productID,
139
  $product
140
  );
 
141
  ob_start();
142
- include DGWT_WCAS_DIR . 'partials/details-panel/product.php';
143
  $details['html'] = ob_get_clean();
144
- $details['html'] = apply_filters(
145
- 'dgwt/wcas/suggestion_details/product/html',
146
- $details['html'],
147
- $productID,
148
- $product
149
- );
 
 
 
 
 
 
 
 
 
 
 
150
  $details['imageSrc'] = $vars->imageSrc;
151
  $details['price'] = $vars->priceHtml;
152
  return $details;
5
  use DgoraWcas\Post ;
6
  use DgoraWcas\Product ;
7
  use DgoraWcas\Helpers ;
8
+ use DgoraWcas\ProductVariation ;
9
  // Exit if accessed directly
10
  if ( !defined( 'ABSPATH' ) ) {
11
  exit;
60
  $termID = ( !empty($parts[1]) ? absint( $parts[1] ) : 0 );
61
  $taxonomy = ( !empty($parts[2]) ? sanitize_key( $parts[2] ) : '' );
62
  } elseif ( $type === 'product' ) {
63
+ $postType = $type;
64
+ $postID = ( !empty($parts[1]) ? absint( $parts[1] ) : 0 );
65
+ } elseif ( $type === 'product_variation' ) {
66
+ $postType = $type;
67
  $postID = ( !empty($parts[1]) ? absint( $parts[1] ) : 0 );
68
  $variationID = ( !empty($parts[2]) ? absint( $parts[2] ) : 0 );
 
69
  } elseif ( $type === 'post' ) {
70
  $postType = ( !empty($parts[2]) ? $parts[2] : 0 );
71
  $postID = ( !empty($parts[1]) ? absint( $parts[1] ) : 0 );
73
 
74
  // Get product details
75
 
76
+ if ( !empty($postID) && !empty($postType) && in_array( $postType, array( 'product', 'product_variation' ) ) ) {
77
+
78
+ if ( $postType === 'product_variation' ) {
79
+ $productDetails = $this->getProductDetails( $postID, $variationID );
80
+ } else {
81
+ $productDetails = $this->getProductDetails( $postID );
82
+ }
83
+
84
  $items[] = array(
85
  'objectID' => $item['objectID'],
86
  'html' => $productDetails['html'],
107
  /**
108
  * Prepare products details to the ajax output
109
  *
110
+ * @param int $productID
111
+ * @param int $variationID
112
  *
113
  * @return array
114
  */
115
+ private function getProductDetails( $productID, $variationID = 0 )
116
  {
117
+
118
+ if ( $variationID ) {
119
+ $product = new ProductVariation( $variationID );
120
+ } else {
121
+ $product = new Product( $productID );
122
+ }
123
+
124
  $details = array(
125
  'html' => '',
126
  'imageSrc' => '',
143
  'priceHtml' => $product->getPriceHTML(),
144
  'showQuantity' => false,
145
  'stockAvailability' => $product->getStockAvailability(),
146
+ 'attributes' => array(),
147
  'wooObject' => $product->getWooObject(),
148
  );
149
+ if ( $variationID ) {
150
+ $vars['attributes'] = $product->getVariationAttributes();
151
+ }
152
+ if ( ($product->isType( 'simple' ) || $product->isType( 'variation' )) && $wooProduct->is_purchasable() && $wooProduct->is_in_stock() && !$wooProduct->is_sold_individually() && apply_filters( 'dgwt/wcas/suggestion_details/show_quantity', true ) ) {
153
  $vars['showQuantity'] = true;
154
  }
155
  $vars = (object) apply_filters(
158
  $productID,
159
  $product
160
  );
161
+ $file = ( $variationID ? 'product-variation' : 'product' );
162
  ob_start();
163
+ include DGWT_WCAS_DIR . 'partials/details-panel/' . $file . '.php';
164
  $details['html'] = ob_get_clean();
165
+
166
+ if ( $variationID ) {
167
+ $details['html'] = apply_filters(
168
+ 'dgwt/wcas/suggestion_details/product_variation/html',
169
+ $details['html'],
170
+ $variationID,
171
+ $product
172
+ );
173
+ } else {
174
+ $details['html'] = apply_filters(
175
+ 'dgwt/wcas/suggestion_details/product/html',
176
+ $details['html'],
177
+ $productID,
178
+ $product
179
+ );
180
+ }
181
+
182
  $details['imageSrc'] = $vars->imageSrc;
183
  $details['price'] = $vars->priceHtml;
184
  return $details;
includes/Engines/WordPressNative/Search.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  namespace DgoraWcas\Engines\WordPressNative;
4
 
 
5
  use DgoraWcas\Product ;
6
  use DgoraWcas\Helpers ;
7
  // Exit if accessed directly
@@ -399,9 +400,10 @@ class Search
399
 
400
  if ( $i < $limit ) {
401
  $cat_name = html_entity_decode( $cat->name );
402
- $pos = strpos( strtolower( $cat_name ), strtolower( $keyword ) );
403
 
404
  if ( $pos !== false ) {
 
405
  $results[$i] = array(
406
  'term_id' => $cat->term_id,
407
  'taxonomy' => 'product_cat',
@@ -411,6 +413,7 @@ class Search
411
  $cat->term_id,
412
  'product_cat',
413
  array(),
 
414
  array( $cat->term_id )
415
  ),
416
  'type' => 'taxonomy',
@@ -449,7 +452,7 @@ class Search
449
 
450
  if ( $i < $limit ) {
451
  $tag_name = html_entity_decode( $tag->name );
452
- $pos = strpos( strtolower( $tag_name ), strtolower( $keyword ) );
453
 
454
  if ( $pos !== false ) {
455
  $results[$i] = array(
@@ -614,11 +617,21 @@ class Search
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(
2
 
3
  namespace DgoraWcas\Engines\WordPressNative;
4
 
5
+ use DgoraWcas\Multilingual ;
6
  use DgoraWcas\Product ;
7
  use DgoraWcas\Helpers ;
8
  // Exit if accessed directly
400
 
401
  if ( $i < $limit ) {
402
  $cat_name = html_entity_decode( $cat->name );
403
+ $pos = strpos( mb_strtolower( $cat_name ), mb_strtolower( $keyword ) );
404
 
405
  if ( $pos !== false ) {
406
+ $termLang = Multilingual::getTermLang( $cat->term_id, 'product_cat' );
407
  $results[$i] = array(
408
  'term_id' => $cat->term_id,
409
  'taxonomy' => 'product_cat',
413
  $cat->term_id,
414
  'product_cat',
415
  array(),
416
+ $termLang,
417
  array( $cat->term_id )
418
  ),
419
  'type' => 'taxonomy',
452
 
453
  if ( $i < $limit ) {
454
  $tag_name = html_entity_decode( $tag->name );
455
+ $pos = strpos( mb_strtolower( $tag_name ), mb_strtolower( $keyword ) );
456
 
457
  if ( $pos !== false ) {
458
  $results[$i] = array(
617
  if ( !empty($query->query_vars['order']) ) {
618
  $order = strtolower( $query->query_vars['order'] );
619
  }
620
+ $slugs = strtok( $_SERVER["REQUEST_URI"], '?' );
621
+ if ( $slugs == '/' ) {
622
+ $slugs = '';
623
+ }
624
+ $baseUrl = home_url() . $slugs . \WC_AJAX::get_endpoint( DGWT_WCAS_SEARCH_ACTION );
625
+ $urlPhrase = str_replace( "\\'", "'", $phrase );
626
+ $urlPhrase = str_replace( '\\"', '"', $urlPhrase );
627
+ $args = array(
628
+ 's' => urlencode( $urlPhrase ),
629
  'remote' => 1,
630
+ );
631
+ if ( Multilingual::isMultilingual() ) {
632
+ $args['l'] = Multilingual::getCurrentLanguage();
633
+ }
634
+ $url = add_query_arg( $args, $baseUrl );
635
  $postIn = array();
636
  $correctResponse = false;
637
  $r = wp_remote_retrieve_body( wp_remote_get( $url, array(
includes/Helpers.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  namespace DgoraWcas;
4
 
 
5
  // Exit if accessed directly
6
  if ( !defined( 'ABSPATH' ) ) {
7
  exit;
@@ -11,7 +12,7 @@ class Helpers
11
  /**
12
  * Logger instance
13
  *
14
- * @var WC_Logger
15
  */
16
  public static $log = false ;
17
  /**
@@ -82,6 +83,13 @@ class Helpers
82
  $classes[] = 'js-dgwt-wcas-layout-' . $type . ' dgwt-wcas-layout-' . $type;
83
  }
84
 
 
 
 
 
 
 
 
85
  return implode( ' ', $classes );
86
  }
87
 
@@ -90,7 +98,7 @@ class Helpers
90
  *
91
  * @param string $class
92
  *
93
- * @return void
94
  */
95
  public static function getMagnifierIco( $class = 'dgwt-wcas-ico-magnifier' )
96
  {
@@ -445,7 +453,7 @@ class Helpers
445
 
446
  if ( $args['check_similarity'] ) {
447
  $m = similar_text( $searched, $string, $percent );
448
- $score = $score + $percent;
449
  }
450
 
451
  $pos = strpos( $string, $searched );
@@ -463,7 +471,7 @@ class Helpers
463
 
464
  // Bonus for exact match
465
  if ( $string === $searched ) {
466
- $score += $args['score_containing'];
467
  }
468
  }
469
 
@@ -1052,5 +1060,38 @@ class Helpers
1052
  }
1053
  return $result;
1054
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1055
 
1056
  }
2
 
3
  namespace DgoraWcas;
4
 
5
+ use DgoraWcas\Engines\TNTSearchMySQL\SearchQuery\SearchResultsPageQuery ;
6
  // Exit if accessed directly
7
  if ( !defined( 'ABSPATH' ) ) {
8
  exit;
12
  /**
13
  * Logger instance
14
  *
15
+ * @var \WC_Logger
16
  */
17
  public static $log = false ;
18
  /**
83
  $classes[] = 'js-dgwt-wcas-layout-' . $type . ' dgwt-wcas-layout-' . $type;
84
  }
85
 
86
+
87
+ if ( !empty($args['mobile_overlay']) && in_array( $args['mobile_overlay'], array( '1', 'on' ) ) ) {
88
+ $classes[] = 'js-dgwt-wcas-mobile-overlay-enabled';
89
+ } else {
90
+ $classes[] = 'js-dgwt-wcas-mobile-overlay-disabled';
91
+ }
92
+
93
  return implode( ' ', $classes );
94
  }
95
 
98
  *
99
  * @param string $class
100
  *
101
+ * @return string
102
  */
103
  public static function getMagnifierIco( $class = 'dgwt-wcas-ico-magnifier' )
104
  {
453
 
454
  if ( $args['check_similarity'] ) {
455
  $m = similar_text( $searched, $string, $percent );
456
+ $score = ($score + $percent) / 3;
457
  }
458
 
459
  $pos = strpos( $string, $searched );
471
 
472
  // Bonus for exact match
473
  if ( $string === $searched ) {
474
+ $score += $args['score_containing'] * 5;
475
  }
476
  }
477
 
1060
  }
1061
  return $result;
1062
  }
1063
+
1064
+ /**
1065
+ * Search products with native engine
1066
+ *
1067
+ * @param $phrase
1068
+ *
1069
+ * @return int[]
1070
+ */
1071
+ public static function searchProducts( $phrase )
1072
+ {
1073
+ $postIn = array();
1074
+ $baseUrl = home_url() . \WC_AJAX::get_endpoint( DGWT_WCAS_SEARCH_ACTION );
1075
+ $urlPhrase = str_replace( "\\'", "'", $phrase );
1076
+ $urlPhrase = str_replace( '\\"', '"', $urlPhrase );
1077
+ $args = array(
1078
+ 's' => urlencode( $urlPhrase ),
1079
+ 'remote' => 1,
1080
+ );
1081
+ if ( Multilingual::isMultilingual() ) {
1082
+ $args['l'] = Multilingual::getCurrentLanguage();
1083
+ }
1084
+ $url = add_query_arg( $args, $baseUrl );
1085
+ $r = wp_remote_retrieve_body( wp_remote_get( $url, array(
1086
+ 'timeout' => 120,
1087
+ ) ) );
1088
+ $decR = json_decode( $r );
1089
+ if ( json_last_error() == JSON_ERROR_NONE ) {
1090
+ if ( is_object( $decR ) && property_exists( $decR, 'suggestions' ) && is_array( $decR->suggestions ) ) {
1091
+ $postIn = wp_list_pluck( $decR->suggestions, 'ID' );
1092
+ }
1093
+ }
1094
+ return $postIn;
1095
+ }
1096
 
1097
  }
includes/Integrations/Brands.php CHANGED
@@ -109,7 +109,8 @@ class Brands {
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
 
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
+ 'martfury-addons/martfury-addons.php'
114
  );
115
  }
116
 
includes/Integrations/Plugins/BoosterIO/BoosterIO.php DELETED
@@ -1,340 +0,0 @@
1
- <?php
2
-
3
- namespace DgoraWcas\Integrations\Plugins\BoosterIO;
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 DELETED
@@ -1,222 +0,0 @@
1
- <?php
2
-
3
-
4
- namespace DgoraWcas\Integrations\Plugins\BoosterIO;
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/FacetWP/FacetWP.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\FacetWP;
4
+
5
+ use DgoraWcas\Helpers ;
6
+ /**
7
+ * Integration with FacetWP
8
+ *
9
+ * Plugin URL: https://facetwp.com/
10
+ * Author: FacetWP, LLC
11
+ */
12
+ class FacetWP
13
+ {
14
+ private static $engine = 'dgwt_wcas' ;
15
+ public $search_terms ;
16
+ public function init()
17
+ {
18
+ if ( !defined( 'FACETWP_VERSION' ) ) {
19
+ return;
20
+ }
21
+ if ( version_compare( FACETWP_VERSION, '3.5.5' ) < 0 ) {
22
+ return;
23
+ }
24
+ // Search page
25
+ add_filter(
26
+ 'facetwp_query_args',
27
+ array( $this, 'search_args' ),
28
+ 10,
29
+ 2
30
+ );
31
+ add_filter(
32
+ 'facetwp_pre_filtered_post_ids',
33
+ array( $this, 'search_page' ),
34
+ 10,
35
+ 2
36
+ );
37
+ add_filter(
38
+ 'dgwt/wcas/search_bar/value',
39
+ array( $this, 'restore_search_phrase' ),
40
+ 10,
41
+ 2
42
+ );
43
+ // Search facet
44
+ add_filter( 'facetwp_facet_search_engines', array( $this, 'search_engines' ) );
45
+ add_filter(
46
+ 'facetwp_facet_filter_posts',
47
+ array( $this, 'search_facet' ),
48
+ 10,
49
+ 2
50
+ );
51
+ }
52
+
53
+ /**
54
+ * Prevent the default WP search from running when our plugin is enabled
55
+ */
56
+ function search_args( $args, $class )
57
+ {
58
+
59
+ if ( $class->is_search && isset( $class->http_params['get']['dgwt_wcas'] ) ) {
60
+ $this->search_terms = $args['s'];
61
+ unset( $args['s'] );
62
+ $args['dgwt_wcas'] = $args['s'];
63
+ }
64
+
65
+ return $args;
66
+ }
67
+
68
+ /**
69
+ * Use our engine to retrieve matching post IDs
70
+ */
71
+ public function search_page( $post_ids, $class )
72
+ {
73
+ if ( empty($this->search_terms) ) {
74
+ return $post_ids;
75
+ }
76
+ if ( !dgoraAsfwFs()->is_premium() ) {
77
+ $products_ids = Helpers::searchProducts( $this->search_terms );
78
+ }
79
+ $intersected_ids = [];
80
+ // Speed up comparison
81
+ $post_ids = array_flip( $post_ids );
82
+ if ( !empty($products_ids) ) {
83
+ foreach ( $products_ids as $post_id ) {
84
+ if ( isset( $post_ids[$post_id] ) ) {
85
+ $intersected_ids[] = $post_id;
86
+ }
87
+ }
88
+ }
89
+ return ( empty($intersected_ids) ? [ 0 ] : $intersected_ids );
90
+ }
91
+
92
+ /**
93
+ * Restore search phrase in search input
94
+ *
95
+ * @return string
96
+ */
97
+ public function restore_search_phrase( $phrase, $searchInstances )
98
+ {
99
+ if ( !empty($this->search_terms) ) {
100
+ $phrase = esc_attr( $this->search_terms );
101
+ }
102
+ return $phrase;
103
+ }
104
+
105
+ /**
106
+ * Add our engine to the search facet
107
+ */
108
+ public function search_engines( $engines )
109
+ {
110
+ $engines[self::$engine] = DGWT_WCAS_NAME;
111
+ return $engines;
112
+ }
113
+
114
+ /**
115
+ * Intercept search facets using our engine
116
+ */
117
+ public function search_facet( $return, $params )
118
+ {
119
+ $facet = $params['facet'];
120
+ $selected_values = $params['selected_values'];
121
+ $selected_values = ( is_array( $selected_values ) ? $selected_values[0] : $selected_values );
122
+ $search_engine = ( isset( $facet['search_engine'] ) ? $facet['search_engine'] : '' );
123
+
124
+ if ( 'search' == $facet['type'] && $search_engine === self::$engine ) {
125
+ if ( empty($selected_values) ) {
126
+ return 'continue';
127
+ }
128
+ if ( !dgoraAsfwFs()->is_premium() ) {
129
+ $return = Helpers::searchProducts( $selected_values );
130
+ }
131
+ }
132
+
133
+ return $return;
134
+ }
135
+
136
+ }
includes/Integrations/Plugins/WooCommerce/WooCommerce.php DELETED
@@ -1,104 +0,0 @@
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 DELETED
@@ -1,47 +0,0 @@
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 DELETED
@@ -1,70 +0,0 @@
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/WooCommerceProductsFilter/WooCommerceProductsFilter.php DELETED
@@ -1,132 +0,0 @@
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/WooCommerceProductsVisibility/Filters.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\WooCommerceProductsVisibility;
4
+
5
+ use DgoraWcas\Engines\TNTSearchMySQL\Config;
6
+
7
+ class Filters {
8
+ public $plugin_names = array(
9
+ 'woocommerce-products-visibility/woocommerce-products-visibility.php',
10
+ 'woocommerce-visibility/woocommerce-visibility.php' // since v4.x
11
+ );
12
+
13
+ private $visible_products = array();
14
+
15
+ public function init() {
16
+
17
+ foreach ( $this->plugin_names as $plugin_name ) {
18
+
19
+ if ( Config::isPluginActive( $plugin_name ) ) {
20
+
21
+ $this->setVisibleProducts();
22
+ $this->excludeHidenProducts();
23
+
24
+ break;
25
+ }
26
+
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Set visible products from PHP Session
32
+ *
33
+ * @return void
34
+ */
35
+ private function setVisibleProducts() {
36
+ if ( ! session_id() ) {
37
+ session_start();
38
+ }
39
+
40
+ if ( ! empty( $_SESSION['dgwt-wcas-wcpv-visible-products'] ) ) {
41
+ $this->visible_products = $_SESSION['dgwt-wcas-wcpv-visible-products'];
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Include only products returned by Products Visibility plugin
47
+ */
48
+ private function excludeHidenProducts() {
49
+ add_filter( 'dgwt/wcas/tnt/search_results/ids', function ( $ids ) {
50
+ if ( is_array( $this->visible_products ) ) {
51
+ $ids = array_intersect( $ids, $this->visible_products );
52
+ }
53
+
54
+ return $ids;
55
+ } );
56
+ }
57
+ }
includes/Integrations/Plugins/WooCommerceProductsVisibility/WooCommerceProductsVisibility.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\WooCommerceProductsVisibility;
4
+
5
+ /**
6
+ * Integration with WooCommerce Products Visibility
7
+ *
8
+ * Plugin URL: https://themeforest.net/user/codemine
9
+ * Author: codemine
10
+ */
11
+ class WooCommerceProductsVisibility {
12
+ public function init() {
13
+ /**
14
+ * This plugin is hooked on plugins_loaded action with priority 100000, so we need
15
+ * wait for it, and try to load this integration in next hook.
16
+ */
17
+ add_action( 'sanitize_comment_cookies', array( $this, 'late_init' ) );
18
+ }
19
+
20
+ public function late_init() {
21
+ if ( ! class_exists( 'WCPV_FRONTEND' ) ) {
22
+ return;
23
+ }
24
+
25
+ add_action( 'init', array( $this, 'store_in_session_included_products' ), 20 );
26
+ }
27
+
28
+ /**
29
+ * Store visible product ids in session
30
+ */
31
+ public function store_in_session_included_products() {
32
+ $wcpv_frontend = \WCPV_FRONTEND::get_instance();
33
+ if ( ! empty( $wcpv_frontend->include_products ) ) {
34
+ if ( ! session_id() ) {
35
+ session_start();
36
+ }
37
+ $_SESSION['dgwt-wcas-wcpv-visible-products'] = $wcpv_frontend->include_products;
38
+ }
39
+ }
40
+ }
includes/Integrations/Plugins/WooProductFilter/WooProductFilter.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\WooProductFilter;
4
+
5
+ use DgoraWcas\Helpers ;
6
+ /**
7
+ * Integration with Woo Product Filter
8
+ *
9
+ * Plugin URL: https://wordpress.org/plugins/woo-product-filter/
10
+ * Author: WooBeWoo
11
+ */
12
+ class WooProductFilter
13
+ {
14
+ public function init()
15
+ {
16
+ if ( !defined( 'WPF_VERSION' ) ) {
17
+ return;
18
+ }
19
+ if ( version_compare( WPF_VERSION, '1.2.8' ) < 0 ) {
20
+ return;
21
+ }
22
+ // TODO This filter must be added by the plugin author
23
+ add_filter( 'wpf_getFilteredPriceSql', array( $this, 'filter_price_sql' ) );
24
+ add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
25
+ }
26
+
27
+ /**
28
+ * Narrowing the list of products for determining edge prices to those returned by our search engine
29
+ *
30
+ * @param string $sql
31
+ *
32
+ * @return string
33
+ */
34
+ public function filter_price_sql( $sql )
35
+ {
36
+ global $wpdb ;
37
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
38
+ if ( $post_ids ) {
39
+ $sql .= " AND {$wpdb->posts}.ID IN(" . implode( ',', $post_ids ) . ")";
40
+ }
41
+ return $sql;
42
+ }
43
+
44
+ /**
45
+ * Narrow the list of products in the AJAX search to those returned by our search engine
46
+ *
47
+ * Filtered custom WP_Query used by this plugin: wp-content/plugins/woo-product-filter/modules/woofilters/controller.php~152
48
+ *
49
+ * @param \WP_Query $query
50
+ */
51
+ public function pre_get_posts( $query )
52
+ {
53
+ if ( !defined( 'DOING_AJAX' ) ) {
54
+ return;
55
+ }
56
+ if ( !isset( $_POST['action'] ) || isset( $_POST['action'] ) && $_POST['action'] !== 'filtersFrontend' ) {
57
+ return;
58
+ }
59
+ if ( !isset( $_POST['mod'] ) || isset( $_POST['mod'] ) && $_POST['mod'] !== 'woofilters' ) {
60
+ return;
61
+ }
62
+ if ( !isset( $_POST['currenturl'] ) ) {
63
+ return;
64
+ }
65
+ $orderby = 'relevance';
66
+ $order = 'desc';
67
+ // parse args from url passed as POST var
68
+ $url_query = wp_parse_url( $_POST['currenturl'] );
69
+ $url_query_args = array();
70
+ wp_parse_str( $url_query['query'], $url_query_args );
71
+ if ( !isset( $url_query_args['dgwt_wcas'] ) || !isset( $url_query_args['s'] ) ) {
72
+ return;
73
+ }
74
+ if ( !empty($url_query_args['orderby']) ) {
75
+ $orderby = $url_query_args['orderby'];
76
+ }
77
+ if ( !empty($url_query_args['order']) ) {
78
+ $order = strtolower( $url_query_args['order'] );
79
+ }
80
+ if ( $orderby === 'price' ) {
81
+ $order = 'asc';
82
+ }
83
+ $post_ids = array();
84
+ if ( !dgoraAsfwFs()->is_premium() ) {
85
+ $post_ids = Helpers::searchProducts( $url_query_args['s'] );
86
+ }
87
+
88
+ if ( $post_ids ) {
89
+ $query->set( 'post__in', $post_ids );
90
+ $query->set( 'orderby', 'post__in' );
91
+ }
92
+
93
+ }
94
+
95
+ }
includes/Integrations/Plugins/XforWooCommerceFilter/XforWooCommerceFilter.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Plugins\XforWooCommerceFilter;
4
+
5
+ use DgoraWcas\Helpers ;
6
+ /**
7
+ * Integration with Product Filter for WooCommerce
8
+ *
9
+ * Plugin URL: https://xforwoocommerce.com
10
+ * Author: 7VX LLC, USA CA
11
+ */
12
+ class XforWooCommerceFilter
13
+ {
14
+ protected $post_ids = array() ;
15
+ public function init()
16
+ {
17
+ if ( !class_exists( 'XforWC_Product_Filters' ) ) {
18
+ return;
19
+ }
20
+ if ( version_compare( \XforWC_Product_Filters::$version, '7.2.3' ) < 0 ) {
21
+ return;
22
+ }
23
+ add_action( 'prdctfltr_add_inputs', array( $this, 'prdctfltr_add_inputs' ) );
24
+ add_action( 'pre_get_posts', array( $this, 'search_products' ), 1000000 );
25
+ add_filter( 'prdctfltr_get_terms_args', array( $this, 'prdctfltr_get_terms_args' ) );
26
+ }
27
+
28
+ /**
29
+ * Adding an input to be submitted during an AJAX query when changing filters
30
+ *
31
+ * Only on search page or during AJAX query on the search page.
32
+ */
33
+ public function prdctfltr_add_inputs()
34
+ {
35
+
36
+ if ( Helpers::isProductSearchPage() || defined( 'DOING_AJAX' ) && isset( $_POST['action'] ) && $_POST['action'] === 'prdctfltr_respond_550' && isset( $_POST['pf_id'] ) && isset( $_POST['pf_filters'][$_POST['pf_id']]['dgwt_wcas'] ) ) {
37
+ echo '<input type="hidden" name="dgwt_wcas" value="1" class="pf_added_input" />' ;
38
+ echo '<input type="hidden" name="post_type" value="product" class="pf_added_input" />' ;
39
+ }
40
+
41
+ }
42
+
43
+ /**
44
+ * Narrow the list of products in the AJAX search to those returned by our search engine
45
+ *
46
+ * Filtered custom WP_Query used by this plugin: wp-content/plugins/xforwoocommerce/x-pack/prdctfltr/includes/pf-shortcode.php:1333
47
+ *
48
+ * @param \WP_Query $query
49
+ */
50
+ public function search_products( $query )
51
+ {
52
+ if ( !$this->is_prdctfltr_ajax_search() ) {
53
+ return;
54
+ }
55
+ $orderby = ( isset( $_POST['pf_filters'][$_POST['pf_id']]['orderby'] ) ? $_POST['pf_filters'][$_POST['pf_id']]['orderby'] : 'relevance' );
56
+ $order = 'desc';
57
+ if ( $orderby === 'price' ) {
58
+ $order = 'asc';
59
+ }
60
+ $phrase = $_POST['pf_filters'][$_POST['pf_id']]['s'];
61
+ $post_ids = array();
62
+ if ( !dgoraAsfwFs()->is_premium() ) {
63
+ $post_ids = Helpers::searchProducts( $phrase );
64
+ }
65
+ $this->post_ids = $post_ids;
66
+
67
+ if ( $post_ids ) {
68
+ $query->set( 's', '' );
69
+ $query->is_search = false;
70
+ $query->set( 'post__in', $post_ids );
71
+ $query->set( 'orderby', 'post__in' );
72
+ }
73
+
74
+ }
75
+
76
+ /**
77
+ * Limit the number of terms to those associated with search results
78
+ *
79
+ * @param $args
80
+ *
81
+ * @return mixed
82
+ */
83
+ public function prdctfltr_get_terms_args( $args )
84
+ {
85
+ if ( !Helpers::isProductSearchPage() && !$this->is_prdctfltr_ajax_search() ) {
86
+ return $args;
87
+ }
88
+ // If we are in the middle of an AJAX query, we get product ids related with custom WP_Query.
89
+
90
+ if ( $this->is_prdctfltr_ajax_search() ) {
91
+ $post_ids = $this->post_ids;
92
+ } else {
93
+ $post_ids = apply_filters( 'dgwt/wcas/search_page/result_post_ids', array() );
94
+ }
95
+
96
+ if ( $post_ids ) {
97
+ $args['object_ids'] = $post_ids;
98
+ }
99
+ return $args;
100
+ }
101
+
102
+ /**
103
+ * Checking if we are in the middle of an AJAX query that handles filter and search results refreshing
104
+ *
105
+ * @return bool
106
+ */
107
+ private function is_prdctfltr_ajax_search()
108
+ {
109
+ if ( !defined( 'DOING_AJAX' ) ) {
110
+ return false;
111
+ }
112
+ if ( !isset( $_POST['action'] ) ) {
113
+ return false;
114
+ }
115
+ if ( $_POST['action'] !== 'prdctfltr_respond_550' ) {
116
+ return false;
117
+ }
118
+ if ( !isset( $_POST['pf_id'] ) ) {
119
+ return false;
120
+ }
121
+ if ( !isset( $_POST['pf_filters'][$_POST['pf_id']] ) ) {
122
+ return false;
123
+ }
124
+ if ( !isset( $_POST['pf_filters'][$_POST['pf_id']]['s'] ) ) {
125
+ return false;
126
+ }
127
+ if ( !isset( $_POST['pf_filters'][$_POST['pf_id']]['dgwt_wcas'] ) ) {
128
+ return false;
129
+ }
130
+ return true;
131
+ }
132
+
133
+ }
includes/Integrations/Solver.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  namespace DgoraWcas\Integrations;
4
 
 
5
  // Exit if accessed directly
6
  if ( !defined( 'ABSPATH' ) ) {
7
  exit;
2
 
3
  namespace DgoraWcas\Integrations;
4
 
5
+ use DgoraWcas\Helpers ;
6
  // Exit if accessed directly
7
  if ( !defined( 'ABSPATH' ) ) {
8
  exit;
includes/Integrations/Themes/Avada/Avada.php ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\Avada;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Avada {
13
+
14
+ private $themeSlug = 'avada';
15
+
16
+ private $themeName = 'Avada';
17
+
18
+ public function __construct() {
19
+ $this->maybeOverwriteSearch();
20
+
21
+ add_filter( 'dgwt/wcas/settings', array( $this, 'registerSettings' ) );
22
+
23
+
24
+ }
25
+
26
+
27
+ /**
28
+ * Add settings
29
+ *
30
+ * @param array $settings
31
+ *
32
+ * @return array
33
+ */
34
+ public function registerSettings( $settings ) {
35
+ $key = 'dgwt_wcas_basic';
36
+
37
+ $settings[ $key ][10] = array(
38
+ 'name' => $this->themeSlug . '_main_head',
39
+ 'label' => sprintf( __( 'Replace %s search bar', 'ajax-search-for-woocommerce' ), $this->themeName ),
40
+ 'type' => 'head',
41
+ 'class' => 'dgwt-wcas-sgs-header'
42
+ );
43
+
44
+ $settings[ $key ][52] = array(
45
+ 'name' => $this->themeSlug . '_settings_head',
46
+ 'label' => sprintf( __( '%s Theme', 'ajax-search-for-woocommerce' ), $this->themeName ),
47
+ 'type' => 'desc',
48
+ 'desc' => Helpers::embeddingInThemeHtml(),
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
+ $settings[ $key ][55] = array(
58
+ 'name' => $this->themeSlug . '_replace_search',
59
+ 'label' => __( 'Replace', 'ajax-search-for-woocommerce' ),
60
+ 'desc' => sprintf( __( 'Replace all %s search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce' ), $this->themeName ),
61
+ 'type' => 'checkbox',
62
+ 'default' => 'off',
63
+ );
64
+
65
+ $settings[ $key ][90] = array(
66
+ 'name' => $this->themeSlug . '_othersways__head',
67
+ 'label' => __( 'Alternative ways to embed a search bar', 'ajax-search-for-woocommerce' ),
68
+ 'type' => 'head',
69
+ 'class' => 'dgwt-wcas-sgs-header'
70
+ );
71
+
72
+ return $settings;
73
+ }
74
+
75
+ /**
76
+ * Check if can replace the native Woodmart search form
77
+ * by the Ajax Search for WooCommerce form.
78
+ *
79
+ * @return bool
80
+ */
81
+ private function canReplaceSearch() {
82
+ $canIntegrate = false;
83
+
84
+ if ( DGWT_WCAS()->settings->getOption( $this->themeSlug . '_replace_search', 'off' ) === 'on' ) {
85
+ $canIntegrate = true;
86
+ }
87
+
88
+ return $canIntegrate;
89
+ }
90
+
91
+ /**
92
+ * Overwrite search
93
+ *
94
+ * @return void
95
+ */
96
+ private function maybeOverwriteSearch() {
97
+ if ( $this->canReplaceSearch() ) {
98
+
99
+ $this->applyCSS();
100
+ $this->applyJS();
101
+
102
+
103
+ add_filter( 'get_search_form', function ( $form ) {
104
+ return do_shortcode( '[wcas-search-form]' );
105
+ }, 100 );
106
+
107
+ add_action( 'init', function () {
108
+ remove_filter( 'wp_nav_menu_items', 'avada_add_search_to_main_nav', 20, 2 );
109
+ add_filter( 'wp_nav_menu_items', array( $this, 'addSearchToMainNav' ), 20, 2 );
110
+ } );
111
+
112
+
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Add search to the main navigation.
118
+ *
119
+ * @param string $items HTML for the main menu items.
120
+ * @param array $args Arguments for the WP menu.
121
+ *
122
+ * @return string
123
+ */
124
+ public function addSearchToMainNav( $items, $args ) {
125
+ // Disable woo cart on ubermenu navigations.
126
+ $ubermenu = ( function_exists( 'ubermenu_get_menu_instance_by_theme_location' ) && ubermenu_get_menu_instance_by_theme_location( $args->theme_location ) );
127
+
128
+ if ( 'v6' !== Avada()->settings->get( 'header_layout' ) && false === $ubermenu ) {
129
+ if ( 'main_navigation' === $args->theme_location || 'sticky_navigation' === $args->theme_location ) {
130
+ if ( Avada()->settings->get( 'main_nav_search_icon' ) ) {
131
+
132
+
133
+ $items .= '<li class="fusion-custom-menu-item fusion-main-menu-search">';
134
+ $items .= do_shortcode( '[wcas-search-form layout="icon"]' );
135
+ $items .= '</li>';
136
+ }
137
+ }
138
+ }
139
+
140
+ return $items;
141
+ }
142
+
143
+ /**
144
+ * Apply custom CSS
145
+ *
146
+ * @return void
147
+ */
148
+ private function applyCSS() {
149
+
150
+ add_action( 'wp_head', function () {
151
+ ?>
152
+ <style>
153
+ .fusion-secondary-menu-search {
154
+ width: 500px;
155
+ }
156
+
157
+ .fusion-flyout-search .dgwt-wcas-search-wrapp {
158
+ margin-top: 21px;
159
+ }
160
+
161
+ .dgwt-wcas-details-wrapp .quantity {
162
+ width: auto;
163
+ }
164
+
165
+ .fusion-main-menu-search .dgwt-wcas-search-icon svg {
166
+ display: none;
167
+ }
168
+
169
+ .fusion-main-menu-search .dgwt-wcas-search-icon {
170
+ font-family: icomoon;
171
+ }
172
+
173
+ .fusion-main-menu-search .dgwt-wcas-search-icon:after {
174
+ content: '\f002';
175
+ font-size: 15px;
176
+ line-height: 40px;
177
+ }
178
+ .fusion-header-v4 .fusion-main-menu {
179
+ overflow: visible;
180
+ }
181
+
182
+ html:not(.dgwt-wcas-overlay-mobile-on) .fusion-header-v4 .fusion-main-menu .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-search-form {
183
+ top: 100%;
184
+ }
185
+ .fusion-header-v4 .fusion-main-menu .dgwt-wcas-layout-icon-open .dgwt-wcas-search-icon-arrow {
186
+ top: calc(100% + -4px);
187
+ }
188
+
189
+ @media (max-width: 1100px) {
190
+ .fusion-flyout-search .dgwt-wcas-search-wrapp {
191
+ margin-top: 73px;
192
+ max-width: 100%;
193
+ padding: 0 30px 0 30px;
194
+ }
195
+
196
+ }
197
+
198
+ @media (max-width: 800px) {
199
+ .fusion-logo .dgwt-wcas-search-wrapp {
200
+ display: none;
201
+ }
202
+ }
203
+ </style>
204
+ <?php
205
+ } );
206
+
207
+ }
208
+
209
+ /**
210
+ * Apply custom JS
211
+ *
212
+ * @return void
213
+ */
214
+ private function applyJS() {
215
+
216
+ add_action( 'wp_footer', function () {
217
+
218
+ ?>
219
+ <script>
220
+ (function ($) {
221
+
222
+ function dgwtWcasAvadaGetActiveInstance() {
223
+ var $el = $('.dgwt-wcas-search-wrapp.dgwt-wcas-active'),
224
+ instance;
225
+ if ($el.length > 0) {
226
+ $el.each(function () {
227
+ var $input = $(this).find('.dgwt-wcas-search-input');
228
+ if (typeof $input.data('autocomplete') == 'object') {
229
+ instance = $input.data('autocomplete');
230
+ return false;
231
+ }
232
+ });
233
+ }
234
+
235
+ return instance;
236
+ }
237
+
238
+ $(document).ready(function () {
239
+
240
+ // Header 6
241
+ if ($('.fusion-header-v6').length) {
242
+
243
+ $('.fusion-header-v6 .fusion-icon-search').on('click', function () {
244
+ var $input = $('.fusion-flyout-search .dgwt-wcas-search-input');
245
+ if ($input.length > 0) {
246
+ $input.focus();
247
+ }
248
+ });
249
+
250
+ $('.fusion-header-v6 .fusion-icon-search').on('click', function () {
251
+ var $input = $('.fusion-flyout-search .dgwt-wcas-search-input');
252
+ if ($input.length > 0) {
253
+ $input.focus();
254
+ }
255
+ });
256
+
257
+
258
+ $('.fusion-icon-search').on('click', function () {
259
+
260
+ if ($('.fusion-header-v6').hasClass('fusion-flyout-search-active')) {
261
+
262
+ var instance = dgwtWcasAvadaGetActiveInstance();
263
+
264
+ if (typeof instance == 'object') {
265
+ instance.suggestions = [];
266
+ instance.hide();
267
+ instance.el.val('');
268
+ }
269
+ }
270
+ });
271
+ }
272
+
273
+
274
+ $(document).on('click', '.fusion-icon-search', function () {
275
+
276
+
277
+ var $handler = $('.fusion-mobile-menu-search .js-dgwt-wcas-enable-mobile-form');
278
+ var $handler2 = $('.fusion-flyout-search .js-dgwt-wcas-enable-mobile-form');
279
+
280
+ if ($handler.length) {
281
+
282
+ setTimeout(function () {
283
+ $('.fusion-mobile-menu-search').hide();
284
+ }, 100);
285
+
286
+ $handler[0].click();
287
+ }
288
+
289
+ if ($handler2.length) {
290
+ $handler2[0].click();
291
+ }
292
+
293
+ });
294
+
295
+ $(document).on('click', '.js-dgwt-wcas-om-return', function () {
296
+ var $activeFlyout = $('.fusion-flyout-active');
297
+ if ($activeFlyout) {
298
+ $activeFlyout.removeClass('fusion-flyout-search-active');
299
+ $activeFlyout.removeClass('fusion-flyout-active');
300
+ }
301
+
302
+ });
303
+
304
+
305
+ });
306
+
307
+
308
+ }(jQuery));
309
+ </script>
310
+ <?php
311
+ }, 1000 );
312
+
313
+ }
314
+
315
+ }
includes/Integrations/Themes/Bridge/Bridge.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\Bridge;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Bridge {
13
+
14
+ private $themeSlug = 'bridge';
15
+
16
+ private $themeName = 'Bridge';
17
+
18
+ public function __construct() {
19
+ $this->maybeOverwriteSearch();
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' => sprintf( __( 'Replace %s search bar', 'ajax-search-for-woocommerce' ), $this->themeName ),
37
+ 'type' => 'head',
38
+ 'class' => 'dgwt-wcas-sgs-header'
39
+ );
40
+
41
+ $settings[ $key ][52] = array(
42
+ 'name' => $this->themeSlug . '_settings_head',
43
+ 'label' => sprintf( __( '%s Theme', 'ajax-search-for-woocommerce' ), $this->themeName ),
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' => sprintf( __( 'Replace all %s search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce' ), $this->themeName ),
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 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
+ * Overwrite search
90
+ *
91
+ * @return void
92
+ */
93
+ private function maybeOverwriteSearch() {
94
+ if ( $this->canReplaceSearch() ) {
95
+ require_once DGWT_WCAS_DIR . 'partials/themes/bridge.php';
96
+ }
97
+ }
98
+ }
includes/Integrations/Themes/Ekommart/Ekommart.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\Ekommart;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Ekommart {
13
+
14
+ private $themeSlug = 'ekommart';
15
+
16
+ private $themeName = 'Ekommart';
17
+
18
+ public function __construct() {
19
+ $this->maybeOverwriteSearch();
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' => sprintf( __( 'Replace %s search bar', 'ajax-search-for-woocommerce' ), $this->themeName ),
37
+ 'type' => 'head',
38
+ 'class' => 'dgwt-wcas-sgs-header'
39
+ );
40
+
41
+ $settings[ $key ][52] = array(
42
+ 'name' => $this->themeSlug . '_settings_head',
43
+ 'label' => sprintf( __( '%s Theme', 'ajax-search-for-woocommerce' ), $this->themeName ),
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' => sprintf( __( 'Replace all %s search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce' ), $this->themeName ),
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 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
+ * Overwrite search
90
+ *
91
+ * @return void
92
+ */
93
+ private function maybeOverwriteSearch() {
94
+ if ( $this->canReplaceSearch() ) {
95
+ $this->applyCSS();
96
+
97
+ require_once DGWT_WCAS_DIR . 'partials/themes/ekommart.php';
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Apply custom CSS
103
+ *
104
+ * @return void
105
+ */
106
+ private function applyCSS() {
107
+ add_action( 'wp_head', function () {
108
+ ?>
109
+ <style>
110
+ .dgwt-wcas-search-wrapp {
111
+ max-width: none;
112
+ }
113
+ .ekommart-handheld-footer-bar ul li.search.active .site-search{
114
+ bottom: -100%;
115
+ }
116
+ </style>
117
+ <?php
118
+ } );
119
+ }
120
+ }
includes/Integrations/Themes/Savoy/Savoy.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\Savoy;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Savoy {
13
+
14
+ private $themeSlug = 'savoy';
15
+
16
+ private $themeName = 'Savoy';
17
+
18
+ public function __construct() {
19
+ $this->maybeOverwriteSearch();
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' => sprintf( __( 'Replace %s search bar', 'ajax-search-for-woocommerce' ), $this->themeName ),
37
+ 'type' => 'head',
38
+ 'class' => 'dgwt-wcas-sgs-header'
39
+ );
40
+
41
+ $settings[ $key ][52] = array(
42
+ 'name' => $this->themeSlug . '_settings_head',
43
+ 'label' => sprintf( __( '%s Theme', 'ajax-search-for-woocommerce' ), $this->themeName ),
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' => sprintf( __( 'Replace all %s search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce' ), $this->themeName ),
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 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
+ * Overwrite search
90
+ *
91
+ * @return void
92
+ */
93
+ private function maybeOverwriteSearch() {
94
+ if ( $this->canReplaceSearch() ) {
95
+ $this->applyCSS();
96
+
97
+ add_filter( 'wc_get_template', array( $this, 'getTemplate' ), 10, 5 );
98
+ add_filter( 'nm_header_default_links', array( $this, 'headerLinks' ) );
99
+
100
+ add_action( 'wp_footer', array( $this, 'overwriteMobileSearch' ), 100 );
101
+ }
102
+ }
103
+
104
+ /**
105
+ * Overwrite search template
106
+ *
107
+ * @return string
108
+ */
109
+ public function getTemplate( $template, $template_name, $args, $template_path, $default_path ) {
110
+ if ( $template_name === 'product-searchform_nm.php' ) {
111
+ $template = DGWT_WCAS_DIR . 'partials/themes/savoy/product-searchform_nm.php';
112
+ }
113
+
114
+ return $template;
115
+ }
116
+
117
+ /**
118
+ * Replace search icon in header
119
+ *
120
+ * @return array
121
+ */
122
+ public function headerLinks( $links ) {
123
+ if ( isset( $links['search'] ) ) {
124
+ $links['search'] = '<li class="nm-menu-search menu-item">' . do_shortcode( '[wcas-search-form layout="icon"]' ) . '</li>';
125
+ }
126
+
127
+ return $links;
128
+ }
129
+
130
+ /**
131
+ * Overwrite search bar in mobile menu
132
+ *
133
+ * @return void
134
+ */
135
+ public function overwriteMobileSearch() {
136
+ global $nm_globals;
137
+ if ( isset( $nm_globals['shop_search_header'] ) && $nm_globals['shop_search_header'] ) {
138
+ echo '<div id="wcas-savoy-mobile-search" style="display: none;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
139
+ ?>
140
+ <script>
141
+ (function ($) {
142
+ $(window).on('load', function () {
143
+ $('.nm-mobile-menu-item-search').replaceWith($('#wcas-savoy-mobile-search > div'));
144
+ });
145
+ }(jQuery));
146
+ </script>
147
+ <?php
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Apply custom CSS
153
+ *
154
+ * @return void
155
+ */
156
+ private function applyCSS() {
157
+ add_action( 'wp_head', function () {
158
+ global $nm_theme_options;
159
+ ?>
160
+ <style>
161
+ .nm-shop-search-input-wrap .dgwt-wcas-search-wrapp {
162
+ max-width: 100%;
163
+ }
164
+
165
+ .nm-menu-search .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon {
166
+ padding: 16px 12px 16px 0;
167
+ margin-left: 12px;
168
+ }
169
+
170
+ .nm-menu-search .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler {
171
+ max-width: 16px;
172
+ }
173
+
174
+ <?php if (isset($nm_theme_options['header_navigation_highlight_color'])) { ?>
175
+ .nm-menu-search .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler {
176
+ fill: <?php echo esc_attr( $nm_theme_options['header_navigation_color'] ); ?>
177
+ }
178
+
179
+ <?php }
180
+ if (isset($nm_theme_options['header_navigation_highlight_color'])) { ?>
181
+ .nm-menu-search .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler:hover {
182
+ fill: <?php echo esc_attr( $nm_theme_options['header_navigation_highlight_color'] ); ?>
183
+ }
184
+
185
+ <?php } ?>
186
+ </style>
187
+ <?php
188
+ } );
189
+ }
190
+ }
includes/Integrations/Themes/ShopIsle/ShopIsle.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\ShopIsle;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class ShopIsle {
13
+
14
+ private $themeSlug = 'shop-isle';
15
+
16
+ private $themeName = 'Shop Isle';
17
+
18
+ public function __construct() {
19
+ $this->maybeOverwriteSearch();
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' => sprintf( __( 'Replace %s search bar', 'ajax-search-for-woocommerce' ), $this->themeName ),
37
+ 'type' => 'head',
38
+ 'class' => 'dgwt-wcas-sgs-header'
39
+ );
40
+
41
+ $settings[ $key ][52] = array(
42
+ 'name' => $this->themeSlug . '_settings_head',
43
+ 'label' => sprintf( __( '%s Theme', 'ajax-search-for-woocommerce' ), $this->themeName ),
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' => sprintf( __( 'Replace all %s search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce' ), $this->themeName ),
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 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
+ * Overwrite search
90
+ *
91
+ * @return void
92
+ */
93
+ private function maybeOverwriteSearch() {
94
+ if ( $this->canReplaceSearch() ) {
95
+ $this->applyCSS();
96
+
97
+ add_action( 'init', function () {
98
+ remove_action( 'shop_isle_header', 'shop_isle_primary_navigation', 50 );
99
+ } );
100
+
101
+ add_action( 'shop_isle_header', array( $this, 'replaceSearchForm' ), 60 );
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Apply custom CSS
107
+ *
108
+ * @return void
109
+ */
110
+ private function applyCSS() {
111
+
112
+ add_action( 'wp_head', function () {
113
+ ?>
114
+ <style>
115
+ .dgwt-wcas-ico-magnifier-handler {
116
+ fill: #cbc7c2;
117
+ max-width: 16px;
118
+ margin-top: 3px;
119
+ }
120
+
121
+ .dgwt-wcas-ico-magnifier-handler:hover {
122
+ fill: #ffffff;
123
+ }
124
+
125
+ .dgwt-wcas-is-mobile .dgwt-wcas-ico-magnifier-handler {
126
+ max-width: 20px;
127
+ }
128
+ </style>
129
+ <?php
130
+ } );
131
+
132
+ }
133
+
134
+ /**
135
+ * Replace search from
136
+ */
137
+ public function replaceSearchForm() {
138
+ if ( function_exists( 'shop_isle_primary_navigation' ) ) {
139
+ ob_start();
140
+ shop_isle_primary_navigation();
141
+ $html = ob_get_clean();
142
+ // https://regex101.com/r/AvkuEr/1/
143
+ $re = '/(.*<div class="header-search">)(.*<\/form>\s*<\/div>\s*)(<\/div>.*)/s';
144
+ $subst = '$1' . do_shortcode( '[wcas-search-form layout="icon"]' ) . '$3';
145
+ echo preg_replace( $re, $subst, $html );
146
+ }
147
+ }
148
+ }
includes/Integrations/Themes/Shopical/Shopical.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\Shopical;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Shopical {
13
+
14
+ private $themeSlug = 'shopical';
15
+
16
+ private $themeName = 'Shopical';
17
+
18
+ public function __construct() {
19
+ $this->maybeOverwriteSearch();
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' => sprintf( __( 'Replace %s search bar', 'ajax-search-for-woocommerce' ), $this->themeName ),
37
+ 'type' => 'head',
38
+ 'class' => 'dgwt-wcas-sgs-header'
39
+ );
40
+
41
+ $settings[ $key ][52] = array(
42
+ 'name' => $this->themeSlug . '_settings_head',
43
+ 'label' => sprintf( __( '%s Theme', 'ajax-search-for-woocommerce' ), $this->themeName ),
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' => sprintf( __( 'Replace all %s search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce' ), $this->themeName ),
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 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
+ * Overwrite search
90
+ *
91
+ * @return void
92
+ */
93
+ private function maybeOverwriteSearch() {
94
+ if ( $this->canReplaceSearch() ) {
95
+ $this->applyCSS();
96
+
97
+ require_once DGWT_WCAS_DIR . 'partials/themes/shopical.php';
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Apply custom CSS
103
+ *
104
+ * @return void
105
+ */
106
+ private function applyCSS() {
107
+ add_action( 'wp_head', function () {
108
+ ?>
109
+ <style>
110
+ .dgwt-wcas-overlay-mobile .dgwt-wcas-search-form {
111
+ padding: 0;
112
+ }
113
+ </style>
114
+ <?php
115
+ } );
116
+ }
117
+ }
includes/Integrations/Themes/Shopkeeper/Shopkeeper.php ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\Shopkeeper;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Shopkeeper {
13
+
14
+ private $themeSlug = 'shopkeeper';
15
+
16
+ private $themeName = 'Shopkeeper';
17
+
18
+ public function __construct() {
19
+
20
+ add_filter( 'dgwt/wcas/settings', array( $this, 'registerSettings' ) );
21
+
22
+ $this->maybeReplaceSearch();
23
+ }
24
+
25
+
26
+ /**
27
+ * Add settings
28
+ *
29
+ * @param array $settings
30
+ *
31
+ * @return array
32
+ */
33
+ public function registerSettings( $settings ) {
34
+ $key = 'dgwt_wcas_basic';
35
+
36
+ $settings[ $key ][10] = array(
37
+ 'name' => $this->themeSlug . '_main_head',
38
+ 'label' => sprintf( __( 'Replace %s search bar', 'ajax-search-for-woocommerce' ), $this->themeName ),
39
+ 'type' => 'head',
40
+ 'class' => 'dgwt-wcas-sgs-header'
41
+ );
42
+
43
+ $settings[ $key ][52] = array(
44
+ 'name' => $this->themeSlug . '_settings_head',
45
+ 'label' => sprintf( __( '%s Theme', 'ajax-search-for-woocommerce' ), $this->themeName ),
46
+ 'type' => 'desc',
47
+ 'desc' => Helpers::embeddingInThemeHtml(),
48
+ 'class' => 'dgwt-wcas-sgs-themes-label',
49
+ );
50
+
51
+ $img = DGWT_WCAS()->themeCompatibility->getThemeImageSrc();
52
+ if ( ! empty( $img ) ) {
53
+ $settings[ $key ][52]['label'] = '<img src="' . $img . '">';
54
+ }
55
+
56
+ $settings[ $key ][55] = array(
57
+ 'name' => 'shopkeeper_replace_search',
58
+ 'label' => __( 'Replace', 'ajax-search-for-woocommerce' ),
59
+ 'desc' => sprintf( __( 'Replace all %s search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce' ), $this->themeName ),
60
+ 'type' => 'checkbox',
61
+ 'default' => 'on',
62
+ );
63
+
64
+ $settings[ $key ][90] = array(
65
+ 'name' => $this->themeSlug . '_othersways__head',
66
+ 'label' => __( 'Alternative ways to embed a search bar', 'ajax-search-for-woocommerce' ),
67
+ 'type' => 'head',
68
+ 'class' => 'dgwt-wcas-sgs-header'
69
+ );
70
+
71
+ return $settings;
72
+ }
73
+
74
+ /**
75
+ * Check if can replace the native Woodmart search form
76
+ * by the Ajax Search for WooCommerce form.
77
+ *
78
+ * @return bool
79
+ */
80
+ private function canReplaceSearch() {
81
+ $canIntegrate = false;
82
+
83
+ if ( DGWT_WCAS()->settings->getOption( 'shopkeeper_replace_search', 'on' ) === 'on' ) {
84
+ $canIntegrate = true;
85
+ }
86
+
87
+ return $canIntegrate;
88
+ }
89
+
90
+ /**
91
+ * Maybe replace the default search bar
92
+ *
93
+ * @return void
94
+ */
95
+ private function maybeReplaceSearch() {
96
+
97
+ if ( $this->canReplaceSearch() ) {
98
+
99
+ // Add scripts
100
+ add_action( 'wp_head', array( $this, 'customCSS' ) );
101
+ add_action( 'wp_footer', array( $this, 'customJS' ) );
102
+
103
+ // Remove native form
104
+ add_action( 'init', function () {
105
+ remove_action( 'wp_loaded', 'shopkeeper_predictive_search', 100 );
106
+ } );
107
+
108
+ // Embed search bar
109
+ add_action( 'getbowtied_product_search', function () {
110
+ echo do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="767"]' );
111
+ } );
112
+
113
+ // Change mobile breakpoint from 992 to 767
114
+ add_filter( 'dgwt/wcas/scripts/mobile_breakpoint', function () {
115
+ return 767;
116
+ } );
117
+
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Custom CSS
123
+ *
124
+ * @return void
125
+ */
126
+ public function customCSS() {
127
+ ?>
128
+ <style>
129
+ .site-search.off-canvas {
130
+ min-height: 100px;
131
+ }
132
+
133
+ .admin-bar .site-search.off-canvas {
134
+ min-height: 130px;
135
+ }
136
+
137
+ .site-search.off-canvas > .row {
138
+ margin-top: 30px;
139
+ }
140
+
141
+ .site-search.off-canvas p.search-text {
142
+ position: absolute;
143
+ top: 14px;
144
+ left: 20px;
145
+ }
146
+
147
+ .site-search-close {
148
+ position: absolute;
149
+ top: 5px;
150
+ right: 20px;
151
+ }
152
+
153
+ .site-search .dgwt-wcas-search-wrapp {
154
+ max-width: 800px;
155
+ }
156
+
157
+ .site-search .dgwt-wcas-search-input {
158
+ font-size: 20px;
159
+ border: none;
160
+ border-bottom: 1px solid #ccc;
161
+ }
162
+
163
+ @media (max-width: 1400px) {
164
+ .site-search .dgwt-wcas-search-wrapp {
165
+ max-width: 700px;
166
+ }
167
+ }
168
+
169
+ @media (max-width: 1250px) {
170
+ .site-search .dgwt-wcas-search-wrapp {
171
+ max-width: 500px;
172
+ }
173
+ }
174
+
175
+ @media (max-width: 1000px) {
176
+ .site-search.off-canvas p.search-text {
177
+ display: none;
178
+ }
179
+
180
+ .site-search .dgwt-wcas-search-wrapp {
181
+ max-width: calc(100% - 30px);
182
+ margin-left: 0;
183
+ }
184
+ }
185
+
186
+ @media (max-width: 768px) {
187
+ /*.site-search.off-canvas {*/
188
+ /* display: none;*/
189
+ /*}*/
190
+ }
191
+
192
+ </style>
193
+ <?php
194
+ }
195
+
196
+ /**
197
+ * Custom JS
198
+ *
199
+ * @return void
200
+ */
201
+ public function customJS() {
202
+ ?>
203
+ <script>
204
+ (function ($) {
205
+
206
+ if ($(window).width() > 767) {
207
+
208
+ $('.search-button').on('click', function () {
209
+
210
+ var $input = $('.site-search .dgwt-wcas-search-input');
211
+
212
+ if ($input.length) {
213
+ setTimeout(function () {
214
+ $input.focus();
215
+ }, 300);
216
+ }
217
+ });
218
+
219
+ } else {
220
+
221
+ $('.search-button').on('click', function () {
222
+
223
+ var $mobileHandler = $('.site-search .js-dgwt-wcas-enable-mobile-form');
224
+
225
+ if ($mobileHandler.length) {
226
+ $mobileHandler[0].click();
227
+
228
+ setTimeout(function () {
229
+ if($('.site-search-close button').length){
230
+ $('.site-search-close button').click();
231
+ }
232
+ }, 300);
233
+
234
+ }
235
+
236
+ });
237
+
238
+
239
+ }
240
+
241
+ })(jQuery);
242
+ </script>
243
+ <?php
244
+ }
245
+
246
+ }
includes/Integrations/Themes/Sober/Sober.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\Sober;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class Sober {
13
+
14
+ private $themeSlug = 'sober';
15
+
16
+ private $themeName = 'Sober';
17
+
18
+ public function __construct() {
19
+ $this->maybeOverwriteSearch();
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' => sprintf( __( 'Replace %s search bar', 'ajax-search-for-woocommerce' ), $this->themeName ),
37
+ 'type' => 'head',
38
+ 'class' => 'dgwt-wcas-sgs-header'
39
+ );
40
+
41
+ $settings[ $key ][52] = array(
42
+ 'name' => $this->themeSlug . '_settings_head',
43
+ 'label' => sprintf( __( '%s Theme', 'ajax-search-for-woocommerce' ), $this->themeName ),
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' => sprintf( __( 'Replace all %s search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce' ), $this->themeName ),
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 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
+ * Overwrite search
90
+ *
91
+ * @return void
92
+ */
93
+ private function maybeOverwriteSearch() {
94
+ if ( $this->canReplaceSearch() ) {
95
+ $this->applyCSS();
96
+
97
+ require_once DGWT_WCAS_DIR . 'partials/themes/sober.php';
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Apply custom CSS
103
+ *
104
+ * @return void
105
+ */
106
+ private function applyCSS() {
107
+ add_action( 'wp_head', function () {
108
+ ?>
109
+ <style>
110
+ #mobile-menu .dgwt-wcas-search-wrapp {
111
+ margin-bottom: 15px;
112
+ }
113
+ .menu-item-search .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler {
114
+ max-width: 18px;
115
+ }
116
+ </style>
117
+ <?php
118
+ } );
119
+ }
120
+ }
includes/Integrations/Themes/Storefront/Storefront.php CHANGED
@@ -93,6 +93,12 @@ class Storefront {
93
  */
94
  private function overwriteFunctions() {
95
  if ( $this->canReplaceSearch() ) {
 
 
 
 
 
 
96
  require_once DGWT_WCAS_DIR . 'partials/themes/storefront.php';
97
  }
98
  }
93
  */
94
  private function overwriteFunctions() {
95
  if ( $this->canReplaceSearch() ) {
96
+
97
+ // Force enable overlay for mobile search
98
+ add_filter( 'dgwt/wcas/settings/load_value/key=enable_mobile_overlay', function () {
99
+ return 'on';
100
+ } );
101
+
102
  require_once DGWT_WCAS_DIR . 'partials/themes/storefront.php';
103
  }
104
  }
includes/Integrations/Themes/The7/The7.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\The7;
4
+
5
+ use DgoraWcas\Helpers;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class The7 {
13
+
14
+ private $themeSlug = 'the7';
15
+
16
+ private $themeName = 'The7';
17
+
18
+ public function __construct() {
19
+ $this->maybeOverwriteSearch();
20
+
21
+ add_filter( 'dgwt/wcas/settings', array( $this, 'registerSettings' ) );
22
+
23
+
24
+ }
25
+
26
+
27
+ /**
28
+ * Add settings
29
+ *
30
+ * @param array $settings
31
+ *
32
+ * @return array
33
+ */
34
+ public function registerSettings( $settings ) {
35
+ $key = 'dgwt_wcas_basic';
36
+
37
+ $settings[ $key ][10] = array(
38
+ 'name' => $this->themeSlug . '_main_head',
39
+ 'label' => sprintf( __( 'Replace %s search bar', 'ajax-search-for-woocommerce' ), $this->themeName ),
40
+ 'type' => 'head',
41
+ 'class' => 'dgwt-wcas-sgs-header'
42
+ );
43
+
44
+ $settings[ $key ][52] = array(
45
+ 'name' => $this->themeSlug . '_settings_head',
46
+ 'label' => sprintf( __( '%s Theme', 'ajax-search-for-woocommerce' ), $this->themeName ),
47
+ 'type' => 'desc',
48
+ 'desc' => Helpers::embeddingInThemeHtml(),
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
+ $settings[ $key ][55] = array(
58
+ 'name' => $this->themeSlug . '_replace_search',
59
+ 'label' => __( 'Replace', 'ajax-search-for-woocommerce' ),
60
+ 'desc' => sprintf( __( 'Replace all %s search bars with the Ajax Search for WooCommerce.', 'ajax-search-for-woocommerce' ), $this->themeName ),
61
+ 'type' => 'checkbox',
62
+ 'default' => 'off',
63
+ );
64
+
65
+ $settings[ $key ][90] = array(
66
+ 'name' => $this->themeSlug . '_othersways__head',
67
+ 'label' => __( 'Alternative ways to embed a search bar', 'ajax-search-for-woocommerce' ),
68
+ 'type' => 'head',
69
+ 'class' => 'dgwt-wcas-sgs-header'
70
+ );
71
+
72
+ return $settings;
73
+ }
74
+
75
+ /**
76
+ * Check if can replace the native Woodmart search form
77
+ * by the Ajax Search for WooCommerce form.
78
+ *
79
+ * @return bool
80
+ */
81
+ private function canReplaceSearch() {
82
+ $canIntegrate = false;
83
+
84
+ if ( DGWT_WCAS()->settings->getOption( $this->themeSlug . '_replace_search', 'off' ) === 'on' ) {
85
+ $canIntegrate = true;
86
+ }
87
+
88
+ return $canIntegrate;
89
+ }
90
+
91
+ /**
92
+ * Overwrite search
93
+ *
94
+ * @return void
95
+ */
96
+ private function maybeOverwriteSearch() {
97
+ if ( $this->canReplaceSearch() ) {
98
+
99
+ $this->applyCSS();
100
+
101
+ add_filter( 'presscore_template_manager_located_template', array( $this, 'changeTemplatePath' ), 10, 2 );
102
+
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Change template path
108
+ *
109
+ * @param string $templateName
110
+ * @param array $templateNames
111
+ */
112
+ public function changeTemplatePath( $templateName, $templateNames ) {
113
+
114
+ if ( strpos( $templateName, 'searchform.php' ) !== false ) {
115
+ $templateName = DGWT_WCAS_DIR . 'partials/themes/the7-searchform.php';
116
+ }
117
+
118
+ return $templateName;
119
+ }
120
+
121
+ /**
122
+ * Apply custom CSS
123
+ *
124
+ * @return void
125
+ */
126
+ private function applyCSS() {
127
+
128
+ add_action( 'wp_head', function () {
129
+ ?>
130
+ <style>
131
+ .mini-widgets .dgwt-wcas-search-icon {
132
+ width: 17px;
133
+ margin-top: -2px;
134
+ }
135
+ .mini-widgets .dgwt-wcas-layout-icon-open .dgwt-wcas-search-icon-arrow {
136
+ top: calc(100% + 5px);
137
+ }
138
+ </style>
139
+ <?php
140
+ } );
141
+
142
+ }
143
+
144
+ }
includes/Integrations/Themes/ThemesCompatibility.php CHANGED
@@ -71,10 +71,51 @@ class ThemesCompatibility {
71
  'slug' => 'woodmart',
72
  'name' => 'Woodmart',
73
  ),
74
- 'enfold' => array(
75
  'slug' => 'enfold',
76
  'name' => 'Enfold',
77
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  );
79
  }
80
 
@@ -146,3 +187,5 @@ class ThemesCompatibility {
146
  }
147
 
148
  }
 
 
71
  'slug' => 'woodmart',
72
  'name' => 'Woodmart',
73
  ),
74
+ 'enfold' => array(
75
  'slug' => 'enfold',
76
  'name' => 'Enfold',
77
+ ),
78
+ 'shopkeeper' => array(
79
+ 'slug' => 'shopkeeper',
80
+ 'name' => 'Shopkeeper',
81
+ ),
82
+ 'the7' => array(
83
+ 'slug' => 'the7',
84
+ 'name' => 'The7',
85
+ ),
86
+ 'dt-the7' => array(
87
+ 'slug' => 'dt-the7',
88
+ 'name' => 'The7',
89
+ ),
90
+ 'avada' => array(
91
+ 'slug' => 'avada',
92
+ 'name' => 'Avada',
93
+ ),
94
+ 'shop-isle' => array(
95
+ 'slug' => 'shop-isle',
96
+ 'className' => 'ShopIsle',
97
+ 'name' => 'Shop Isle',
98
+ ),
99
+ 'shopical' => array(
100
+ 'slug' => 'shopical',
101
+ 'name' => 'Shopical',
102
+ ),
103
+ 'ekommart' => array(
104
+ 'slug' => 'ekommart',
105
+ 'name' => 'Ekommart',
106
+ ),
107
+ 'savoy' => array(
108
+ 'slug' => 'savoy',
109
+ 'name' => 'Savoy',
110
+ ),
111
+ 'sober' => array(
112
+ 'slug' => 'sober',
113
+ 'name' => 'Sober',
114
+ ),
115
+ 'bridge' => array(
116
+ 'slug' => 'bridge',
117
+ 'name' => 'Bridge',
118
+ ),
119
  );
120
  }
121
 
187
  }
188
 
189
  }
190
+
191
+
includes/Personalization.php CHANGED
@@ -38,6 +38,8 @@ class Personalization {
38
 
39
  $max_form_width = absint( DGWT_WCAS()->settings->getOption( 'max_form_width' ) );
40
 
 
 
41
  ob_start();
42
  ?>
43
  <style type="text/css">
@@ -192,6 +194,14 @@ class Personalization {
192
 
193
  <?php endif; ?>
194
 
 
 
 
 
 
 
 
 
195
  </style>
196
  <?php
197
  $css = ob_get_contents();
38
 
39
  $max_form_width = absint( DGWT_WCAS()->settings->getOption( 'max_form_width' ) );
40
 
41
+ $search_icon_color = DGWT_WCAS()->settings->getOption( 'search_icon_color' );
42
+
43
  ob_start();
44
  ?>
45
  <style type="text/css">
194
 
195
  <?php endif; ?>
196
 
197
+ <?php
198
+ if(!empty($search_icon_color)){
199
+ echo '.dgwt-wcas-search-icon { color: ' . sanitize_text_field( $search_icon_color ) . ';}';
200
+ echo '.dgwt-wcas-search-icon path { fill: ' . sanitize_text_field( $search_icon_color ) . ';}';
201
+ }
202
+
203
+ ?>
204
+
205
  </style>
206
  <?php
207
  $css = ob_get_contents();
includes/Product.php CHANGED
@@ -6,10 +6,10 @@ namespace DgoraWcas;
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' ) ) {
@@ -469,7 +469,7 @@ class Product {
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 );
6
  use DgoraWcas\Engines\TNTSearchMySQL\Indexer\Utils;
7
 
8
  class Product {
9
+ protected $productID = 0;
10
+ protected $wcProduct = null;
11
+ protected $langCode = 'en';
12
  private $variations = array();
 
13
 
14
  public function __construct( $product ) {
15
  if ( ! empty( $product ) && is_object( $product ) && is_a( $product, 'WC_Product' ) ) {
469
  $rawAttributes = apply_filters( 'dgwt/wcas/product/custom_attributes', $rawAttributes, $productID );
470
 
471
  foreach ( $rawAttributes as $rawAttribute ) {
472
+ if ( array_key_exists( 'is_taxonomy', $rawAttribute ) && $rawAttribute['is_taxonomy'] == 0 && ! empty( $rawAttribute['value'] ) ) {
473
  $partTerms = explode( ' | ', $rawAttribute['value'] );
474
 
475
  $terms = array_merge( $terms, $partTerms );
includes/ProductVariation.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas;
4
+
5
+ class ProductVariation extends Product {
6
+
7
+ public function __construct( $product ) {
8
+ if ( ! empty( $product ) && is_object( $product ) && is_a( $product, 'WC_Product_Variation' ) ) {
9
+ $this->productID = $product->get_id();
10
+ $this->wcProduct = $product;
11
+ }
12
+
13
+ if ( ! empty( $product ) && is_object( $product ) && is_a( $product, 'WP_Post' ) ) {
14
+ $this->productID = absint( $product->ID );
15
+ $this->wcProduct = wc_get_product( $product );
16
+ }
17
+
18
+ if ( is_numeric( $product ) && 'product_variation' === get_post_type( $product ) ) {
19
+ $this->productID = absint( $product );
20
+ $this->wcProduct = wc_get_product( $product );
21
+ }
22
+
23
+ $this->setLanguage();
24
+ }
25
+
26
+ /**
27
+ * Prepare attributes for display
28
+ * @return array
29
+ */
30
+ public function getVariationAttributes() {
31
+ $formattedAttributes = array();
32
+
33
+ $attributes = $this->wcProduct->get_variation_attributes();
34
+
35
+ if ( ! empty( $attributes ) && is_array( $attributes ) ) {
36
+ foreach ( $attributes as $key => $termSlug ) {
37
+
38
+ if ( strpos( $key, 'attribute_' ) !== false ) {
39
+ $taxonomy = str_replace( 'attribute_', '', $key );
40
+
41
+ $term = get_term_by( 'slug', $termSlug, $taxonomy );
42
+
43
+ if ( ! empty( $term ) && is_object( $term ) && is_a( $term, 'WP_Term' ) ) {
44
+ $attributeLabel = wc_attribute_label( $taxonomy );
45
+
46
+ $formattedAttributes[] = array(
47
+ 'label' => $attributeLabel,
48
+ 'value' => $term->name
49
+ );
50
+ }
51
+
52
+
53
+ }
54
+ }
55
+ }
56
+
57
+ return apply_filters( 'dgwt/wcas/product/variation_attributes', $formattedAttributes );
58
+ }
59
+
60
+ }
includes/Scripts.php CHANGED
@@ -42,36 +42,37 @@ class Scripts
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();
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
+ 'mobile_breakpoint' => $layout->breakpoint,
69
+ 'mobile_overlay_wrapper' => $layout->mobile_overlay_wrapper,
70
+ 'debounce_wait_ms' => apply_filters( 'dgwt/wcas/scripts/debounce_wait_ms', 400 ),
71
+ 'send_ga_events' => apply_filters( 'dgwt/wcas/scripts/send_ga_events', true ),
72
+ 'enable_ga_site_search_module' => apply_filters( 'dgwt/wcas/scripts/enable_ga_site_search_module', false ),
73
+ 'magnifier_icon' => Helpers::getMagnifierIco( '' ),
74
+ 'custom_params' => (object) apply_filters( 'dgwt/wcas/scripts/custom_params', array() ),
75
+ 'convert_html' => true,
76
  );
77
  if ( Multilingual::isMultilingual() ) {
78
  $localize['current_lang'] = Multilingual::getCurrentLanguage();
includes/Settings.php CHANGED
@@ -233,9 +233,16 @@ class Settings
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',
233
  ),
234
  700 => array(
235
  'name' => 'search_form',
236
+ 'label' => __( 'Colors', 'ajax-search-for-woocommerce' ),
237
  'type' => 'head',
238
  'class' => 'dgwt-wcas-sgs-header js-dgwt-wcas-adv-settings',
239
+ ),
240
+ 750 => array(
241
+ 'name' => 'search_icon_color',
242
+ 'label' => __( 'Search icon', 'ajax-search-for-woocommerce' ),
243
+ 'type' => 'color',
244
+ 'class' => 'js-dgwt-wcas-adv-settings',
245
+ 'default' => '',
246
  ),
247
  800 => array(
248
  'name' => 'bg_input_color',
includes/Shortcode.php CHANGED
@@ -22,10 +22,13 @@ class Shortcode {
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';
22
  */
23
  public static function addBody( $atts ) {
24
 
25
+ $layout = Helpers::getLayoutSettings();
26
+
27
  $searchArgs = shortcode_atts( array(
28
+ 'class' => '',
29
+ 'layout' => $layout->layout,
30
+ 'mobile_overlay' => $layout->mobile_overlay,
31
+ 'details_box' => 'hide'
32
  ), $atts, 'wcas-search-form' );
33
 
34
  $searchArgs['class'] .= empty( $search_args['class'] ) ? 'woocommerce' : ' woocommerce';
partials/details-panel/product-variation.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 wp_strip_all_tags($vars->name); ?>">
13
+ <div class="dgwt-wcas-details-main-image">
14
+ <img src="<?php echo esc_url( $vars->imageSrc ); ?>" alt="<?php echo wp_strip_all_tags( $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 wp_strip_all_tags($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->attributes ) ): ?>
41
+ <div class="dgwt-wcas-details-attributes">
42
+ <?php foreach ( $vars->attributes as $attribute ): ?>
43
+ <div class="dgwt-wcas-details-attribute"><b><?php echo esc_html( $attribute['label'] ); ?></b>: <span><?php echo esc_html( $attribute['value'] ); ?></span></div>
44
+ <?php endforeach; ?>
45
+ </div>
46
+ <?php endif; ?>
47
+
48
+ <div class="dgwt-wcas-details-hr"></div>
49
+
50
+ <?php if ( ! empty( $vars->stockAvailability ) ) {
51
+ echo $vars->stockAvailability;
52
+ }; ?>
53
+
54
+ <div class="dgwt-wcas-pd-addtc js-dgwt-wcas-pd-addtc">
55
+ <form class="dgwt-wcas-pd-addtc-form" action="" method="post" enctype="multipart/form-data">
56
+ <?php
57
+
58
+ if ( $vars->showQuantity ) {
59
+ woocommerce_quantity_input( array(
60
+ 'input_name' => 'js-dgwt-wcas-quantity',
61
+ ), $vars->wooObject, true );
62
+ }
63
+
64
+ echo WC_Shortcodes::product_add_to_cart( array(
65
+ 'id' => $vars->ID,
66
+ 'show_price' => false,
67
+ 'style' => '',
68
+ ) );
69
+ ?>
70
+ </form>
71
+ </div>
72
+
73
+ </div>
74
+
75
+ </div>
76
+ </div>
partials/details-panel/product.php CHANGED
@@ -9,14 +9,14 @@ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
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 ) ): ?>
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 wp_strip_all_tags($vars->name); ?>">
13
  <div class="dgwt-wcas-details-main-image">
14
+ <img src="<?php echo esc_url( $vars->imageSrc ); ?>" alt="<?php echo wp_strip_all_tags( $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 wp_strip_all_tags($vars->name); ?>">
20
  <?php echo $vars->name; ?>
21
  </a>
22
  <?php if ( ! empty( $vars->sku ) ): ?>
partials/search-form.php CHANGED
@@ -34,7 +34,7 @@ $customParams = apply_filters( 'dgwt/wcas/search_bar/custom_params', array(), DG
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)) . '"' : ''; ?>
34
  type="search"
35
  class="dgwt-wcas-search-input"
36
  name="<?php echo Helpers::getSearchInputName(); ?>"
37
+ value="<?php echo apply_filters( 'dgwt/wcas/search_bar/value', get_search_query(), DGWT_WCAS()->searchInstances); ?>"
38
  placeholder="<?php echo Helpers::getLabel( 'search_placeholder' ); ?>"
39
  autocomplete="off"
40
  <?php echo ! empty( $customParams ) ? ' data-custom-params="' . htmlspecialchars(json_encode( (object) $customParams)) . '"' : ''; ?>
partials/themes/bridge.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
5
+ exit;
6
+ }
7
+
8
+ add_action( 'wp_head', function () {
9
+ ?>
10
+ <style>
11
+ .page_header .qode_search_form .dgwt-wcas-search-wrapp {
12
+ max-width: 100%;
13
+ margin-top: 5px;
14
+ }
15
+
16
+ .page_header .qode_search_form_2 .dgwt-wcas-search-wrapp {
17
+ max-width: 100%;
18
+ margin-top: 30px;
19
+ }
20
+
21
+ .page_header .qode_search_form_2 .dgwt-wcas-search-wrapp input[type=search],
22
+ .page_header .qode_search_form_3 .dgwt-wcas-search-wrapp input[type=search] {
23
+ text-transform: none;
24
+ }
25
+
26
+ .page_header .qode_search_form_2:not(.animated) .dgwt-wcas-preloader {
27
+ display: none;
28
+ }
29
+
30
+ .page_header .qode_search_form_3 .dgwt-wcas-search-wrapp {
31
+ max-width: 100%;
32
+ }
33
+ </style>
34
+ <?php
35
+ } );
36
+
37
+ add_action( 'wp_footer', function () {
38
+ if ( ! function_exists( 'bridge_qode_options' ) ) {
39
+ return;
40
+ }
41
+ if ( bridge_qode_options()->getOptionValue( 'enable_search' ) !== 'yes' ) {
42
+ return;
43
+ }
44
+ $search_type = bridge_qode_options()->getOptionValue( 'search_type' );
45
+ if ( $search_type === 'search_slides_from_window_top' ) { ?>
46
+ <div id="wcas-bridge-search" style="display: block;">
47
+ <div class="qode_search_form">
48
+ <div class="container">
49
+ <div class="container_inner clearfix">
50
+ <?php echo do_shortcode( '[wcas-search-form]' ); ?>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ <script>
56
+ var bridgeSearch = document.querySelector('#searchform');
57
+ if (bridgeSearch !== null) {
58
+ bridgeSearch.replaceWith(document.querySelector('#wcas-bridge-search > div'));
59
+ }
60
+ </script>
61
+ <?php } else if ( $search_type === 'search_slides_from_header_bottom' ) { ?>
62
+ <div id="wcas-bridge-search" style="display: block;">
63
+ <div class="qode_search_form_2">
64
+ <div class="container">
65
+ <div class="container_inner clearfix">
66
+ <div class="form_holder_outer">
67
+ <?php echo do_shortcode( '[wcas-search-form]' ); ?>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ </div>
72
+ </div>
73
+ <script>
74
+ var bridgeSearch = document.querySelector('.page_header .qode_search_form_2');
75
+ if (bridgeSearch !== null) {
76
+ bridgeSearch.replaceWith(document.querySelector('#wcas-bridge-search > div'));
77
+ }
78
+ </script>
79
+ <?php } else if ( $search_type === 'search_covers_header' ) { ?>
80
+ <div id="wcas-bridge-search" style="display: block;">
81
+ <div class="qode_search_form_3">
82
+ <div class="container">
83
+ <div class="container_inner clearfix">
84
+ <div class="form_holder_outer">
85
+ <div class="form_holder">
86
+ <?php echo do_shortcode( '[wcas-search-form]' ); ?>
87
+ </div>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </div>
93
+ <script>
94
+ var bridgeSearch = document.querySelector('.page_header .qode_search_form_3');
95
+ if (bridgeSearch !== null) {
96
+ bridgeSearch.replaceWith(document.querySelector('#wcas-bridge-search > div'));
97
+ }
98
+ </script>
99
+ <?php } else if ( $search_type === 'fullscreen_search' ) { ?>
100
+ <div id="wcas-bridge-search" style="display: block;">
101
+ <div class="fullscreen_search_form">
102
+ <div class="form_holder">
103
+ <?php echo do_shortcode( '[wcas-search-form]' ); ?>
104
+ </div>
105
+ </div>
106
+ </div>
107
+ <script>
108
+ var bridgeSearch = document.querySelector('.fullscreen_search_form');
109
+ if (bridgeSearch !== null) {
110
+ bridgeSearch.replaceWith(document.querySelector('#wcas-bridge-search > div'));
111
+ }
112
+ </script>
113
+ <?php }
114
+ } );
partials/themes/ekommart.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
5
+ exit;
6
+ }
7
+
8
+ if ( ! function_exists( 'ekommart_product_search' ) ) {
9
+ function ekommart_product_search() {
10
+ ?>
11
+ <div class="site-search">
12
+ <?php echo do_shortcode( '[wcas-search-form]' ); ?>
13
+ </div>
14
+ <?php
15
+ }
16
+ }
17
+
18
+ if ( ! function_exists( 'ekommart_handheld_footer_bar_search' ) ) {
19
+ function ekommart_handheld_footer_bar_search() {
20
+ ?>
21
+ <a href=""><span class="title"><?php echo esc_attr__( 'Search', 'ekommart' ); ?></span></a>
22
+ <div class="site-search">
23
+ <?php echo do_shortcode( '[wcas-search-form]' ); ?>
24
+ </div>
25
+ <?php
26
+ }
27
+ }
28
+
29
+ add_action( 'wp_footer', 'dgwt_wcas_ekommart_mobile_search', 100 );
30
+
31
+ function dgwt_wcas_ekommart_mobile_search() {
32
+ ?>
33
+ <script>
34
+ (function ($) {
35
+ $(window).on('load', function () {
36
+ $(document).on('click', '.ekommart-handheld-footer-bar .search > a', function (e) {
37
+ var $siteSearch = $(this).next();
38
+ var $form = $siteSearch.find('.js-dgwt-wcas-enable-mobile-form');
39
+ if ($form.eq(0)) {
40
+ $form.click();
41
+ }
42
+ e.preventDefault();
43
+ });
44
+ });
45
+ }(jQuery));
46
+ </script>
47
+ <?php
48
+ }
partials/themes/savoy/product-searchform_nm.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
4
+ exit;
5
+ }
6
+ ?>
7
+ <div id="nm-shop-search">
8
+ <div class="nm-row">
9
+ <div class="col-xs-12">
10
+ <div class="nm-shop-search-inner">
11
+ <div class="nm-shop-search-input-wrap">
12
+ <?php echo do_shortcode( '[wcas-search-form]' ); ?>
13
+ </div>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ </div>
partials/themes/shopical.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
5
+ exit;
6
+ }
7
+
8
+ if ( ! function_exists( 'shopical_product_search_form' ) ) {
9
+ function shopical_product_search_form() {
10
+ echo do_shortcode( '[wcas-search-form]' );
11
+ }
12
+ }
13
+
14
+ add_action( 'wp_footer', 'dgwt_wcas_shopical_mobile_search', 100 );
15
+
16
+ function dgwt_wcas_shopical_mobile_search() {
17
+ ?>
18
+ <script>
19
+ (function ($) {
20
+ $(window).on('load', function () {
21
+ $('.open-search-form').off('click');
22
+ $(document).on('click', '.open-search-form', function (e) {
23
+ var $overlay = $(this).prev();
24
+ var $form = $overlay.find('.js-dgwt-wcas-enable-mobile-form');
25
+ if ($form.eq(0)) {
26
+ $form.click();
27
+ }
28
+ e.preventDefault();
29
+ });
30
+ });
31
+ }(jQuery));
32
+ </script>
33
+ <?php
34
+ }
partials/themes/sober.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
5
+ exit;
6
+ }
7
+
8
+ add_action( 'wp_footer', 'dgwt_wcas_sober_search', 10 );
9
+
10
+ function dgwt_wcas_sober_search() {
11
+ echo '<div id="wcas-sober-mobile-search" style="display: none;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
12
+ echo '<div id="wcas-sober-search" style="display: block;">' . do_shortcode( '[wcas-search-form layout="icon"]' ) . '</div>';
13
+ ?>
14
+ <script>
15
+ var soberSearch = document.querySelector('.menu-item-search a');
16
+ if (soberSearch !== null) {
17
+ soberSearch.replaceWith(document.querySelector('#wcas-sober-search > div'));
18
+ }
19
+ (function ($) {
20
+ $(window).on('load', function () {
21
+ var soberSearchMobile = $('#mobile-menu .search-form');
22
+ if (soberSearchMobile.eq(0)) {
23
+ soberSearchMobile.replaceWith($('#wcas-sober-mobile-search > div'));
24
+ }
25
+ });
26
+ }(jQuery));
27
+ </script>
28
+ <?php
29
+ }
30
+
31
+ if ( ! function_exists( 'sober_search_modal' ) ) {
32
+ function sober_search_modal() {
33
+ }
34
+ }
partials/themes/storefront.php CHANGED
@@ -19,26 +19,21 @@ if ( ! function_exists( 'storefront_product_search' ) ) {
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
  }
19
  add_action( 'wp_footer', 'dgwt_wcas_storefront_inverse_orientation', 100 );
20
 
21
  function dgwt_wcas_storefront_inverse_orientation() {
22
+ ?>
23
+ <script>
24
+ (function ($) {
25
+ $(window).on('load', function () {
26
+ $(document).on('click', '.storefront-handheld-footer-bar .search > a', function (e) {
27
+ var $wrapper = $(this).parent();
28
+ $wrapper.removeClass('active');
29
 
30
+ setTimeout(function () {
31
+ $wrapper.find('.js-dgwt-wcas-enable-mobile-form')[0].click();
32
+ }, 200);
33
+ e.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
34
  });
35
+ });
36
+ }(jQuery));
37
+ </script>
38
+ <?php
39
  }
partials/themes/the7-searchform.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
5
+ exit;
6
+ }
7
+
8
+ echo do_shortcode('[wcas-search-form]');
readme.txt CHANGED
@@ -1,11 +1,10 @@
1
  === Ajax Search for WooCommerce ===
2
  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.5
7
  Requires PHP: 5.5
8
- Stable tag: 1.7.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -96,10 +95,15 @@ There are five easy ways to display the AJAX search box in your theme:
96
  Or insert this function inside php file ( often it used to insert form inside page templates files ):
97
 
98
  = How do I replace the existing search bar in my theme with AJAX Search? =
99
- We have prepared a one-click replacement of search form for the following themes:
100
 
101
  * Storefront
102
  * Flatsome
 
 
 
 
 
103
 
104
  If you want to replace your search bar in some other theme, please [contact our support team](https://ajaxsearch.pro/contact/?utm_source=readme&utm_medium=referral&utm_campaign=asfw&utm_content=contact&utm_gen=utmdc)
105
  Also, we have developed snippets to replace the search bar in Porto, Autusin, Avada, Hestia, Electro and more themes. We will share the code soon.
@@ -136,6 +140,32 @@ You can read more and compare Pro and Free features here: [feature comparison](h
136
 
137
  == Changelog ==
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  = 1.7.1, May 17, 2020 =
140
  * FIX: Selecting suggestions issue
141
 
1
  === Ajax Search for WooCommerce ===
2
  Contributors: damian-gora
 
3
  Tags: woocommerce search, ajax search, search by sku, product search, woocommerce
4
  Requires at least: 5.0
5
  Tested up to: 5.5
6
  Requires PHP: 5.5
7
+ Stable tag: 1.7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
95
  Or insert this function inside php file ( often it used to insert form inside page templates files ):
96
 
97
  = How do I replace the existing search bar in my theme with AJAX Search? =
98
+ We have prepared a one-click replacement of search bar for the following themes:
99
 
100
  * Storefront
101
  * Flatsome
102
+ * OceanWP
103
+ * Astra
104
+ * Avada
105
+ * and 13 more... See complete list of integrated themes on [our docs](https://ajaxsearch.pro/docs/integrations/?utm_source=readme&utm_medium=referral&utm_campaign=asfw&utm_content=theme-integrations).
106
+
107
 
108
  If you want to replace your search bar in some other theme, please [contact our support team](https://ajaxsearch.pro/contact/?utm_source=readme&utm_medium=referral&utm_campaign=asfw&utm_content=contact&utm_gen=utmdc)
109
  Also, we have developed snippets to replace the search bar in Porto, Autusin, Avada, Hestia, Electro and more themes. We will share the code soon.
140
 
141
  == Changelog ==
142
 
143
+ = 1.7.2, July 12, 2020 =
144
+ * ADD: Integration with FacetWP plugin
145
+ * ADD: Support for Shopkeeper theme
146
+ * ADD: Support for The7 theme
147
+ * ADD: Support for Avada theme
148
+ * ADD: Support for Shop Isle theme
149
+ * ADD: Support for Shopical theme
150
+ * ADD: Support for Ekommart theme
151
+ * ADD: Support for Savoy theme
152
+ * ADD: Support for Sober theme
153
+ * ADD: Support for Bridge theme
154
+ * ADD: Possibility to change search icon color
155
+ * ADD: New filter hook for a search form value
156
+ * ADD: Support for Site Search module in Google Analytics
157
+ * FIX: Add CSS border-box for each elements in search bar, suggestions and details panel
158
+ * FIX: Sending events to Google Tag Manager
159
+ * FIX: Remove &lt;b&gt; from product title
160
+ * FIX: Search in categories and tags for Russian terms
161
+ * FIX: Duplicated category in breadcrumb
162
+ * FIX: No results when searching for phrase included apostrophe or double quote
163
+ * FIX: Details panel - Remove HTML from titles attribute
164
+ * FIX: Fixed for integration with Woo Product Filter plugin by WooBeWoo
165
+ * FIX: Fixed for integration with XforWooCommerce plugin
166
+ * FIX: Error: Undefined index: is_taxonomy in some cases
167
+
168
+
169
  = 1.7.1, May 17, 2020 =
170
  * FIX: Selecting suggestions issue
171