first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
if (
! empty( $_REQUEST['dgwt-wcas-debug-analytics-delete-all-records'] ) &&
! empty( $_REQUEST['_wpnonce'] ) &&
wp_verify_nonce( $_REQUEST['_wpnonce'], 'dgwt_wcas_debug_analytics' )
) {
\DgoraWcas\Analytics\Database::wipeAllRecords();
?>
<div class="dgwt-wcas-notice notice notice-success">
<p>All analytics records have been deleted.</p>
</div>
<?php
}
if (
! empty( $_REQUEST['dgwt-wcas-debug-analytics-run-maintenance-task'] ) &&
! empty( $_REQUEST['_wpnonce'] ) &&
wp_verify_nonce( $_REQUEST['_wpnonce'], 'dgwt_wcas_debug_analytics' )
) {
do_action( \DgoraWcas\Analytics\Maintenance::HOOK );
?>
<div class="dgwt-wcas-notice notice notice-success">
<p>The task of maintaining the search analytics has been completed.</p>
</div>
<?php
}
?>
<h3>Analytics</h3>
<form action="<?php echo admin_url( 'admin.php' ); ?>" method="get">
<input type="hidden" name="page" value="dgwt_wcas_debug">
<?php wp_nonce_field( 'dgwt_wcas_debug_analytics', '_wpnonce', false ); ?>
<input type="submit" name="dgwt-wcas-debug-analytics-delete-all-records" class="button" value="Delete all records">
<input type="submit" name="dgwt-wcas-debug-analytics-run-maintenance-task" class="button" value="Run maintenance task">
</form>
<table class="wc_status_table widefat dgwt-wcas-table-debug-analytics">
<tr>
<td><b>Does the table exist?</b></td>
<td><?php echo \DgoraWcas\Analytics\Database::exist() ? 'yes' : 'no'; ?></td>
</tr>
<tr>
<td><b>Total records</b></td>
<td><?php echo \DgoraWcas\Analytics\Database::getRecordsCount(); ?></td>
</tr>
<tr>
<td><b>Is the maintenance task scheduled?</b></td>
<td><?php echo wp_next_scheduled( \DgoraWcas\Analytics\Maintenance::HOOK ) ? 'yes' : 'no'; ?></td>
</tr>
<tr>
<td><b>Constant <code>DGWT_WCAS_ANALYTICS_ONLY_CRITICAL</code></b></td>
<?php if ( defined( 'DGWT_WCAS_ANALYTICS_ONLY_CRITICAL' ) ) { ?>
<td>Is defined. <b><?php var_dump( DGWT_WCAS_ANALYTICS_ONLY_CRITICAL ); ?></b></td>
<?php } else { ?>
<td>not defined</td>
<?php } ?>
</tr>
<tr>
<td><b>Constant <code>DGWT_WCAS_ANALYTICS_EXPIRATION_IN_DAYS</code></b></td>
<?php if ( defined( 'DGWT_WCAS_ANALYTICS_EXPIRATION_IN_DAYS' ) ) { ?>
<td>Is defined. Days: <b><?php echo DGWT_WCAS_ANALYTICS_EXPIRATION_IN_DAYS; ?></b></td>
<?php } else { ?>
<td>not defined</td>
<?php } ?>
</tr>
</table>
<?php

View File

@@ -0,0 +1,33 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
if (
! empty( $_REQUEST['dgwt-wcas-debug-setting-reset-to-default'] ) &&
! empty( $_REQUEST['_wpnonce'] ) &&
wp_verify_nonce( $_REQUEST['_wpnonce'], 'dgwt_wcas_debug_reset_settings' )
) {
global $dgwtWcasSettings;
$dgwtWcasSettings = array();
delete_option( DGWT_WCAS_SETTINGS_KEY );
DgoraWcas\Admin\Install::createOptions();
?>
<div class="dgwt-wcas-notice notice notice-success">
<p>The settings have been reset to the default values.</p>
</div>
<?php
}
?>
<h3>Settings</h3>
<form action="<?php echo admin_url( 'admin.php' ); ?>" method="get"
onsubmit="return confirm('Are you sure you want to reset the settings?');">
<input type="hidden" name="page" value="dgwt_wcas_debug">
<?php wp_nonce_field( 'dgwt_wcas_debug_reset_settings', '_wpnonce', false ); ?>
<input type="submit" name="dgwt-wcas-debug-setting-reset-to-default" class="button"
value="Reset the plugin settings to default values">
</form>
<?php

View File

@@ -0,0 +1,149 @@
<?php
// Exit if accessed directly
if ( !defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
$prefix = 'fibosearch-debug_page-';
?>
<div class="wrap dgwt-wcas-settings dgwt-wcas-debug">
<h2 class="dgwt-wcas-settings__head">
<div class="dgwt-wcas-settings__title">
<div class="dgwt-wcas-settings__title-top">
<div class="dgwt-wcas-settings-logo-wrapper">
<img class="dgwt-wcas-settings-logo" src="<?php
echo DGWT_WCAS_URL . 'assets/img/logo-30.png' ;
?>"/>
<span class="dgwt-wcas-settings-logo-pro">Pro</span>
</div>
<span class="dgwt-wcas-settings__title-core"><?php
_e( 'Debug page', 'ajax-search-for-woocommerce' );
?></span>
</div>
</div>
</h2>
<h2 class="nav-tab-wrapper fibosearch-debug_page-nav-tab-wrapper">
<?php
?>
<a href="#dgwt_wcas_deb_anatytics" class="nav-tab" id="dgwt_wcas_deb_anatytics-tab">Analytics</a>
<a href="#dgwt_wcas_deb_maintenance" class="nav-tab" id="dgwt_wcas_deb_maintenance-tab">Maintenance</a>
</h2>
<?php
$active = 'analytics';
?>
<div class="dgwt-wcas-settings-body js-dgwt-wcas-settings-body" data-dgwt-wcas-active="<?php
echo esc_attr( $active ) ;
?>">
<?php
?>
<div id="dgwt_wcas_deb_anatytics" class="fibosearch-debug_page-group">
<?php
include_once DGWT_WCAS_DIR . 'partials/admin/debug/body-analytics.php';
?>
</div>
<div id="dgwt_wcas_deb_maintenance" class="fibosearch-debug_page-group">
<?php
include_once DGWT_WCAS_DIR . 'partials/admin/debug/body-maintenance.php';
?>
</div>
</div>
</div>
<script>
jQuery(document).ready(function ($) {
function markActiveGroup($group) {
var name = $group.attr('id').replace('dgwt_wcas_', '');
$group.addClass('dgwt-wcas-group-active');
$group.closest('.js-dgwt-wcas-settings-body').attr('data-dgwt-wcas-active', name)
}
// Switches option sections
$('.<?php
echo $prefix ;
?>group').hide();
var activetab = '';
if (typeof (localStorage) != 'undefined') {
maybe_active = localStorage.getItem('<?php
echo $prefix ;
?>settings-active-tab');
if (maybe_active) {
// Check if tabs exists
$('.<?php
echo $prefix ;
?>nav-tab-wrapper a:not(.js-nav-tab-minor)').each(function () {
if ($(this).attr('href') === maybe_active) {
activetab = maybe_active;
}
});
}
}
if (activetab != '' && $(activetab).length) {
$(activetab).fadeIn();
markActiveGroup($(activetab));
} else {
$('.<?php
echo $prefix ;
?>group:first').fadeIn();
markActiveGroup($('.<?php
echo $prefix ;
?>group:first'));
}
$('.<?php
echo $prefix ;
?>group .collapsed').each(function () {
$(this).find('input:checked').parent().parent().parent().nextAll().each(
function () {
if ($(this).hasClass('last')) {
$(this).removeClass('hidden');
return false;
}
$(this).filter('.hidden').removeClass('hidden');
});
});
if (activetab != '' && $(activetab + '-tab').length) {
$(activetab + '-tab').addClass('nav-tab-active');
} else {
$('.<?php
echo $prefix ;
?>nav-tab-wrapper a:first').addClass('nav-tab-active');
}
$('.<?php
echo $prefix ;
?>nav-tab-wrapper a:not(.js-nav-tab-minor)').on('click', function (evt) {
if (typeof (localStorage) != 'undefined') {
localStorage.setItem('<?php
echo $prefix ;
?>settings-active-tab', $(this).attr('href'));
}
$('.<?php
echo $prefix ;
?>nav-tab-wrapper a').removeClass('nav-tab-active');
$(this).addClass('nav-tab-active').trigger('blur');
var clicked_group = $(this).attr('href');
$('.<?php
echo $prefix ;
?>group').hide();
$(clicked_group).fadeIn();
markActiveGroup($(clicked_group));
evt.preventDefault();
});
});
</script>

View File

@@ -0,0 +1,25 @@
<?php
use DgoraWcas\Admin\Promo\Upgrade;
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
if ( DGWT_WCAS()->themeCompatibility->isCurrentThemeSupported() ):
if ( ! DGWT_WCAS()->themeCompatibility->isWhiteLabel() ):
$name = DGWT_WCAS()->themeCompatibility->getThemeName();
$parentLabel = '';
if ( DGWT_WCAS()->themeCompatibility->isChildTheme() ) {
$parentLabel = ', ' . sprintf( __( 'child theme of <b>%s</b>', 'ajax-search-for-woocommerce' ), DGWT_WCAS()->themeCompatibility->getParentThemeName() );
}
?>
<h2><?php printf( __( 'You are using the <b>%s</b> theme%s. Fantastic!', 'ajax-search-for-woocommerce' ), $name, $parentLabel ); ?></h2>
<p><?php _e( 'We support this theme so you can easily replace all default search bars.', 'ajax-search-for-woocommerce' ); ?></p>
<?php endif; ?>
<?php endif; ?>

View File

@@ -0,0 +1,34 @@
<?php
use DgoraWcas\Admin\Promo\Upgrade;
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
$utmLink = 'https://fibosearch.com/pro-vs-free/?utm_source=wp-admin&utm_medium=referral&utm_campaign=settings&utm_content=features&utm_gen=utmdc';
?>
<div class="dgwt-wcas-upgrade-s">
<h2 class="dgwt-wcas-upgrade-s__title"><?php _e( 'If users cant find the product theyre searching for, they cant buy it. Help your customers to find the right products even <span>10× faster</span>.', 'ajax-search-for-woocommerce' ); ?></h2>
<p class="dgwt-wcas-upgrade-s__subtitle">
<?php _e( 'Update now and boost your sales. You will receive a <b>30-day satisfaction guarantee</b>. A return on investment will come very quickly.', 'ajax-search-for-woocommerce' ); ?>
</p>
<ul>
<li><strong>+ <?php _e( '<b>New Ultra-Fast Search Engine</b> works very fast even with 100,000+ products ', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'Professional and fast <b>help to embed</b> or <b>replacing</b> the search bar in your theme', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'Fuzzy search', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'Search in custom fields', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'Search in attributes', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'Search in categories', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'Search in tags', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'Search by variation product SKU', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'Search in brands (WooCommerce Brands or YITH WooCommerce Brands)', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'Search for posts and pages', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'Synonyms', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'Individual customization of the search bar (simple CSS improvements)', 'ajax-search-for-woocommerce' ); ?></strong></li>
<li><strong>+ <?php _e( 'And more...', 'ajax-search-for-woocommerce' ); ?> <a target="_blank" href="<?php echo $utmLink; ?>"><?php _e( 'See a comparison of all free and premium features!', 'ajax-search-for-woocommerce' ); ?></a></strong></li>
</ul>
<a target="_blank" href="<?php echo Upgrade::getUpgradeUrl(); ?>" class="button ajax-build-index-primary"><?php _e( 'Upgrade Now!', 'ajax-search-for-woocommerce' ); ?></a>
</div>

View File

@@ -0,0 +1,25 @@
<?php
use DgoraWcas\Admin\Promo\Upgrade;
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
$utmLink = 'https://fibosearch.com/pricing/?utm_source=wp-admin&utm_medium=referral&utm_campaign=upgrade-link&utm_content=how-to-use';
$blockEditorUrl = 'https://fibosearch.com/documentation/get-started/how-to-add-fibosearch-to-your-website/#add-fibosearch-with-the-dedicated-fibosearch-block';
$blockEditorLink = '<a href="'. $blockEditorUrl .'">' . __( 'learn how to use blocks', 'ajax-search-for-woocommerce' ) . '</a>';
?>
<h4><?php _e( 'There are five easy ways to display the search bar in your theme', 'ajax-search-for-woocommerce' ); ?>: </h4>
<ol>
<li><?php printf( __( 'As a menu item - go to the %s and add the menu item “FiboSearch bar”. Done!', 'ajax-search-for-woocommerce' ), '<a href="' . admin_url( 'nav-menus.php' ) . '" target="_blank">' . __( 'Menu Screen', 'ajax-search-for-woocommerce' ) . '</a>' ) ?>
<li><?php echo __( 'As a block', 'ajax-search-for-woocommerce' ) . ' - ' . $blockEditorLink; ?></li>
<li><?php printf( __( 'Using a shortcode - %s', 'ajax-search-for-woocommerce' ), '<code>[fibosearch]</code>' ); ?></li>
<li><?php printf( __( 'As a widget - go to the %s and choose “FiboSearch bar”', 'ajax-search-for-woocommerce' ), '<a href="' . admin_url( 'widgets.php' ) . '" target="_blank">' . __( 'Widgets Screen', 'ajax-search-for-woocommerce' ) . '</a>' ) ?>
<li><?php printf( __( 'Using PHP - %s', 'ajax-search-for-woocommerce' ), '<code>&lt;?php echo do_shortcode(\'[fibosearch]\'); ?&gt;</code>' ); ?></li>
</ol>
<?php if ( ! dgoraAsfwFs()->is_premium() ): ?>
<span class="dgwt-wcas-our-devs"><?php printf( __( 'Are there any difficulties? <b>We will do it for you!</b> We offer free of charge search bar implementation for Pro users. <a target="_blank" href="%s">Become one now!</a>', 'ajax-search-for-woocommerce' ), $utmLink ); ?></span>
<?php endif; ?>

View File

@@ -0,0 +1,20 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
?>
<div class="js-dgwt-wcas-indexing-wrapper">
<div class="dgwt-wcas-indexing-header">
<span class="dgwt-wcas-indexing-header__title" style="color:#aaaaaa"><?php _e( 'The search index does not exist yet. Build it now.', 'ajax-search-for-woocommerce' ); ?></span>
<div class="dgwt-wcas-indexing-header__actions">
<a class="button dgwt-wcas-premium-only--trigger" href="#"><?php _e( 'Build index', 'ajax-search-for-woocommerce' ); ?></a>
<a href="#" class="show dgwt-wcas-premium-only--trigger dgwt-wcas-indexing-details-trigger"><?php _e( 'Show details', 'ajax-search-for-woocommerce' ); ?></a>
</div>
</div>
</div>

View File

@@ -0,0 +1,277 @@
<?php
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
$submitText = Helpers::getLabel( 'submit' );
$hasSubmit = DGWT_WCAS()->settings->getOption( 'show_submit_button' );
$labelSeeAll = Helpers::getLabel( 'show_more' );
?>
<div class="dgwt-wcas-preview js-dgwt-wcas-preview">
<div class="js-dgwt-wcas-preview-inner dgwt-wcas-preview-inner">
<div class="js-dgwt-wcas-preview-head dgwt-wcas-preview-head">
<span class="dgwt-wcas-preview-header"><?php _e( 'Preview', 'ajax-search-for-woocommerce' ); ?></span>
<span class="dgwt-wcas-preview-subheader dgwt-wcas-preview-subheader__sb"><?php _e( 'Search bar', 'ajax-search-for-woocommerce' ); ?></span>
<span class="dgwt-wcas-preview-subheader dgwt-wcas-preview-subheader__ac"><?php _e( 'Autocomplete', 'ajax-search-for-woocommerce' ); ?></span>
</div>
<div class="js-dgwt-wcas-preview-source dgwt-wcas-preview-source">
<span class="js-dgwt-wcas-preview-device-info dgwt-wcas-preview-device-info dgwt-wcas-hidden" data-device="desktop">
<span><?php _e( 'On mobile', 'ajax-search-for-woocommerce' ); ?></span>
<span><?php _e( 'On desktop', 'ajax-search-for-woocommerce' ); ?></span>
</span>
<div class="js-dgwt-wcas-search-wrapp js-dgwt-wcas-preview-bar-example dgwt-wcas-search-wrapp <?php echo Helpers::searchWrappClasses(); ?>" data-wcas-context="75c2">
<form class="dgwt-wcas-search-form" role="search" action="" method="get">
<div class="dgwt-wcas-sf-wrapp">
<?php echo Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier js-dgwt-wcas-ico-magnifier-solaris' ); ?>
<?php echo Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier js-dgwt-wcas-ico-magnifier-pirx', 'magnifier-pirx' ); ?>
<label class="screen-reader-text"><?php _e( 'Products search', 'ajax-search-for-woocommerce' ); ?></label>
<input
type="search"
class="js-dgwt-wcas-search-input dgwt-wcas-search-input"
name="<?php echo esc_attr( Helpers::getSearchInputName() ); ?>"
value="<?php echo esc_attr( get_search_query() ) ?>"
autocomplete="off"
placeholder="<?php echo esc_attr( Helpers::getLabel( 'search_placeholder' ) ); ?>"
/>
<div class="dgwt-wcas-preloader"></div>
<button type="submit" class="js-dgwt-wcas-search-submit dgwt-wcas-search-submit"><?php
echo '<span class="js-dgwt-wcas-search-submit-l">' . esc_html( $submitText ) . '</span>';
echo '<span class="js-dgwt-wcas-search-submit-m">';
echo Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier js-dgwt-wcas-ico-magnifier-solaris' );
echo Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier js-dgwt-wcas-ico-magnifier-pirx', 'magnifier-pirx' );
echo '</span>';
?>
</button>
<input type="hidden" name="post_type" value="product">
<input type="hidden" name="dgwt_wcas" value="1">
<input type="hidden" name="lang" value="en">
</div>
</form>
</div>
<span class="js-dgwt-wcas-preview-device-info dgwt-wcas-preview-device-info dgwt-wcas-hidden" data-device="mobile">
<span><?php _e( 'On mobile', 'ajax-search-for-woocommerce' ); ?></span>
<span><?php _e( 'On desktop', 'ajax-search-for-woocommerce' ); ?></span>
</span>
<div class="js-dgwt-wcas-search-wrapp dgwt-wcas-layout-icon-open js-dgwt-wcas-preview-icon-example dgwt-wcas-search-wrapp dgwt-wcas-hidden <?php echo Helpers::searchWrappClasses(); ?>" data-wcas-context="75c3">
<div class="dgwt-wcas-search-icon js-dgwt-wcas-search-icon-handler"><?php echo Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier-handler' ); ?></div>
<div class="dgwt-wcas-search-icon-arrow"></div>
<form class="dgwt-wcas-search-form" role="search" action="" method="get">
<div class="dgwt-wcas-sf-wrapp">
<?php echo Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier js-dgwt-wcas-ico-magnifier-solaris' ); ?>
<?php echo Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier js-dgwt-wcas-ico-magnifier-pirx', 'magnifier-pirx' ); ?>
<label class="screen-reader-text"><?php _e( 'Products search', 'ajax-search-for-woocommerce' ); ?></label>
<input
type="search"
class="js-dgwt-wcas-search-input dgwt-wcas-search-input"
name="<?php echo esc_attr( Helpers::getSearchInputName() ); ?>"
value="<?php echo esc_attr( get_search_query() ) ?>"
autocomplete="off"
placeholder="<?php echo esc_attr( Helpers::getLabel( 'search_placeholder' ) ); ?>"
/>
<div class="dgwt-wcas-preloader"></div>
<button type="submit" class="js-dgwt-wcas-search-submit dgwt-wcas-search-submit"><?php
echo '<span class="js-dgwt-wcas-search-submit-l">' . esc_html( $submitText ) . '</span>';
echo '<span class="js-dgwt-wcas-search-submit-m">';
echo Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier js-dgwt-wcas-ico-magnifier-solaris' );
echo Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier js-dgwt-wcas-ico-magnifier-pirx', 'magnifier-pirx' );
echo '</span>';
?>
</button>
<input type="hidden" name="post_type" value="product">
<input type="hidden" name="dgwt_wcas" value="1">
<input type="hidden" name="lang" value="en">
</div>
</form>
</div>
<div class="dgwt-wcas-autocomplete">
<div class="dgwt-wcas-suggestions-wrapp js-dgwt-wcas-suggestions-wrapp woocommerce dgwt-wcas-has-price dgwt-wcas-has-desc dgwt-wcas-has-sku" unselectable="on">
<div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-brand dgwt-wcas-suggestion-headline">
<span class="dgwt-wcas-st">
<?php echo Helpers::getLabel( 'tax_' . DGWT_WCAS()->brands->getBrandTaxonomy() . '_plu' ); ?>
</span>
</div>
<div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-brand js-dgwt-wcas-suggestion-brand">
<span class="dgwt-wcas-si">
<img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png">
</span>
<span class="dgwt-wcas-st">
<span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'tax_' . DGWT_WCAS()->brands->getBrandTaxonomy() ); ?></span>
<?php _e( 'Sample brand <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
</span>
</div>
<div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-cat dgwt-wcas-suggestion-headline">
<span class="dgwt-wcas-st">
<?php echo Helpers::getLabel( 'tax_product_cat_plu' ); ?>
</span>
</div>
<div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-cat js-dgwt-wcas-suggestion-cat">
<span class="dgwt-wcas-si">
<img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png">
</span>
<span class="dgwt-wcas-st">
<span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'tax_product_cat' ); ?></span>
<?php _e( 'Sample category <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
</span>
</div>
<div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-tag dgwt-wcas-suggestion-headline">
<span class="dgwt-wcas-st">
<?php echo Helpers::getLabel( 'tax_product_tag_plu' ); ?>
</span>
</div>
<div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-tag">
<span class="dgwt-wcas-st">
<span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'tax_product_tag' ); ?></span>
<?php _e( 'Sample tag <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
</span>
</div>
<div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-post dgwt-wcas-suggestion-headline">
<span class="dgwt-wcas-st">
<?php echo Helpers::getLabel( 'post_plu' ); ?>
</span>
</div>
<div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-post">
<span class="dgwt-wcas-st">
<span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'post' ); ?></span>
<?php _e( 'Sample post <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
</span>
</div>
<div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-page dgwt-wcas-suggestion-headline">
<span class="dgwt-wcas-st">
<?php echo Helpers::getLabel( 'page_plu' ); ?>
</span>
</div>
<div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-page">
<span class="dgwt-wcas-st">
<span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'page' ); ?></span>
<?php _e( 'Sample page <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
</span>
</div>
<div class="dgwt-wcas-suggestion js-dgwt-wcas-suggestion-headline dgwt-wcas-suggestion-headline">
<span class="dgwt-wcas-st">
<?php echo Helpers::getLabel( 'product_plu' ); ?>
</span>
</div>
<div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-product">
<span class="js-dgwt-wcas-si dgwt-wcas-si">
<img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png">
</span>
<div class="js-dgwt-wcas-content-wrapp dgwt-wcas-content-wrapp">
<span class="dgwt-wcas-st">
<span class="dgwt-wcas-st-title"><?php _e( 'Sample product <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?></span>
<span class="dgwt-wcas-sku js-dgwt-wcas-sku">(<?php echo Helpers::getLabel( 'sku_label' ); ?> 0001)</span>
<span class="dgwt-wcas-sd js-dgwt-wcas-sd"><?php _e( 'Lorem <strong>ipsum</strong> dolor sit amet, consectetur adipiscing elit. Quisque gravida lacus nec diam porttitor pharetra. Nulla facilisi. Proin pharetra imperdiet neque, non varius.', 'ajax-search-for-woocommerce' ); ?></span>
</span>
<span class="dgwt-wcas-sp js-dgwt-wcas-sp">
<?php echo wc_price( 99 ); ?>
</span>
</div>
</div>
<div class="dgwt-wcas-suggestion js-dgwt-wcas-suggestion-more dgwt-wcas-suggestion-more dgwt-wcas-suggestion-no-border-bottom" data-index="7">
<span class="dgwt-wcas-st-more"><span class="js-dgwt-wcas-st-more-label"><?php echo esc_html( $labelSeeAll ); ?></span> (73)</span>
</div>
<div class="dgwt-wcas-suggestion-nores js-dgwt-wcas-suggestion-nores dgwt-wcas-hide">
</div>
</div>
<div class="dgwt-wcas-details-wrapp js-dgwt-wcas-details-wrapp woocommerce">
<div class="dgwt-wcas-details-inner">
<div class="dgwt-wcas-product-details">
<a href="#">
<div class="dgwt-wcas-details-main-image">
<img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png"/>
</div>
</a>
<div class="dgwt-wcas-details-space">
<a class="dgwt-wcas-details-product-title" href="#">
<?php _e( 'Sample product name', 'ajax-search-for-woocommerce' ); ?>
</a>
<span class="dgwt-wcas-details-product-sku">0001</span>
<div class="dgwt-wcas-pd-price">
<?php echo wc_price( 99 ); ?>
</div>
<div class="dgwt-wcas-details-hr"></div>
<div class="dgwt-wcas-pd-desc">
<?php _e( 'Lorem <strong>ipsum</strong> dolor sit amet, consectetur adipiscing elit. Quisque gravida lacus nec diam porttitor pharetra. Nulla facilisi. Proin pharetra imperdiet neque, non varius.',
'ajax-search-for-woocommerce' ); ?>
</div>
<div class="dgwt-wcas-details-hr"></div>
<div class="dgwt-wcas-pd-addtc js-dgwt-wcas-pd-addtc">
<form class="dgwt-wcas-pd-addtc-form" action="" method="post" enctype="multipart/form-data">
<div class="quantity buttons_added">
<input type="button" value="-" class="minus button is-form">
<input type="number" class="input-text qty text" step="1" min="0" max="9999" name="js-dgwt-wcas-quantity" value="1" title="Qty" size="4" inputmode="numeric">
<input type="button" value="+" class="plus button is-form">
</div>
<p class="product woocommerce add_to_cart_inline " style="">
<a href="#" data-quantity="1" class="button product_type_simple add_to_cart_button ajax_add_to_cart" rel="nofollow"><?php _e( 'Add to cart', 'woocommerce' ); ?></a>
</p>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="dgwt-wcas-preview-elements dgwt-wcas-hidden">
<div class="js-dgwt-wcas-preview-elements-close"><?php echo Helpers::getIcon( 'close' ); ?></div>
</div>
</div>

View File

@@ -0,0 +1,47 @@
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$advSettings = DGWT_WCAS()->settings->canSeeAdvSettings();
$classes = array();
if ( dgoraAsfwFs()->is_premium() ) {
$classes[] = 'dgwt-wcas-settings-pro';
}
if ( DGWT_WCAS()->themeCompatibility->isCurrentThemeSupported() ) {
$classes[] = 'dgwt-wcas-settings-theme-supported';
}
?>
<div class="wrap dgwt-wcas-settings <?php echo implode( ' ', $classes ); ?>">
<h2 class="dgwt-wcas-settings__head">
<div class="dgwt-wcas-settings__title">
<div class="dgwt-wcas-settings__title-top">
<div class="dgwt-wcas-settings-logo-wrapper">
<img class="dgwt-wcas-settings-logo" src="<?php echo DGWT_WCAS_URL . 'assets/img/logo-30.png'; ?>"/>
<span class="dgwt-wcas-settings-logo-pro">Pro</span>
</div>
<span class="dgwt-wcas-settings__title-core"><?php _e( 'Settings', 'ajax-search-for-woocommerce' ); ?></span>
</div>
</div>
<span class="dgwt-wcas-settings__advanced js-dgwt-wcas-settings__advanced">
<span
class="js-dgwt-wcas-adv-settings-toggle woocommerce-input-toggle woocommerce-input-toggle--<?php echo $advSettings ? 'enabled' : 'disabled'; ?>"><?php _e( 'Show advanced settings',
'ajax-search-for-woocommerce' ); ?></span>
<span class="dgwt-wcas-adv-settings-label"><?php _e( 'Show advanced settings', 'ajax-search-for-woocommerce' ); ?></span>
</span>
</h2>
<?php $settings->show_navigation(); ?>
<div class="dgwt-wcas-settings-body js-dgwt-wcas-settings-body">
<?php
require DGWT_WCAS_DIR . 'partials/admin/search-preview.php';
$settings->show_forms();
?>
</div>
</div>

View File

@@ -0,0 +1,11 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<tr class="js-dgwt-wcas-autocomplete-row">
<td><?php echo $i; ?></td>
<td><?php echo esc_html( $row['phrase'] ); ?></td>
<td><?php echo esc_html( $row['qty'] ); ?></td>
</tr>

View File

@@ -0,0 +1,14 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<tr class="js-dgwt-wcas-critical-searches-row">
<td><?php echo $i; ?></td>
<td><?php echo esc_html( $row['phrase'] ); ?></td>
<td><?php echo esc_html( $row['qty'] ); ?></td>
<td>
<button class="button button-small js-dgwt-wcas-stats-critical-check"><?php _e( "Check", 'ajax-search-for-woocommerce' ); ?></button>
</td>
</tr>

View File

@@ -0,0 +1,18 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( $vars['multilingual']['is-multilingual'] ): ?>
<div class="dgwt-wcas-analytics-langs">
<h3><?php _e( 'Language', 'ajax-search-for-woocommerce' ); ?></h3>
<p class="dgwt-wcas-analytics-subtitle"><?php _e( 'Shows stats only for the selected language.', 'ajax-search-for-woocommerce' ); ?></p>
<select class="js-dgwt-wcas-analytics-lang">
<?php foreach ( $vars['multilingual']['langs'] as $lang => $label ): ?>
<option value="<?php echo esc_html( $lang ); ?>" <?php selected( $vars['multilingual']['current-lang'], $lang, true ); ?>><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>

View File

@@ -0,0 +1,11 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<tr class="js-dgwt-wcas-search-page-row">
<td><?php echo $i; ?></td>
<td><?php echo esc_html( $row['phrase'] ); ?></td>
<td><?php echo esc_html( $row['qty'] ); ?></td>
</tr>

View File

@@ -0,0 +1,260 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="dgwt-wcas-analytics-module-critical">
<h3><?php _e( 'Critical searches without result', 'ajax-search-for-woocommerce' ); ?></h3>
<?php if ( ! empty( $vars['critical-searches'] ) ): ?>
<p class="dgwt-wcas-analytics-subtitle">
<?php printf( _n( 'The FiboSearch analyzer found <b>1 critical search phrase</b>.', 'The FiboSearch analyzer found <b>%d critical search phrases</b>.', $vars['critical-searches-total'], 'ajax-search-for-woocommerce' ), $vars['critical-searches-total'] );
echo ' ';
printf( _n( 'These phrases have been typed by users over the last 1 day.', 'These phrases have been typed by users over the last %d days.', $vars['days'], 'ajax-search-for-woocommerce' ), $vars['days'] );
echo ' ';
_e( "These phrases don`t return any search results. It's time to fix it.", 'ajax-search-for-woocommerce' );
?>
</p>
<div class="dgwt-wcas-analytics-module-critical-body">
<div>
<table class="widefat fixed dgwt-wcas-analytics-table">
<thead>
<tr>
<th>#</th>
<th><?php _e( 'Phrase', 'ajax-search-for-woocommerce' ); ?></th>
<th><?php _e( 'Repetitions', 'ajax-search-for-woocommerce' ); ?></th>
<th><?php _e( "Check if it's been solved", 'ajax-search-for-woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
foreach ( $vars['critical-searches'] as $row ) {
require DGWT_WCAS_DIR . 'partials/admin/stats/critical-searches-row.php';
$i ++;
}
if ( $vars['critical-searches-more'] > 0 ): ?>
<tr class="dgwt-wcas-analytics-load-more-row">
<td colspan="4">
<div>
<span class="js-dgwt-wcas-critical-searches-load-more">
<span><?php printf( _n( 'load another %d phrase', 'load another %d phrases', $vars['critical-searches-more'], 'ajax-search-for-woocommerce' ), $vars['critical-searches-more'] ); ?></span>
<span class="dashicons dashicons-arrow-down-alt2"></span>
</span>
</div>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php
if ( $vars['critical-searches-total'] > 0 ) {
printf( '<a class="js-dgwt-wcas-analytics-export-csv" data-context="" href="#">%s</a>', __( 'Export CSV', 'ajax-search-for-woocommerce' ) ) . '<span class="dgwt-wcas-ajax-loader"></span>';
}
?>
</div>
<div class="dgwt-wcas-analytics-module-critical-info">
<h4><?php _e( 'How to fix it?', 'ajax-search-for-woocommerce' ); ?></h4>
<div>
<p><?php _e( 'There are several ways to solve these problems. Every phrase may require a different approach. See what methods you could use:', 'ajax-search-for-woocommerce' ); ?></p>
<ol>
<li><p><?php _e( "<b>Adding the phrase to the product name</b> - just add the phrase to the product name, description, SKU, custom field, tag or anything else that's in your current search scope", 'ajax-search-for-woocommerce' ); ?></p></li>
<li><p><?php printf( __( '<b>Synonyms</b> - if the phrase is an alternate version of any other words, add it as a synonym. Learn more about <a href="%s" target="_blank">the synonyms feature.', 'ajax-search-for-woocommerce' ), $vars['links']['synonyms'] ); ?></a></p></li>
<li>
<p><?php printf( __( '<b>Varied naming convention</b> - this issue occurs when users may type a phrase in several different way eg. you have SKU "CB-978-8-7290", but users might type it in a different way: "CB978 8 7290", "CB/978/8/7290", "CB97887290" and so on. To solve such problems, contact our <a href="%s" target="_blank">technical support</a>, because the solution may be different for each case.',
'ajax-search-for-woocommerce' ), $vars['links']['support'] ); ?></p></li>
</ol>
</div>
</div>
</div>
<?php else: ?>
<p class="dgwt-wcas-analytics-subtitle"><?php printf( __( "Fantastic! The FiboSearch analyzer hasn't found any critical search phrases for the last %d days.", 'ajax-search-for-woocommerce' ), $vars['days'] ); ?></p>
<?php endif; ?>
</div>
<?php if ( ! defined( 'DGWT_WCAS_ANALYTICS_ONLY_CRITICAL' ) || ! DGWT_WCAS_ANALYTICS_ONLY_CRITICAL ): ?>
<div class="dgwt-wcas-analytics-module-tiles">
<h3><?php printf( __( 'Searches stats (last %d days)', 'ajax-search-for-woocommerce' ), $vars['days'] ); ?></h3>
<div class="dgwt-wcas-analytics-tiles">
<div class="dgwt-wcas-analytics-tile">
<div class="dgwt-wcas-analytics-tile__values">
<span><?php _e( 'Total searches', 'ajax-search-for-woocommerce' ); ?></span>
<span><?php _e( 'autocomplete', 'ajax-search-for-woocommerce' ); ?></span>
<span><?php echo esc_html( $vars['autocomplete']['total-results'] ); ?></span>
</div>
<div class="dgwt-wcas-analytics-tile__icon">
<?php echo \DgoraWcas\Helpers::getIcon( 'magnifier-pirx' ) ?>
</div>
</div>
<div class="dgwt-wcas-analytics-tile">
<div class="dgwt-wcas-analytics-tile__values">
<span><?php _e( 'Total searches', 'ajax-search-for-woocommerce' ); ?></span>
<span><?php _e( 'search results page', 'ajax-search-for-woocommerce' ); ?></span>
<span><?php echo esc_html( $vars['search-page']['total-results'] ); ?></span>
</div>
<div class="dgwt-wcas-analytics-tile__icon">
<?php echo \DgoraWcas\Helpers::getIcon( 'magnifier-pirx' ) ?>
</div>
</div>
<div class="dgwt-wcas-analytics-tile">
<div class="dgwt-wcas-analytics-tile__values">
<span><?php _e( 'Searches', 'ajax-search-for-woocommerce' ); ?></span>
<span><?php _e( 'returning results', 'ajax-search-for-woocommerce' ); ?></span>
<span><?php echo esc_html( $vars['returning-results-percent'] ); ?>%</span>
</div>
<div class="dgwt-wcas-analytics-tile__icon">
<?php
if ( ! empty( $vars['returning-results-percent'] ) ) {
if ( $vars['returning-results-percent-satisfying'] ) {
echo \DgoraWcas\Helpers::getIcon( 'face-smile', 'dgwt-wcas-stats-icon-smile' );
} else {
echo \DgoraWcas\Helpers::getIcon( 'face-sad', 'dgwt-wcas-stats-icon-sad' );
}
}
?>
</div>
</div>
</div>
</div>
<br/>
<div class="dgwt-wcas-analytics-module-tables">
<div class="dgwt-wcas-analytics-module-table">
<h3><?php _e( 'Top searches - autocomplete', 'ajax-search-for-woocommerce' ); ?></h3>
<p class="dgwt-wcas-analytics-subtitle"><?php _e( 'The list of phrases with results is displayed to users as a drop down list with auto suggestions.', 'ajax-search-for-woocommerce' ); ?></p>
<table class="widefat fixed dgwt-wcas-analytics-table">
<thead>
<tr>
<th>#</th>
<th><?php _e( 'Phrase', 'ajax-search-for-woocommerce' ); ?></th>
<th><?php _e( 'Repetitions', 'ajax-search-for-woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php if ( ! empty( $vars['autocomplete']['with-results'] ) ): ?>
<?php
$i = 1;
foreach ( $vars['autocomplete']['with-results'] as $row ) {
require DGWT_WCAS_DIR . 'partials/admin/stats/ac-searches-row.php';
$i ++;
}
if ( $vars['autocomplete']['total-with-results-uniq'] > count( $vars['autocomplete']['with-results'] ) ): ?>
<tr class="dgwt-wcas-analytics-load-more-row">
<td colspan="3">
<div>
<span class="js-dgwt-wcas-autocomplete-with-results-load-more">
<span><?php _e( 'show top 100 phrases', 'ajax-search-for-woocommerce' ); ?></span>
<span class="dashicons dashicons-arrow-down-alt2"></span>
</span>
</div>
</td>
</tr>
<?php endif; ?>
<?php else: ?>
<tr>
<td colspan="3">
<?php _e( '0 searches with results', 'ajax-search-for-woocommerce' ); ?>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php
if ( ! empty( $vars['autocomplete']['with-results'] ) ) {
printf( '<a class="js-dgwt-wcas-analytics-export-csv" data-context="autocomplete" href="#">%s</a>', __( 'Export CSV', 'ajax-search-for-woocommerce' ) ) . '<span class="dgwt-wcas-ajax-loader"></span>';
}
?>
</div>
<div class="dgwt-wcas-analytics-module-table">
<h3><?php _e( 'Top searches - WooCommerce search results page', 'ajax-search-for-woocommerce' ); ?></h3>
<p class="dgwt-wcas-analytics-subtitle"><?php _e( 'Here is the list of phrases that were typed by users who followed the pattern: type the phrase into the bar → clicked “See all results” or just hit enter/return (for Mac users)', 'ajax-search-for-woocommerce' ); ?></p>
<table class="widefat fixed dgwt-wcas-analytics-table">
<thead>
<tr>
<th>#</th>
<th><?php _e( 'Phrase', 'ajax-search-for-woocommerce' ); ?></th>
<th><?php _e( 'Repetitions', 'ajax-search-for-woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php if ( ! empty( $vars['search-page']['with-results'] ) ): ?>
<?php
$i = 1;
foreach ( $vars['search-page']['with-results'] as $row ) {
require DGWT_WCAS_DIR . 'partials/admin/stats/sp-searches-row.php';
$i ++;
}
if ( $vars['search-page']['total-with-results-uniq'] > count( $vars['search-page']['with-results'] ) ): ?>
<tr class="dgwt-wcas-analytics-load-more-row">
<td colspan="3">
<div>
<span class="js-dgwt-wcas-search-page-with-results-load-more">
<span><?php _e( 'show top 100 phrases', 'ajax-search-for-woocommerce' ); ?></span>
<span class="dashicons dashicons-arrow-down-alt2"></span>
</span>
</div>
</td>
</tr>
<?php endif; ?>
<?php else: ?>
<tr>
<td colspan="3">
<?php _e( '0 searches with results', 'ajax-search-for-woocommerce' ); ?>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php
if ( ! empty( $vars['search-page']['with-results'] ) ) {
printf( '<a class="js-dgwt-wcas-analytics-export-csv" data-context="search-results-page" href="#">%s</a>', __( 'Export CSV', 'ajax-search-for-woocommerce' ) ) . '<span class="dgwt-wcas-ajax-loader"></span>';
}
?>
</div>
</div>
<?php endif; ?>
<div class="dgwt-wcas-analytics-module-reset">
<h3><?php _e( 'Maintenance', 'ajax-search-for-woocommerce' ) ?></h3>
<?php if ( defined( 'DGWT_WCAS_ANALYTICS_ONLY_CRITICAL' ) && DGWT_WCAS_ANALYTICS_ONLY_CRITICAL ): ?>
<p class="dgwt-wcas-analytics-subtitle">
<span class="dgwt-wcas-analytics-red-color"><b><?php _e( 'Warning:', 'ajax-search-for-woocommerce' ); ?></b> </span>
<?php
/* Translators: %s PHP constant name. */
printf( __( "You have defined %s constant and it's set to <code>true</code>. It means only critical searches will be stored in the database. Other modules than Critical Searches are not visible in this mode.", 'ajax-search-for-woocommerce' ), '<code>DGWT_WCAS_ANALYTICS_ONLY_CRITICAL</code>' ) ?>
</p>
<?php endif; ?>
<p class="dgwt-wcas-analytics-subtitle">
<?php
$reset = sprintf( '<a class="js-dgwt-wcas-analytics-reset" href="#">%s</a>', __( 'reset your stats', 'ajax-search-for-woocommerce' ) ) . '<span class="dgwt-wcas-ajax-loader"></span>';
$size = $vars['autocomplete']['total-results'] > 0 ? $vars['table-info']['data'] + $vars['table-info']['index'] : 0;
?>
<?php printf( _x( 'The stats older than %d days are removed from your database on a daily basis. Now you have %d records in the DB that weigh %.2fMB. You can %s now and start collecting them all over again.', 'The last placeholder is a button with text "reset your stats"', 'ajax-search-for-woocommerce' ),
$vars['days'], esc_html( $vars['autocomplete']['total-results'] ), $size, $reset ); ?>
</p>
</div>

View File

@@ -0,0 +1,32 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
?>
<div class="dgwt-wcas-troubleshooting-wrapper">
<div class="progress_bar">
<div class="pro-bar">
<small class="progress_bar_title">
<?php _e( 'Processing asynchronous tests...', 'ajax-search-for-woocommerce' ); ?>
<span class="progress_number">0%</span>
</small>
<span class="progress-bar-inner" style="background-color: #e6a51d; width: 0;">
</span>
</div>
</div>
<p class="js-dgwt-wcas-troubleshooting-no-issues"><?php _e( 'Great! We have not detected any problems that could affect the correct functioning of our plugin.', 'ajax-search-for-woocommerce' ); ?></p>
<div class="js-dgwt-wcas-troubleshooting-issues-critical"></div>
<div class="js-dgwt-wcas-troubleshooting-issues-recommended"></div>
<div>
<?php submit_button( __( 'Recheck the status', 'ajax-search-for-woocommerce' ), 'primary', 'dgwt-wcas-async-action-reset-async-tests', false, array( 'data-internal-action' => 'reset_async_tests' ) ); ?>
<span class="dgwt-wcas-ajax-loader" style="margin-top: 5px;"></span>
</div>
</div>
<script id="tmpl-dgwt-wcas-troubleshooting-issue" type="text/template">
<div class="dgwt-wcas-settings-info">
<h3 class="dgwt-wcas-troubleshooting-issue-title">{{ data.label }}</h3>
{{{ data.description }}}
<!--{{{ data.actions }}}-->
</div>
</script>

View File

@@ -0,0 +1,99 @@
<?php
/**
* The Template for displaying product variation info in Details Panel
*
* This template can be overridden by copying it to yourtheme/fibosearch/details-panel/product-variation.php.
*/
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
?>
<div class="dgwt-wcas-details-inner dgwt-wcas-details-inner-product">
<?php do_action( 'dgwt/wcas/details_panel/product_variation/container_before', $vars ); ?>
<div class="dgwt-wcas-product-details">
<?php do_action( 'dgwt/wcas/details_panel/product_variation/image_before', $vars ); ?>
<a href="<?php echo esc_url( $vars->link ); ?>" title="<?php echo esc_attr( wp_strip_all_tags( $vars->name ) ); ?>">
<div class="dgwt-wcas-details-main-image">
<img
src="<?php echo esc_url( $vars->imageSrc ); ?>"
<?php echo ( ! empty( $vars->imageSrcset ) && ! empty( $vars->imageSizes ) ) ? 'srcset="' . esc_attr( $vars->imageSrcset ) . '"' : '' ?>
<?php echo ( ! empty( $vars->imageSrcset ) && ! empty( $vars->imageSizes ) ) ? 'sizes="' . esc_attr( $vars->imageSizes ) . '"' : '' ?>
alt="<?php echo esc_attr( wp_strip_all_tags( $vars->name ) ); ?>"
>
</div>
</a>
<?php do_action( 'dgwt/wcas/details_panel/product_variation/image_after', $vars ); ?>
<div class="dgwt-wcas-details-space">
<a class="dgwt-wcas-details-product-title" href="<?php echo esc_url( $vars->link ); ?>" title="<?php echo esc_attr( wp_strip_all_tags( $vars->name ) ); ?>">
<?php echo Helpers::secureHtmlOutput( $vars->name, 'name' ); ?>
</a>
<?php if ( ! empty( $vars->sku ) ): ?>
<span class="dgwt-wcas-details-product-sku"><?php echo Helpers::secureHtmlOutput( $vars->sku, 'sku' ); ?></span>
<?php endif; ?>
<?php if ( $vars->reviewCount > 0 ): ?>
<div class="dgwt-wcas-pd-rating">
<?php echo Helpers::secureHtmlOutput( $vars->ratingHtml . ' <span class="dgwt-wcas-pd-review">(' . $vars->reviewCount . ')</span>', 'rating' ); ?>
</div>
<?php endif; ?>
<?php do_action( 'dgwt/wcas/details_panel/product_variation/price_before', $vars ); ?>
<div class="dgwt-wcas-pd-price">
<?php echo Helpers::secureHtmlOutput( $vars->priceHtml, 'price' ); ?>
</div>
<?php do_action( 'dgwt/wcas/details_panel/product_variation/price_after', $vars ); ?>
<?php if ( ! empty( $vars->attributes ) ): ?>
<div class="dgwt-wcas-details-hr"></div>
<div class="dgwt-wcas-details-attributes">
<?php foreach ( $vars->attributes as $attribute ): ?>
<div class="dgwt-wcas-details-attribute"><b><?php echo Helpers::secureHtmlOutput( $attribute['label'], 'attribute_label' ); ?></b>: <span><?php echo Helpers::secureHtmlOutput( $attribute['value'], 'attribute_value' ); ?></span></div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<div class="dgwt-wcas-details-hr"></div>
<?php if ( ! empty( $vars->stockAvailability ) ) {
echo Helpers::secureHtmlOutput( $vars->stockAvailability, 'stock_status' );
}; ?>
<?php do_action( 'dgwt/wcas/details_panel/product_variation/add_to_cart_before', $vars ); ?>
<div class="dgwt-wcas-pd-addtc js-dgwt-wcas-pd-addtc">
<form class="dgwt-wcas-pd-addtc-form" action="" method="post" enctype="multipart/form-data">
<?php
if ( $vars->showQuantity ) {
woocommerce_quantity_input( array(
'input_name' => 'js-dgwt-wcas-quantity',
), $vars->wooObject, true );
}
echo WC_Shortcodes::product_add_to_cart( array(
'id' => $vars->ID,
'show_price' => false,
'style' => '',
) );
?>
</form>
</div>
<?php do_action( 'dgwt/wcas/details_panel/product_variation/add_to_cart_after', $vars ); ?>
</div>
</div>
<?php do_action( 'dgwt/wcas/details_panel/product_variation/container_after', $vars ); ?>
</div>

View File

@@ -0,0 +1,97 @@
<?php
/**
* The Template for displaying product info in Details Panel
*
* This template can be overridden by copying it to yourtheme/fibosearch/details-panel/product.php.
*/
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
?>
<div class="dgwt-wcas-details-inner dgwt-wcas-details-inner-product">
<?php do_action( 'dgwt/wcas/details_panel/product/container_before', $vars ); ?>
<div class="dgwt-wcas-product-details">
<?php do_action( 'dgwt/wcas/details_panel/product/image_before', $vars ); ?>
<a href="<?php echo esc_url( $vars->link ); ?>" title="<?php echo esc_attr( wp_strip_all_tags( $vars->name ) ); ?>">
<div class="dgwt-wcas-details-main-image">
<img
src="<?php echo esc_url( $vars->imageSrc ); ?>"
<?php echo ( ! empty( $vars->imageSrcset ) && ! empty( $vars->imageSizes ) ) ? 'srcset="' . esc_attr( $vars->imageSrcset ) . '"' : '' ?>
<?php echo ( ! empty( $vars->imageSrcset ) && ! empty( $vars->imageSizes ) ) ? 'sizes="' . esc_attr( $vars->imageSizes ) . '"' : '' ?>
alt="<?php echo esc_attr( wp_strip_all_tags( $vars->name ) ); ?>"
>
</div>
</a>
<?php do_action( 'dgwt/wcas/details_panel/product/image_after', $vars ); ?>
<div class="dgwt-wcas-details-space">
<a class="dgwt-wcas-details-product-title" href="<?php echo esc_url( $vars->link ); ?>" title="<?php echo esc_attr( wp_strip_all_tags( $vars->name ) ); ?>">
<?php echo Helpers::secureHtmlOutput( $vars->name, 'name' ); ?>
</a>
<?php if ( ! empty( $vars->sku ) ): ?>
<span class="dgwt-wcas-details-product-sku"><?php echo Helpers::secureHtmlOutput( $vars->sku, 'sku' ); ?></span>
<?php endif; ?>
<?php if ( $vars->reviewCount > 0 ): ?>
<div class="dgwt-wcas-pd-rating">
<?php echo Helpers::secureHtmlOutput( $vars->ratingHtml . ' <span class="dgwt-wcas-pd-review">(' . $vars->reviewCount . ')</span>', 'rating' ); ?>
</div>
<?php endif; ?>
<?php do_action( 'dgwt/wcas/details_panel/product/price_before', $vars ); ?>
<div class="dgwt-wcas-pd-price">
<?php echo Helpers::secureHtmlOutput( $vars->priceHtml, 'price' ); ?>
</div>
<?php do_action( 'dgwt/wcas/details_panel/product/price_after', $vars ); ?>
<?php if ( ! empty( $vars->desc ) ): ?>
<div class="dgwt-wcas-details-hr"></div>
<div class="dgwt-wcas-details-desc">
<?php echo Helpers::secureHtmlOutput( $vars->desc, 'description' ); ?>
</div>
<?php endif; ?>
<div class="dgwt-wcas-details-hr"></div>
<?php if ( ! empty( $vars->stockAvailability ) ) {
echo Helpers::secureHtmlOutput( $vars->stockAvailability, 'stock_status' );
}; ?>
<?php do_action( 'dgwt/wcas/details_panel/product/add_to_cart_before', $vars ); ?>
<div class="dgwt-wcas-pd-addtc js-dgwt-wcas-pd-addtc">
<form class="dgwt-wcas-pd-addtc-form" action="" method="post" enctype="multipart/form-data">
<?php
if ( $vars->showQuantity ) {
woocommerce_quantity_input( array(
'input_name' => 'js-dgwt-wcas-quantity',
), $vars->wooObject, true );
}
echo WC_Shortcodes::product_add_to_cart( array(
'id' => $vars->ID,
'show_price' => false,
'style' => '',
) );
?>
</form>
</div>
<?php do_action( 'dgwt/wcas/details_panel/product/add_to_cart_after', $vars ); ?>
</div>
</div>
<?php do_action( 'dgwt/wcas/details_panel/product/container_after', $vars ); ?>
</div>

View File

@@ -0,0 +1,49 @@
<?php
/**
* The Template for displaying single product on the list of products from a given category, etc. in the Details Panel
*
* This template can be overridden by copying it to yourtheme/fibosearch/details-panel/term-product.php.
*/
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
do_action( 'dgwt/wcas/details_panel/term_products/product/container_before', $vars ); ?>
<a class="dgwt-wcas-tax-product-details" href="<?php echo esc_url( $vars->link ); ?>" title="<?php echo esc_attr( wp_strip_all_tags( $vars->name ) ); ?>">
<?php do_action( 'dgwt/wcas/details_panel/term_products/product/image_before', $vars ); ?>
<div class="dgwt-wcas-tpd-image">
<img
src="<?php echo esc_url( $vars->imageSrc ); ?>"
<?php echo ( ! empty( $vars->imageSrcset ) && ! empty( $vars->imageSizes ) ) ? 'srcset="' . esc_attr( $vars->imageSrcset ) . '"' : '' ?>
<?php echo ( ! empty( $vars->imageSrcset ) && ! empty( $vars->imageSizes ) ) ? 'sizes="' . esc_attr( $vars->imageSizes ) . '"' : '' ?>
alt="<?php echo esc_attr( wp_strip_all_tags( $vars->name ) ); ?>"
>
</div>
<?php do_action( 'dgwt/wcas/details_panel/term_products/product/image_after', $vars ); ?>
<div class="dgwt-wcas-tpd-rest">
<span class="dgwt-wcas-tpd-rest-title"><?php echo Helpers::secureHtmlOutput( $vars->name, 'name' ); ?></span>
<?php if ( $vars->reviewCount > 0 ): ?>
<div class="dgwt-wcas-pd-rating">
<?php echo Helpers::secureHtmlOutput( $vars->ratingHtml . ' <span class="dgwt-wcas-pd-review">(' . $vars->reviewCount . ')</span>', 'rating' ); ?>
</div>
<?php endif; ?>
<?php do_action( 'dgwt/wcas/details_panel/term_products/product/price_before', $vars ); ?>
<div class="dgwt-wcas-tpd-price">
<?php echo Helpers::secureHtmlOutput( $vars->priceHtml, 'price' ); ?>
</div>
<?php do_action( 'dgwt/wcas/details_panel/term_products/product/price_before', $vars ); ?>
</div>
</a>
<?php do_action( 'dgwt/wcas/details_panel/term_products/product/container_after', $vars );

View File

@@ -0,0 +1,72 @@
<?php
use DgoraWcas\Helpers;
use DgoraWcas\Multilingual;
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
$layout = Helpers::getLayoutSettings();
$hasSubmit = isset( $args['submit_btn'] ) ? $args['submit_btn'] : DGWT_WCAS()->settings->getOption( 'show_submit_button' );
$submitText = isset( $args['submit_text'] ) ? $args['submit_text'] : Helpers::getLabel( 'submit' );
$uniqueID = ++ DGWT_WCAS()->searchInstances;
$layoutType = ! empty( $args['layout'] ) ? $args['layout'] : $layout->layout;
$iconType = ! empty( $args['icon'] ) ? $args['icon'] : $layout->icon;
$isAMP = Helpers::isAMPEndpoint();
$iconColor = ! empty( $args['icon_color'] ) ? $args['icon_color'] : '';
$customParams = apply_filters( 'dgwt/wcas/search_bar/custom_params', array(), DGWT_WCAS()->searchInstances );
if ( ! empty( $args['mobile_overlay'] ) && ! empty( $args['mobile_overlay_breakpoint'] ) ) {
$customParams['mobile_overlay_breakpoint'] = absint( $args['mobile_overlay_breakpoint'] );
}
if ( ! empty( $args['layout_breakpoint'] ) && ! empty( $args['layout_breakpoint'] ) ) {
$customParams['layout_breakpoint'] = absint( $args['layout_breakpoint'] );
}
?>
<div <?php echo $isAMP ? "id='dgwt-wcas-search-wrapp{$uniqueID}'" : ''; ?> class="dgwt-wcas-search-wrapp <?php echo Helpers::searchWrappClasses( $args ); ?>">
<?php if ( in_array( $layoutType, array( 'icon', 'icon-flexible', 'icon-flexible-inv' ) ) ): ?>
<div <?php echo $isAMP ? "on='tap:dgwt-wcas-search-wrapp{$uniqueID}.toggleClass(class=\"dgwt-wcas-layout-icon-open\")'" : ""; ?> class="dgwt-wcas-search-icon js-dgwt-wcas-search-icon-handler"><?php echo Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier-handler', $iconType, $iconColor ); ?></div>
<div class="dgwt-wcas-search-icon-arrow"></div>
<?php endif; ?>
<form class="dgwt-wcas-search-form" role="search" action="<?php echo Helpers::searchFormAction(); ?>" method="get">
<div class="dgwt-wcas-sf-wrapp">
<?php echo $hasSubmit !== 'on' ? Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier', $iconType ) : ''; ?>
<label class="screen-reader-text"
for="dgwt-wcas-search-input-<?php echo $uniqueID; ?>"><?php _e( 'Products search',
'ajax-search-for-woocommerce' ); ?></label>
<input id="dgwt-wcas-search-input-<?php echo $uniqueID; ?>"
type="search"
class="dgwt-wcas-search-input"
name="<?php echo Helpers::getSearchInputName(); ?>"
value="<?php echo apply_filters( 'dgwt/wcas/search_bar/value', get_search_query(), DGWT_WCAS()->searchInstances ); ?>"
placeholder="<?php echo esc_attr( Helpers::getLabel( 'search_placeholder' ) ); ?>"
autocomplete="off"
<?php echo ! empty( $customParams ) ? ' data-custom-params="' . htmlspecialchars( json_encode( (object) $customParams ) ) . '"' : ''; ?>
/>
<div class="dgwt-wcas-preloader"></div>
<div class="dgwt-wcas-voice-search"></div>
<?php if ( $hasSubmit === 'on' ): ?>
<button type="submit"
aria-label="<?php echo empty( $submitText ) ? __( 'Search', 'ajax-search-for-woocommerce' ) : esc_attr( $submitText ); ?>"
class="dgwt-wcas-search-submit"><?php echo empty( $submitText ) ? Helpers::getMagnifierIco( 'dgwt-wcas-ico-magnifier', $iconType ) : esc_html( $submitText ); ?></button>
<?php endif; ?>
<input type="hidden" name="post_type" value="product"/>
<input type="hidden" name="dgwt_wcas" value="1"/>
<?php if ( Multilingual::isWPML() ): ?>
<input type="hidden" name="lang" value="<?php echo esc_attr( Multilingual::getCurrentLanguage() ); ?>"/>
<?php endif ?>
<?php do_action( 'dgwt/wcas/form' ); ?>
</div>
</form>
</div>

View File

@@ -0,0 +1,57 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
// Astra cut our search using wp_kses(), so we need overwrite whole function, but for 4.0.0.
if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '4.1.0' ) < 0 ) {
if ( ! function_exists( 'astra_addon_get_search_form' ) ) {
function astra_addon_get_search_form( $echo = true ) {
$result = apply_filters( 'astra_get_search_form', '' );
if ( $echo ) {
echo $result;
} else {
return $result;
}
}
}
}
// From version 4.1.0 Astra has a filters that can be used to indicate allowed tags and attributes in the search form.
if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '4.1.0' ) >= 0 ) {
add_filter( 'astra_addon_form_post_kses_protocols', function ( $args ) {
$args['input']['id'] = array();
$args['input']['style'] = array();
$args['label'] = array(
'class' => array(),
'id' => array(),
'style' => array(),
'data-*' => true,
'align' => array(),
'for' => array(),
);
$args['button'] = array(
'class' => array(),
'aria-label' => array(),
'type' => array(),
);
return $args;
} );
add_filter( 'safe_style_css', function ( $styles ) {
$styles[] = 'display';
return $styles;
} );
}
$astra_settings = get_option( 'astra-settings' );
$is_header_footer_builder = isset( $astra_settings['is-header-footer-builder'] ) ? (bool) $astra_settings['is-header-footer-builder'] : true;
if ( $is_header_footer_builder ) {
require_once 'astra/builder.php';
} else {
require_once 'astra/legacy.php';
}

View File

@@ -0,0 +1,207 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
function dgwt_wcas_astra_header_break_point() {
$header_break_point = 921;
if ( function_exists( 'astra_header_break_point' ) ) {
$header_break_point = astra_header_break_point();
}
return $header_break_point;
}
function dgwt_wcas_astra_search_box_type() {
$search_box_type = '';
if ( function_exists( 'astra_get_option' ) ) {
$search_box_type = astra_get_option( 'header-search-box-type' );
}
return $search_box_type;
}
// Force mobile overlay breakpoint.
add_filter( 'dgwt/wcas/settings/load_value/key=mobile_overlay_breakpoint', function () {
return dgwt_wcas_astra_header_break_point();
} );
// Force mobile breakpoint.
add_filter( 'dgwt/wcas/settings/load_value/key=mobile_breakpoint', function () {
return dgwt_wcas_astra_header_break_point();
} );
function dgwt_wcas_astra_search_form() {
$header_break_point = dgwt_wcas_astra_header_break_point();
$form = '<div class="search-form"><span class="search-field"></span>';
$form .= do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="' . $header_break_point . '"]' );
$form .= '</div>';
return $form;
}
// Overwrite search in Slide Search and Search Box mode
if ( ! function_exists( 'astra_get_search_form' ) ) {
function astra_get_search_form( $echo = true ) {
$form = dgwt_wcas_astra_search_form();
if ( $echo ) {
echo $form;
} else {
return $form;
}
}
}
add_filter( 'astra_get_search_form', function ( $form ) {
return dgwt_wcas_astra_search_form();
} );
// Template for Header Cover
add_filter( 'astra_addon_get_template', function ( $located, $template_name, $args, $template_path, $default_path ) {
if ( $template_name === 'advanced-search/template/header-cover.php' ) {
$located = __DIR__ . '/template/header-cover.php';
}
return $located;
}, 100, 5 );
add_filter( 'dgwt/wcas/form/html', function ( $html ) {
// We're removing the 'woocommerce' class on these pages because it makes it impossible to update the cart contents.
if ( is_checkout() || is_cart() ) {
return preg_replace( '/class="([0-9a-zA-Z-\s]+)woocommerce([0-9a-zA-Z-\s]+)"/m', "class=\"$1$2\"", $html );
}
return $html;
} );
add_action( 'wp_footer', function () {
$header_break_point = dgwt_wcas_astra_header_break_point();
$search_box_type = dgwt_wcas_astra_search_box_type();
// Full Screen Search
if ( $search_box_type === 'full-screen' ) {
echo '<div id="wcas-search-instance" style="display: block;"><div class="search-form"><input class="search-field" type="text" style="display:none;">' . do_shortcode( '[fibosearch layout="classic" mobile_overlay="1" mobile_breakpoint="' . $header_break_point . '" ]' ) . '</div></div>';
}
?>
<script>
(function ($) {
<?php if ( $search_box_type === 'full-screen' ) { ?>
// Replace search form (Full Screen Search)
$(window).on('load', function () {
var wcasSearch = $('#wcas-search-instance > div');
var themeSearchFull = $('.ast-search-box.full-screen .ast-container');
if (themeSearchFull.eq(0)) {
themeSearchFull.find('.search-form').remove();
themeSearchFull.append(wcasSearch)
}
$('#wcas-search-instance').remove();
});
<?php } ?>
// Autofocus
$('.astra-search-icon').on('click', function () {
setTimeout(function () {
// Slide Search, Search Box
$input = $('.ast-search-menu-icon .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
// Header Cover Search
var $inputHeaderCover = $('.ast-search-box.header-cover .dgwt-wcas-search-input');
if ($inputHeaderCover.length > 0) {
$inputHeaderCover.trigger('focus');
}
// Full Screen Search
var $inputFullScreen = $('.ast-search-box.full-screen .dgwt-wcas-search-input');
if ($inputFullScreen.length > 0) {
$inputFullScreen.trigger('focus');
}
}, 100);
if ($(window).width() <= <?php echo $header_break_point ?>) {
// Slide Search, Search Box
var $mobile = $('.ast-search-menu-icon .js-dgwt-wcas-enable-mobile-form');
if ($mobile.length > 0) {
$mobile.trigger('click');
}
// Header Cover Search / Full Screen Search
var $mobile2 = $('.ast-search-box.header-cover .js-dgwt-wcas-enable-mobile-form, .ast-search-box.full-screen .js-dgwt-wcas-enable-mobile-form');
if ($mobile2.length > 0) {
$mobile2.trigger('click');
}
}
});
// Header Cover / Full Screen Search - close cover when in mobile mode
$(document).on('click', '.js-dgwt-wcas-om-return', function (e) {
$('.ast-search-box.header-cover #close, .ast-search-box.full-screen #close').trigger('click');
});
}(jQuery));
</script>
<?php
} );
add_filter( 'wp_head', function () {
?>
<style>
/* Slide Search */
.ast-dropdown-active .search-form {
padding-left: 0 !important;
}
.ast-dropdown-active .ast-search-icon {
visibility: hidden;
}
.ast-search-menu-icon .search-form {
padding: 0;
}
.ast-search-menu-icon .search-field {
display: none;
}
.ast-search-menu-icon .search-form {
background-color: transparent !important;
border: 0;
}
/* Search Box */
.site-header .ast-inline-search.ast-search-menu-icon .search-form {
padding-right: 0;
}
/* Full Screen Search */
.ast-search-box.full-screen .ast-search-wrapper {
top: 25%;
transform: translate(-50%, -25%);
}
/* Header Cover */
.ast-search-box.header-cover .search-text-wrap {
width: 50%;
vertical-align: middle;
margin-left: calc(25% - 10px);
}
.ast-search-box.header-cover .close {
margin-top: -5px;
}
/* Autosuggestion results */
.dgwt-wcas-suggestion {
transition: none;
}
/* Details panel */
.dgwt-wcas-details-wrapp .woocommerce a.added_to_cart {
display: block;
}
</style>
<?php
} );

View File

@@ -0,0 +1,187 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
function dgwt_wcas_astra_header_break_point() {
$header_break_point = 921;
if ( function_exists( 'astra_header_break_point' ) ) {
$header_break_point = astra_header_break_point();
}
return $header_break_point;
}
function dgwt_wcas_astra_search_box() {
$search_box = '';
if ( function_exists( 'astra_get_option' ) ) {
$search_box = astra_get_option( 'header-main-rt-section' );
}
return $search_box;
}
function dgwt_wcas_astra_search_box_style() {
$search_box_style = '';
if ( function_exists( 'astra_get_option' ) ) {
$search_box_style = astra_get_option( 'header-main-rt-section-search-box-type' );
}
return $search_box_style;
}
// Force mobile overlay breakpoint.
add_filter( 'dgwt/wcas/settings/load_value/key=mobile_overlay_breakpoint', function () {
return dgwt_wcas_astra_header_break_point();
} );
// Force mobile breakpoint.
add_filter( 'dgwt/wcas/settings/load_value/key=mobile_breakpoint', function () {
return dgwt_wcas_astra_header_break_point();
} );
// Overwrite search in Slide Search and Search Box mode
add_filter( 'astra_get_search_form', function ( $form ) {
$header_break_point = dgwt_wcas_astra_header_break_point();
$form = '<div class="search-form"><span class="search-field"></span>';
$form .= do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="' . $header_break_point . '"]' );
$form .= '</div>';
return $form;
} );
add_filter( 'dgwt/wcas/form/html', function ( $html ) {
// We're removing the 'woocommerce' class on these pages because it makes it impossible to update the cart contents.
if ( is_checkout() || is_cart() ) {
return preg_replace( '/class="([0-9a-zA-Z-\s]+)woocommerce([0-9a-zA-Z-\s]+)"/m', "class=\"$1$2\"", $html );
}
return $html;
} );
add_action( 'wp_footer', function () {
$header_break_point = dgwt_wcas_astra_header_break_point();
$search_box = dgwt_wcas_astra_search_box();
$search_box_style = dgwt_wcas_astra_search_box_style();
// Header Cover Search
if ( $search_box === 'search' && $search_box_style === 'header-cover' ) {
echo '<div id="wcas-search-instance" style="display: block;"><div class="search-form"><div class="search-text-wrap"><input class="search-field" type="text" style="display:none;">' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="' . $header_break_point . '" ]' ) . '</div><span id="close" class="close"></span></div></div>';
}
// Full Screen Search
if ( $search_box === 'search' && $search_box_style === 'full-screen' ) {
echo '<div id="wcas-search-instance" style="display: block;"><div class="search-form"><input class="search-field" type="text" style="display:none;">' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="' . $header_break_point . '" ]' ) . '</div></div>';
}
?>
<script>
(function ($) {
<?php if ( $search_box === 'search' && $search_box_style === 'header-cover' ) { ?>
// Replace search form (Header Cover Search)
$(window).on('load', function () {
var wcasSearch = $('#wcas-search-instance > div');
var themeSearch = $('.ast-search-box.header-cover .ast-container');
if (themeSearch.eq(0)) {
themeSearch.html(wcasSearch);
}
$('#wcas-search-instance').remove();
});
<?php } ?>
<?php if ( $search_box === 'search' && $search_box_style === 'full-screen' ) { ?>
// Replace search form (Full Screen Search)
$(window).on('load', function () {
var wcasSearch = $('#wcas-search-instance > div');
var themeSearchFull = $('.ast-search-box.full-screen .ast-container');
if (themeSearchFull.eq(0)) {
themeSearchFull.find('.search-form').remove();
themeSearchFull.append(wcasSearch)
}
$('#wcas-search-instance').remove();
});
<?php } ?>
// Autofocus
$('.astra-search-icon').on('click', function () {
setTimeout(function () {
// Slide Search, Search Box
var $input = $('.search-custom-menu-item .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
// Header Cover Search
var $inputHeaderCover = $('.ast-search-box.header-cover .dgwt-wcas-search-input');
if ($inputHeaderCover.length > 0) {
$inputHeaderCover.trigger('focus');
}
// Full Screen Search
var $inputFullScreen = $('.ast-search-box.full-screen .dgwt-wcas-search-input');
if ($inputFullScreen.length > 0) {
$inputFullScreen.trigger('focus');
}
}, 100);
if ($(window).width() <= <?php echo $header_break_point ?>) {
// Slide Search, Search Box
var $mobile = $('.search-custom-menu-item .js-dgwt-wcas-enable-mobile-form');
if ($mobile.length > 0) {
$mobile.trigger('click');
}
// Header Cover Search / Full Screen Search
var $mobile2 = $('.ast-search-box.header-cover .js-dgwt-wcas-enable-mobile-form, .ast-search-box.full-screen .js-dgwt-wcas-enable-mobile-form');
if ($mobile2.length > 0) {
$mobile2.trigger('click');
}
}
});
// Header Cover / Full Screen Search - close cover when in mobile mode
$(document).on('click', '.js-dgwt-wcas-om-return', function (e) {
$('.ast-search-box.header-cover #close, .ast-search-box.full-screen #close').trigger('click');
});
}(jQuery));
</script>
<?php
} );
add_filter( 'wp_head', function () {
?>
<style>
/* Slide Search */
.ast-dropdown-active .search-form {
padding-left: 0 !important;
}
.ast-dropdown-active .ast-search-icon {
visibility: hidden;
}
.ast-search-menu-icon .search-form {
padding: 0;
}
.search-custom-menu-item .search-field {
display: none;
}
.search-custom-menu-item .search-form {
background-color: transparent !important;
border: 0;
}
/* Search Box */
.site-header .ast-inline-search.ast-search-menu-icon .search-form {
padding-right: 0;
}
/* Full Screen Search */
.ast-search-box.full-screen .ast-search-wrapper {
top: 25%;
transform: translate(-50%, -25%);
}
</style>
<?php
} );

View File

@@ -0,0 +1,25 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
/**
* Advanced Search - Header Cover Template
*/
$header_break_point = dgwt_wcas_astra_header_break_point();
?>
<div class="ast-search-box header-cover" id="ast-search-form">
<div class="ast-search-wrapper">
<div class="ast-container">
<div class="search-form">
<div class="search-text-wrap">
<input class="search-field" type="text" style="display:none;">
<?php echo do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="' . $header_break_point . '" ]' ); ?>
</div>
<span id="close" class="close"><?php Astra_Icons::get_icons( 'close', true ); ?></span>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,248 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_filter( 'get_search_form', function ( $form ) {
return do_shortcode( '[wcas-search-form]' );
}, 100 );
add_action( 'init', function () {
remove_filter( 'wp_nav_menu_items', 'avada_add_search_to_main_nav', 20, 2 );
// Add search to the main navigation.
add_filter( 'wp_nav_menu_items', function ( $items, $args ) {
// Disable woo cart on ubermenu navigations.
$ubermenu = ( function_exists( 'ubermenu_get_menu_instance_by_theme_location' ) && ubermenu_get_menu_instance_by_theme_location( $args->theme_location ) );
if ( 'v6' !== Avada()->settings->get( 'header_layout' ) && false === $ubermenu ) {
if ( 'main_navigation' === $args->theme_location || 'sticky_navigation' === $args->theme_location ) {
if ( Avada()->settings->get( 'main_nav_search_icon' ) ) {
$items .= '<li class="fusion-custom-menu-item fusion-main-menu-search">';
$items .= do_shortcode( '[wcas-search-form layout="icon"]' );
$items .= '</li>';
}
}
}
return $items;
}, 20, 2 );
} );
// Fusion search
add_filter( 'search_form_after_fields', function ( $args ) {
add_action( 'wp_footer', function () {
echo '<div class="dgwt-wcas-avada-fus-search-replace-wrapper">';
echo do_shortcode( '[wcas-search-form]' );
echo '</div>';
} );
$args['after_fields'] = '<div class="dgwt-wcas-avada-fus-search-replace"></div>';
return $args;
} );
add_filter( 'dgwt/wcas/icon', function ( $svg, $name, $class, $color ) {
if ( $name === 'magnifier-thin' ) {
ob_start();
?>
<svg version="1.1" class="<?php echo $class; ?>" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 30 32">
<path
d="M20.571 15.143q0-3.304-2.348-5.652t-5.652-2.348-5.652 2.348-2.348 5.652 2.348 5.652 5.652 2.348 5.652-2.348 2.348-5.652zM29.714 30q0 0.929-0.679 1.607t-1.607 0.679q-0.964 0-1.607-0.679l-6.125-6.107q-3.196 2.214-7.125 2.214-2.554 0-4.884-0.991t-4.018-2.679-2.679-4.018-0.991-4.884 0.991-4.884 2.679-4.018 4.018-2.679 4.884-0.991 4.884 0.991 4.018 2.679 2.679 4.018 0.991 4.884q0 3.929-2.214 7.125l6.125 6.125q0.661 0.661 0.661 1.607z"></path>
</svg>
<?php
$svg = ob_get_clean();
}
return $svg;
}, 10, 4 );
add_action( 'wp_head', function () {
?>
<style>
.fusion-secondary-menu-search {
width: 500px;
}
.fusion-flyout-search .dgwt-wcas-search-wrapp {
margin-top: 21px;
}
.dgwt-wcas-details-wrapp .quantity {
width: auto;
}
.fusion-main-menu-search .dgwt-wcas-search-wrapp {
margin-top: calc((var(--nav_height) / 2) - (var(--nav_typography-font-size) / 2));
}
.fusion-header-v7 .fusion-main-menu-search .dgwt-wcas-search-wrapp {
margin-top: 0;
}
.dgwt-wcas-ico-magnifier, .dgwt-wcas-ico-magnifier-handler {
max-width: none;
fill: var(--nav_typography-color);
max-height: var(--nav_typography-font-size);
}
.dgwt-wcas-ico-magnifier:hover, .dgwt-wcas-ico-magnifier-handler:hover {
fill: var(--menu_hover_first_color);
}
.dgwt-wcas-sf-wrapp .dgwt-wcas-ico-magnifier:hover {
fill: currentColor;
opacity: 0.7;
}
.fusion-is-sticky .dgwt-wcas-ico-magnifier, .fusion-is-sticky .dgwt-wcas-ico-magnifier-handler {
fill: var(--header_sticky_menu_color);
}
.fusion-is-sticky .dgwt-wcas-ico-magnifier:hover, .fusion-is-sticky .dgwt-wcas-ico-magnifier-handler:hover {
fill: var(--menu_hover_first_color);
}
.fusion-header-v4 .fusion-main-menu {
overflow: visible;
}
.fusion-search-form {
display: none;
}
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 {
top: 100%;
}
.fusion-header-v4 .fusion-main-menu .dgwt-wcas-layout-icon-open .dgwt-wcas-search-icon-arrow {
top: calc(100% + -4px);
}
@media (max-width: 1100px) {
.fusion-flyout-search .dgwt-wcas-search-wrapp {
margin-top: 73px;
max-width: 100%;
padding: 0 30px 0 30px;
}
}
@media (max-width: 800px) {
.fusion-logo .dgwt-wcas-search-wrapp {
display: none;
}
}
</style>
<?php
} );
add_action( 'wp_footer', function () {
?>
<script>
(function ($) {
function dgwtWcasAvadaGetActiveInstance() {
var $el = $('.dgwt-wcas-search-wrapp.dgwt-wcas-active'),
instance;
if ($el.length > 0) {
$el.each(function () {
var $input = $(this).find('.dgwt-wcas-search-input');
if (typeof $input.data('autocomplete') == 'object') {
instance = $input.data('autocomplete');
return false;
}
});
}
return instance;
}
$(document).ready(function () {
// Header 6
if ($('.fusion-header-v6').length) {
$('.fusion-header-v6 .fusion-icon-search').on('click', function () {
var $input = $('.fusion-flyout-search .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
});
$('.fusion-header-v6 .fusion-icon-search').on('click', function () {
var $input = $('.fusion-flyout-search .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
});
$('.fusion-icon-search').on('click', function () {
if ($('.fusion-header-v6').hasClass('fusion-flyout-search-active')) {
var instance = dgwtWcasAvadaGetActiveInstance();
if (typeof instance == 'object') {
instance.suggestions = [];
instance.hide();
instance.el.val('');
}
}
});
}
// Fusion search
var $fusionSearchForm = $('.fusion-search-form');
if ($fusionSearchForm.length) {
$(this).remove();
}
var $placeholders = $('.dgwt-wcas-avada-fus-search-replace')
var $barsToReplace = $('.dgwt-wcas-avada-fus-search-replace-wrapper .dgwt-wcas-search-wrapp')
if ($placeholders.length && $barsToReplace.length) {
$placeholders.each(function (i) {
var $parentForm = $(this).closest('form');
$parentForm.after($(this));
$parentForm.remove();
});
$placeholders.each(function (i) {
$(this).append($($barsToReplace[i]));
});
}
// Remove unused search forms
$('.dgwt-wcas-avada-fus-search-replace-wrapper').remove();
$(document).on('click', '.fusion-icon-search', function () {
var $handler = $('.fusion-mobile-menu-search .js-dgwt-wcas-enable-mobile-form');
var $handler2 = $('.fusion-flyout-search .js-dgwt-wcas-enable-mobile-form');
if ($handler.length) {
setTimeout(function () {
$('.fusion-mobile-menu-search').hide();
}, 100);
$handler[0].click();
}
if ($handler2.length) {
$handler2[0].click();
}
});
$(document).on('click', '.js-dgwt-wcas-om-return', function () {
var $activeFlyout = $('.fusion-flyout-active');
if ($activeFlyout) {
$activeFlyout.removeClass('fusion-flyout-search-active');
$activeFlyout.removeClass('fusion-flyout-active');
}
});
});
}(jQuery));
</script>
<?php
}, 1000 );

View File

@@ -0,0 +1,62 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_footer', function () {
echo '<div id="wcas-theme-search" style="display: block;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
} );
add_action( 'wp_footer', function () {
?>
<script>
var wcasThemeSearch = document.querySelector('#bigcart-search-box .woocommerce-product-search');
if (wcasThemeSearch !== null) {
wcasThemeSearch.replaceWith(document.querySelector('#wcas-theme-search > div'));
}
document.querySelector('#wcas-theme-search').remove();
(function ($) {
$(window).on('load', function () {
$('a.product-search').on('click', function (e) {
$('#bigcart-search-box').addClass('dgwt-wcas');
setTimeout(function () {
var $input = $('#bigcart-search-box .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
}, 500);
if ($(window).width() <= 782) {
var $handler = $('#bigcart-search-box .js-dgwt-wcas-enable-mobile-form');
if ($handler.length) {
$handler[0].click();
}
}
});
});
}(jQuery));
</script>
<style>
.search-box .dgwt-wcas-search-wrapp {
position: absolute;
width: 50%;
top: 30%;
left: 50%;
opacity: 1;
transform: translate(-50%, -50%);
}
.search-box form {
position: relative;
padding: 0;
width: auto;
top: 0;
left: 0;
opacity: 1 !important;
transform: none !important;
}
</style>
<?php
} );

View File

@@ -0,0 +1,56 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_footer', function () {
echo '<div id="wcas-block-shop-search" style="display: block;">' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="1200" ]' ) . '</div>';
?>
<script>
(function ($) {
//Autofocus
if($(window).width() >= 1200) {
$('.show-search').on('click', function () {
setTimeout(function () {
var $input = $('.search-wrapper .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
}, 1300)
});
}
$(window).on('load', function () {
var body = $('body');
var blockShopSearch = $('.search-wrapper');
var search = $('#wcas-block-shop-search > div');
if (!blockShopSearch.eq(0)) {
return;
}
blockShopSearch.html(search);
// Open overlay automatically
$('#masthead .mobile-search-toggle').on('click', function () {
if ($(window).width() < 1200) {
var $handler = $('#masthead .search-wrapper .js-dgwt-wcas-enable-mobile-form');
if ($handler.length) {
$handler[0].click();
}
setTimeout(function () {
var $closeBtn = $('#masthead .close-search');
if ($closeBtn.length) {
$closeBtn[0].click();
}
}, 1000)
}
});
});
}(jQuery));
</script>
<?php
} );

View File

@@ -0,0 +1,34 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_filter( 'blocksy:header:item-view-path:search', function ( $path ) {
return DGWT_WCAS_DIR . 'partials/themes/blocksy/search.php';
} );
add_filter( 'get_search_form', function ( $form, $args ) {
// Used on 404 page.
return do_shortcode( '[fibosearch layout="classic"]' );
}, 10, 2 );
add_action( 'wp_head', function () {
?>
<style>
.dgwt-wcas-ico-magnifier, .dgwt-wcas-ico-magnifier-handler {
max-width: none;
fill: var(--icon-color, var(--color));
max-height: var(--icon-size, 15px);
}
.dgwt-wcas-ico-magnifier:hover, .dgwt-wcas-ico-magnifier-handler:hover {
fill: var(--icon-hover-color, var(--paletteColor2));
}
.dgwt-wcas-suggestion {
transition: none;
}
</style>
<?php
} );

View File

@@ -0,0 +1,10 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
echo '<div data-id="search">'; // This attribute is needed for selectors for search icon colors to work.
echo do_shortcode( '[fibosearch layout="icon"]' );
echo '</div>';

View File

@@ -0,0 +1,69 @@
<?php
use DgoraWcas\Helpers;
// Exit if accessed directly.
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
global $dgwtWcasBricksStyles;
$dgwtWcasBricksStyles = '';
/**
* Support for Bricks custom pagination parameter.
*/
add_action( 'pre_get_posts', function ($query) {
if ( ! Helpers::isSearchQuery( $query ) ) {
return;
}
if ( ! empty( $_GET['product-page'] ) && intval($_GET['product-page']) > 0 ) {
$query->set('paged', intval($_GET['product-page']));
}
} , 900000 );
/**
* This filter should return true or false depending on whether the Element is to be displayed,
* but we use it to override the search Element. This is not entirely the correct way to use a filter,
* but we have no other way to override the Element's rendering function.
*/
add_filter( 'bricks/element/render', function ( $render_element, $element ) {
global $dgwtWcasBricksStyles;
if ( ! $render_element ) {
return $render_element;
}
if ( ! isset( $element->block ) || $element->block !== 'core/search' ) {
return $render_element;
}
if ( isset( $element->settings['searchType'] ) && $element->settings['searchType'] === 'overlay' ) {
echo do_shortcode( '[fibosearch layout="icon"]' );
if ( ! empty( $element->settings['iconTypography']['color']['hex'] ) ) {
ob_start();
?>
<style>
.dgwt-wcas-ico-magnifier, .dgwt-wcas-ico-magnifier-handler {
fill: <?php echo esc_attr( $element->settings['iconTypography']['color']['hex'] ) ?>;
}
</style>
<?php
$dgwtWcasBricksStyles .= ob_get_clean();
}
} else {
echo do_shortcode( '[fibosearch]' );
}
return false;
}, 10, 2 );
add_action( 'wp_footer', function () {
global $dgwtWcasBricksStyles;
if ( ! empty( $dgwtWcasBricksStyles ) ) {
echo $dgwtWcasBricksStyles;
}
} );

View File

@@ -0,0 +1,114 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_head', function () {
?>
<style>
.page_header .qode_search_form .dgwt-wcas-search-wrapp {
max-width: 100%;
margin-top: 5px;
}
.page_header .qode_search_form_2 .dgwt-wcas-search-wrapp {
max-width: 100%;
margin-top: 30px;
}
.page_header .qode_search_form_2 .dgwt-wcas-search-wrapp input[type=search],
.page_header .qode_search_form_3 .dgwt-wcas-search-wrapp input[type=search] {
text-transform: none;
}
.page_header .qode_search_form_2:not(.animated) .dgwt-wcas-preloader {
display: none;
}
.page_header .qode_search_form_3 .dgwt-wcas-search-wrapp {
max-width: 100%;
}
</style>
<?php
} );
add_action( 'wp_footer', function () {
if ( ! function_exists( 'bridge_qode_options' ) ) {
return;
}
if ( bridge_qode_options()->getOptionValue( 'enable_search' ) !== 'yes' ) {
return;
}
$search_type = bridge_qode_options()->getOptionValue( 'search_type' );
if ( $search_type === 'search_slides_from_window_top' ) { ?>
<div id="wcas-bridge-search" style="display: block;">
<div class="qode_search_form">
<div class="container">
<div class="container_inner clearfix">
<?php echo do_shortcode( '[wcas-search-form]' ); ?>
</div>
</div>
</div>
</div>
<script>
var bridgeSearch = document.querySelector('#searchform');
if (bridgeSearch !== null) {
bridgeSearch.replaceWith(document.querySelector('#wcas-bridge-search > div'));
}
</script>
<?php } else if ( $search_type === 'search_slides_from_header_bottom' ) { ?>
<div id="wcas-bridge-search" style="display: block;">
<div class="qode_search_form_2">
<div class="container">
<div class="container_inner clearfix">
<div class="form_holder_outer">
<?php echo do_shortcode( '[wcas-search-form]' ); ?>
</div>
</div>
</div>
</div>
</div>
<script>
var bridgeSearch = document.querySelector('.page_header .qode_search_form_2');
if (bridgeSearch !== null) {
bridgeSearch.replaceWith(document.querySelector('#wcas-bridge-search > div'));
}
</script>
<?php } else if ( $search_type === 'search_covers_header' ) { ?>
<div id="wcas-bridge-search" style="display: block;">
<div class="qode_search_form_3">
<div class="container">
<div class="container_inner clearfix">
<div class="form_holder_outer">
<div class="form_holder">
<?php echo do_shortcode( '[wcas-search-form]' ); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var bridgeSearch = document.querySelector('.page_header .qode_search_form_3');
if (bridgeSearch !== null) {
bridgeSearch.replaceWith(document.querySelector('#wcas-bridge-search > div'));
}
</script>
<?php } else if ( $search_type === 'fullscreen_search' ) { ?>
<div id="wcas-bridge-search" style="display: block;">
<div class="fullscreen_search_form">
<div class="form_holder">
<?php echo do_shortcode( '[wcas-search-form]' ); ?>
</div>
</div>
</div>
<script>
var bridgeSearch = document.querySelector('.fullscreen_search_form');
if (bridgeSearch !== null) {
bridgeSearch.replaceWith(document.querySelector('#wcas-bridge-search > div'));
}
</script>
<?php }
} );

View File

@@ -0,0 +1,50 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_footer', function () {
echo '<div id="wcas-theme-search" style="display: block;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
} );
add_action( 'wp_footer', function () {
?>
<script>
var wcasThemeSearch = document.querySelector('#search_popup .search_form-inner');
if (wcasThemeSearch !== null) {
wcasThemeSearch.replaceWith(document.querySelector('#wcas-theme-search > div'));
}
document.querySelector('#wcas-theme-search').remove();
(function ($) {
$(document).on('click', '.search-button', function (e) {
setTimeout(function () {
var $input = $('#search_popup .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
}, 500);
});
$(document).on('click', '.mobile-search-trigger', function (e) {
var $handler = $('#search_popup .js-dgwt-wcas-enable-mobile-form');
if ($handler.length) {
$handler[0].click();
}
setTimeout(function () {
var $mobileSearchWrap = $('.mobile-search-wrap');
if ($mobileSearchWrap.length) {
$mobileSearchWrap.removeClass('active');
}
}, 500);
});
}(jQuery));
</script>
<style>
.search_form-wrap {
margin-top: -30%;
}
</style>
<?php
}, 100 );

View File

@@ -0,0 +1,115 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_footer', function () {
if ( ! class_exists( 'Dfd_Theme_Helpers' ) || ! method_exists( 'Dfd_Theme_Helpers', 'getHeaderStyleOption' ) ) {
return;
}
$header_style_option = Dfd_Theme_Helpers::getHeaderStyleOption();
if ( $header_style_option !== '10' ) {
return;
}
echo '<div id="wcas-search-instance" style="display: block;"><div>' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="500" ]' ) . '<i class="header-search-switcher close-search active"></i></div></div>';
echo '<div id="wcas-search-instance-mobile" style="display: block;">' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="500" ]' ) . '</div>';
?>
<script>
(function ($) {
// Autofocus
if ($(window).width() >= 500) {
// Wait until theme unbind clicks on this element
setTimeout(function () {
$('.header-search-switcher').on('click', function () {
setTimeout(function () {
var $input = $('.form-search-section .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
}, 800)
});
}, 500);
}
// Replace search forms
$(window).on('load', function () {
var themeSearch = $('.form-search-section .row');
var wcasSearch = $('#wcas-search-instance > div');
if (themeSearch.eq(0)) {
themeSearch.html(wcasSearch);
}
$('#wcas-search-instance').remove();
var themeSearchMobile = $('.dfd-search-mobile-show');
var wcasSearchMobile = $('#wcas-search-instance-mobile > div');
if (themeSearchMobile.eq(0)) {
themeSearchMobile.html(wcasSearchMobile);
}
$('#wcas-search-instance-mobile').remove();
});
}(jQuery));
</script>
<?php
} );
add_action( 'wp_head', function () {
?>
<style>
/** Desktop search */
.form-search-section .row {
top: 25%;
}
.form-search-section .dgwt-wcas-search-wrapp {
z-index: 1;
}
.form-search-section input[type="text"], .form-search-section input[type="search"] {
font-style: normal;
font-weight: normal;
font-size: 14px;
line-height: 100%;
}
.form-search-section .dgwt-wcas-search-wrapp ::-webkit-input-placeholder {
font-style: normal;
font-weight: normal;
font-size: 14px;
line-height: 100%;
}
.form-search-section .dgwt-wcas-search-wrapp ::-moz-placeholder {
font-style: normal;
font-weight: normal;
font-size: 14px;
line-height: 100%;
}
.form-search-section .dgwt-wcas-search-wrapp :-ms-input-placeholder {
font-style: normal;
font-weight: normal;
font-size: 14px;
line-height: 100%;
}
.form-search-section input:-moz-placeholder {
font-style: normal;
font-weight: normal;
font-size: 14px;
line-height: 100%;
}
/** Mobile search */
.dfd-search-mobile-show {
padding: 0 25px;
}
.dfd-search-mobile-show .dgwt-wcas-search-wrapp {
min-width: 200px;
}
</style>
<?php
} );

View File

@@ -0,0 +1,271 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_filter( 'et_builder_load_requests', function ( $requests ) {
if ( ! isset( $requests['wc-ajax'] ) ) {
$requests['wc-ajax'] = array();
}
$requests['wc-ajax'][] = 'dgwt_wcas_result_details';
return $requests;
} );
add_action( 'wp_footer', function () {
echo '<div id="wcas-divi-search" style="display: block;">' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="980" ]' ) . '</div>';
} );
add_action( 'wp_footer', function () {
?>
<script>
(function ($) {
$(window).on('load', function () {
var body = $('body');
var diviSearch = $('.et-search-form');
var diviSearchInMenu = $('.et_pb_menu__search-form');
var search = $('#wcas-divi-search > div');
if (diviSearch.length === 0 && diviSearchInMenu.length === 0) {
return;
}
// Search in custom header
if (body.hasClass('et-tb-has-header')) {
if (diviSearchInMenu.length > 0) {
diviSearchInMenu.replaceWith(search);
}
} else if (body.hasClass('et_header_style_slide') || body.hasClass('et_header_style_fullscreen')) {
diviSearch = $('.et_slide_in_menu_container .et-search-form');
if (diviSearch.eq(0)) {
diviSearch.replaceWith(search);
}
} else if (
body.hasClass('et_header_style_centered') ||
body.hasClass('et_header_style_split') ||
body.hasClass('et_header_style_left')
) {
diviSearch.replaceWith(search);
$('.et_search_form_container .et_close_search_field').on('click', function () {
$('.et_search_form_container .dgwt-wcas-close').trigger('click');
});
if (!body.hasClass('et_vertical_nav')) {
$('#et_top_search').on('click', function () {
// Header style: Default, Centered Inline Logo
var mainHeader = $('.et_header_style_left #main-header, .et_header_style_split #main-header');
if (mainHeader.eq(0)) {
var mainHeaderHeight = mainHeader.outerHeight(false);
if (mainHeaderHeight > 0) {
$('.et_search_form_container .dgwt-wcas-search-wrapp').css('top', (mainHeaderHeight - 40) / 2);
}
}
});
}
}
// Prevent to focus input if it isn't empty (theme trigger focus() when user clicks search icon)
var $search = $('#main-header .et_search_form_container .dgwt-wcas-search-wrapp');
$('#et_top_search').on('mousedown', function () {
if ($search.length > 0) {
var $input = $search.find('.dgwt-wcas-search-input');
if ($input.val().length > 0) {
$input.attr('disabled', 'disabled');
}
}
}).on('click', function () {
if ($search.length > 0) {
var $input = $search.find('.dgwt-wcas-search-input');
if ($input.val().length > 0) {
setTimeout(function () {
$input.removeAttr('disabled');
if (typeof $input.data('autocomplete') == 'object') {
var instance = $input.data('autocomplete');
instance.hide();
}
}, 100);
}
}
});
// Open overlay automatically
$('#et_top_search #et_search_icon, #et_top_search_mob #et_search_icon').on('click', function () {
if ($(window).width() <= 980) {
var $handler = $('.js-dgwt-wcas-enable-mobile-form');
if ($handler.length) {
$handler[0].click();
}
setTimeout(function () {
var $closeBtn = $('.et_close_search_field');
if ($closeBtn.length) {
$closeBtn.trigger('click');
}
var $closeBtn2 = $('.dm-search-box .close');
if ($closeBtn2.length) {
$closeBtn2.trigger('click');
}
}, 1100)
}
});
// Open overlay automatically for search in custom menu
$('.et_pb_menu .et_pb_menu__search-button').on('click', function () {
if ($(window).width() <= 980) {
var $handler = $('.et_pb_menu__search .js-dgwt-wcas-enable-mobile-form');
if ($handler.length) {
$handler[0].click();
}
setTimeout(function () {
var $closeBtn = $('.et_pb_menu__close-search-button');
if ($closeBtn.length) {
$closeBtn.trigger('click');
}
}, 1100)
} else {
setTimeout(function () {
var $input = $('.et_pb_menu__search .dgwt-wcas-search-input');
if ($input.length > 0 && $input.val().length === 0) {
$input.trigger('focus');
}
}, 500)
}
});
});
}(jQuery));
</script>
<?php
}, 100 );
add_action( 'wp_head', function () {
?>
<style>
#wcas-divi-search {
display: none !important;
}
/* Custom header */
.et_pb_menu__search .dgwt-wcas-search-wrapp {
max-width: none;
}
/* Header style: Default, Centered Inline Logo */
.et_header_style_split .et_search_form_container .dgwt-wcas-search-wrapp,
.et_header_style_left .et_search_form_container .dgwt-wcas-search-wrapp {
max-width: 400px;
top: 0;
bottom: 0;
right: 45px;
position: absolute;
z-index: 1000;
width: 100%;
}
.et_header_style_split .et_search_form_container .dgwt-wcas-close:not(.dgwt-wcas-inner-preloader),
.et_header_style_left .et_search_form_container .dgwt-wcas-close:not(.dgwt-wcas-inner-preloader) {
background-image: none;
}
.et_header_style_split .et_search_form_container span.et_close_search_field,
.et_header_style_left .et_search_form_container span.et_close_search_field {
right: 5px;
}
.et_header_style_split .et_search_form_container .js-dgwt-wcas-mobile-overlay-enabled .dgwt-wcas-search-form,
.et_header_style_left .et_search_form_container .js-dgwt-wcas-mobile-overlay-enabled .dgwt-wcas-search-form {
max-width: 100% !important;
}
.et_header_style_split .dgwt-wcas-overlay-mobile .dgwt-wcas-search-form,
.et_header_style_left .dgwt-wcas-overlay-mobile .dgwt-wcas-search-form {
max-width: 100% !important;
}
.dgwt-wcas-overlay-mobile .dgwt-wcas-search-wrapp-mobile {
top: 0 !important;
}
/* Header style: Centered */
.et_header_style_centered .et_search_form_container .dgwt-wcas-search-wrapp {
bottom: 20px;
position: absolute;
}
.et_header_style_centered .et_search_form_container .dgwt-wcas-preloader {
right: 20px;
}
.et_header_style_centered .et_search_form_container .dgwt-wcas-close:not(.dgwt-wcas-inner-preloader) {
background-image: none;
}
.et_header_style_centered .et_search_form_container span.et_close_search_field {
right: 5px;
}
/* Header style: Slide in, Fullscreen */
.et_header_style_fullscreen .et_slide_in_menu_container .dgwt-wcas-search-wrapp,
.et_header_style_slide .et_slide_in_menu_container .dgwt-wcas-search-wrapp {
margin-top: 15px;
}
.et_header_style_fullscreen .et_slide_in_menu_container .dgwt-wcas-search-wrapp {
width: 400px;
}
.et_header_style_fullscreen .et_slide_in_menu_container .dgwt-wcas-search-input,
.et_header_style_slide .et_slide_in_menu_container .dgwt-wcas-search-input {
color: #444;
}
@media (max-width: 500px) {
.et_header_style_fullscreen .et_slide_in_menu_container .dgwt-wcas-search-wrapp {
width: 100%;
}
.et_header_style_slide .et_slide_in_menu_container .dgwt-wcas-search-wrapp {
width: 100%;
min-width: 150px;
}
}
/* Full width nav */
@media (min-width: 981px) {
.et_fullwidth_nav .et_search_form_container .dgwt-wcas-search-wrapp {
right: 40px;
}
.et_fullwidth_nav .et_search_form_container .dgwt-wcas-preloader {
right: 0;
}
}
/* Vertical nav */
@media (min-width: 981px) {
.et_vertical_nav #main-header .et_search_form_container {
margin: 0 20px;
}
.et_vertical_nav .dgwt-wcas-search-wrapp {
min-width: 100px;
bottom: 0 !important;
position: relative !important;
}
.et_vertical_nav .et_search_form_container span.et_close_search_field {
right: 5px;
}
.et_vertical_nav .et_search_form_container .dgwt-wcas-close:not(.dgwt-wcas-inner-preloader) {
background-image: none;
}
.et_vertical_nav .et_search_form_container .dgwt-wcas-preloader {
right: 5px;
}
}
</style>
<?php
} );

View File

@@ -0,0 +1,61 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_head', function () {
?>
<style>
.dgwt-wcas-search-wrapp {
max-width: none;
}
.ekommart-handheld-footer-bar ul li.search.active .site-search{
bottom: -100%;
}
</style>
<?php
} );
if ( ! function_exists( 'ekommart_product_search' ) ) {
function ekommart_product_search() {
?>
<div class="site-search">
<?php echo do_shortcode( '[wcas-search-form]' ); ?>
</div>
<?php
}
}
if ( ! function_exists( 'ekommart_handheld_footer_bar_search' ) ) {
function ekommart_handheld_footer_bar_search() {
?>
<a href=""><span class="title"><?php echo esc_attr__( 'Search', 'ekommart' ); ?></span></a>
<div class="site-search">
<?php echo do_shortcode( '[wcas-search-form]' ); ?>
</div>
<?php
}
}
add_action( 'wp_footer', 'dgwt_wcas_ekommart_mobile_search', 100 );
function dgwt_wcas_ekommart_mobile_search() {
?>
<script>
(function ($) {
$(window).on('load', function () {
$(document).on('click', '.ekommart-handheld-footer-bar .search > a', function (e) {
var $siteSearch = $(this).next();
var $form = $siteSearch.find('.js-dgwt-wcas-enable-mobile-form');
if ($form.eq(0)) {
$form.trigger('click');
}
e.preventDefault();
});
});
}(jQuery));
</script>
<?php
}

View File

@@ -0,0 +1,102 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_filter( 'electro_use_third_party_navbar_search', '__return_true' );
add_action( 'electro_navbar_search_third_party', function () {
?>
<div class="navbar-search">
<?php echo do_shortcode( '[wcas-search-form layout="classic"]' ) ?>
</div>
<?php
} );
if ( ! function_exists( 'electro_product_search' ) ) {
function electro_product_search() {
?>
<div class="site-search">
<?php echo do_shortcode( '[wcas-search-form layout="classic"]' ) ?>
</div>
<?php
}
}
add_action( 'wp_footer', function () {
$breakpoint = DGWT_WCAS()->settings->getOption( 'mobile_breakpoint', 992 );
$mobileOverlay = DGWT_WCAS()->settings->getOption( 'enable_mobile_overlay' ) === 'on';
?>
<script>
(function ($) {
function fiboEletroThemeFocusInput() {
$('.handheld-header-links .search > a').on('click', function (e) {
setTimeout(function () {
var $input = $('.handheld-header-links .site-search .dgwt-wcas-search-input');
if ($input.length > 0 && $input.val().length === 0) {
$input.trigger('focus');
}
}, 500);
});
}
$(window).on('load', function () {
<?php if(! $mobileOverlay): ?>
fiboEletroThemeFocusInput();
$('.handheld-header-links .search.active > a').on('click', function (e) {
var $input = $('.handheld-header-links .site-search .dgwt-wcas-close');
if ($input.length > 0) {
$input[0].click();
}
});
<?php else: ?>
// Search icon - mobile
if ($(window).width() <= <?php echo $breakpoint; ?>) {
$('.handheld-header-links .search > a').off('click').on('click', function (e) {
var $handler = $('.handheld-header-links .site-search .js-dgwt-wcas-enable-mobile-form');
if ($handler.length) {
$handler[0].click();
}
e.preventDefault();
});
} else {
// Search icon - almost desktop
fiboEletroThemeFocusInput();
}
<?php endif; ?>
});
}(jQuery));
</script>
<style>
/** Desktop */
.navbar-search .dgwt-wcas-search-wrapp {
max-width: 800px;
}
.navbar-search {
flex-basis: 0;
flex-grow: 1;
margin-bottom: 0;
}
/** Mobile: Default Handled Header */
.handheld-header-links .site-search .dgwt-wcas-search-wrapp {
max-width: 100%;
}
/** Mobile: Mobile Header v1 */
.mobile-header-v1 .site-search .dgwt-wcas-search-wrapp {
max-width: 100%;
}
/** Mobile: Mobile Header v2 */
.mobile-header-v2 .mobile-header-v2-inner > .site-search .dgwt-wcas-search-wrapp {
max-width: 100%;
}
</style>
<?php
} );

View File

@@ -0,0 +1,160 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
if ( ! function_exists( 'avia_append_search_nav' ) ) {
add_filter( 'wp_nav_menu_items', 'avia_append_search_nav', 9997, 2 );
add_filter( 'avf_fallback_menu_items', 'avia_append_search_nav', 9997, 2 );
function avia_append_search_nav( $items, $args ) {
if ( avia_get_option( 'header_searchicon', 'header_searchicon' ) != "header_searchicon" ) {
return $items;
}
if ( avia_get_option( 'header_position', 'header_top' ) != "header_top" ) {
return $items;
}
if ( ( is_object( $args ) && $args->theme_location == 'avia' ) || ( is_string( $args ) && $args = "fallback_menu" ) ) {
ob_start();
echo do_shortcode( '[wcas-search-form layout="icon"]' );
$search = ob_get_clean();
$items .= '<li class="noMobile menu-item menu-item-search-dropdown menu-item-avia-special"><a class="dgwt-wcas-search-enfold-wrapper" href="#">' . $search . '</a></li>';
}
return $items;
}
}
add_action( 'wp_footer', function () {
?>
<script>
<?php // Mark the menu item to be ignored by the MegaMenu script that causes our search div to be hidden. ?>
document.querySelectorAll('.dgwt-wcas-search-enfold-wrapper').forEach((wrapper) => {
if (wrapper.parentElement) {
wrapper.parentElement.classList.add('ignore_menu');
}
});
</script>
<script>
(function ($) {
$(window).on('load', function () {
$('.dgwt-wcas-search-enfold-wrapper').on('click', function () {
return false;
});
});
}(jQuery));
</script>
<script>
(function ($) {
function avia_apply_quant_btn() {
jQuery(".quantity input[type=number]").each(function () {
var number = $(this),
max = parseFloat(number.attr('max')),
min = parseFloat(number.attr('min')),
step = parseInt(number.attr('step'), 10),
newNum = jQuery(jQuery('<div />').append(number.clone(true)).html().replace('number', 'text')).insertAfter(number);
number.remove();
setTimeout(function () {
if (newNum.next('.plus').length === 0) {
var minus = jQuery('<input type="button" value="-" class="minus">').insertBefore(newNum),
plus = jQuery('<input type="button" value="+" class="plus">').insertAfter(newNum);
minus.on('click', function () {
var the_val = parseInt(newNum.val(), 10) - step;
the_val = the_val < 0 ? 0 : the_val;
the_val = the_val < min ? min : the_val;
newNum.val(the_val).trigger("change");
});
plus.on('click', function () {
var the_val = parseInt(newNum.val(), 10) + step;
the_val = the_val > max ? max : the_val;
newNum.val(the_val).trigger("change");
});
}
}, 10);
});
}
$(document).ready(function () {
$(document).on('dgwtWcasDetailsPanelLoaded', function () {
avia_apply_quant_btn();
});
});
}(jQuery));
</script>
<?php
} );
add_action( 'wp_head', function () {
?>
<style>
#top .dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
padding: 10px 15px 10px 40px;
margin: 0;
}
#top.rtl .dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
padding: 10px 40px 10px 15px
}
#top .av-main-nav .dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
padding: 10px 15px 10px 15px;
margin: 0;
}
#top.rtl .av-main-nav .dgwt-wcas-no-submit .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
padding: 10px 15px 10px 15px
}
.dgwt-wcas-search-enfold-wrapper {
cursor: default;
}
.dgwt-wcas-search-wrapp {
margin: 0;
position: absolute;
top: 48%;
-ms-transform: translateY(-48%);
transform: translateY(-48%);
}
.dgwt-wcas-overlay-mobile .dgwt-wcas-search-wrapp {
position: relative;
top: 0;
-ms-transform: none;
transform: none;
}
.dgwt-wcas-ico-magnifier-handler {
max-width: 14px;
}
.dgwt-wcas-layout-icon-open .dgwt-wcas-search-icon-arrow {
top: calc(100% + 5px);
}
html:not(.dgwt-wcas-overlay-mobile-on) .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-search-form {
top: calc(100% + 11px);
}
@media (max-width: 767px) {
.menu-item-search-dropdown {
z-index: 100;
padding-right: 25px;
}
.dgwt-wcas-ico-magnifier-handler {
max-width: 20px;
}
}
</style>
<?php
} );

View File

@@ -0,0 +1,59 @@
<?php
// Exit if accessed directly.
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
if ( ! function_exists( 'pix_get_header_search' ) ) {
function pix_get_header_search( $opts ) {
$attrs = [];
// Use color CSS classes defined by theme.
if (
isset( $opts['color'] ) &&
$opts['color'] !== 'custom'
) {
$attrs[] = 'class="text-' . esc_attr( $opts['color'] ) . '"';
}
// Custom color.
if (
isset( $opts['color'] ) &&
$opts['color'] === 'custom' &&
isset( $opts['custom_color'] )
) {
$attrs[] = 'icon_color="' . esc_attr( $opts['custom_color'] ) . '"';
}
echo do_shortcode( sprintf( '[fibosearch %s layout="icon"]', join( ' ', $attrs ) ) );
}
}
if ( ! function_exists( 'sc_pix_search' ) ) {
function sc_pix_search( $attr, $content = null ) {
return do_shortcode( '[fibosearch]' );
}
}
add_action( 'wp_footer', function () {
?>
<style>
.pix-header-desktop .dgwt-wcas-search-wrapp,
.pix-header-mobile .dgwt-wcas-search-wrapp {
margin-top: -5px;
margin-left: 0.5rem;
margin-right: 0.5rem;
}
.pix-header-desktop .dgwt-wcas-search-wrapp .dgwt-wcas-ico-magnifier-handler,
.pix-header-mobile .dgwt-wcas-search-wrapp .dgwt-wcas-ico-magnifier-handler {
max-width: 18px;
}
<?php // Sticky header. ?>
.pix-header-desktop.is-scroll .dgwt-wcas-search-wrapp .dgwt-wcas-ico-magnifier-handler path {
fill: var(--text-heading-default) !important;
}
</style>
<?php
} );

View File

@@ -0,0 +1,44 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
// Default search form
add_filter( 'get_search_form', function ( $form, $args ) {
return do_shortcode( '[wcas-search-form layout="classic"]' );
}, 10, 2 );
// WooCommerce search form
add_filter( 'get_product_search_form', function ( $form ) {
return do_shortcode( '[wcas-search-form layout="classic"]' );
} );
add_action( 'wp_footer', function () {
?>
<script>
(function ($) {
$(window).on('load', function () {
// Search icon - mobile
if ($(window).width() <= 768) {
$('.search-wrapper .search-icon').off('click').on('click', function (e) {
var $handler = $('.search-wrapper .header-search-box .js-dgwt-wcas-enable-mobile-form');
if ($handler.length) {
$handler[0].click();
}
});
}
});
}(jQuery));
</script>
<style>
.admin-bar .dgwt-wcas-suggestions-wrapp {
margin-top: -32px !important;
}
.admin-bar .dgwt-wcas-details-wrapp {
margin-top: -32px !important;
}
</style>
<?php
}, 100 );

View File

@@ -0,0 +1,259 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_filter( 'body_class', function ( $classes ) {
$classes[] = 'dgwt-wcas-theme-flatsome';
return $classes;
} );
add_action( 'wp_loaded', function () {
remove_shortcode( 'search' );
add_shortcode( 'search', array( 'DgoraWcas\\Shortcode', 'addBody' ) );
} );
global $dgwt_wcas_flatsome_search_counter;
$dgwt_wcas_flatsome_search_counter = 0;
add_action( 'wp_head', function () { ?>
<style>
.dgwt-wcas-flatsome-up {
margin-top: -40vh;
}
#search-lightbox .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input {
height: 60px;
font-size: 20px;
}
#search-lightbox .dgwt-wcas-search-wrapp {
-webkit-transition: all 100ms ease-in-out;
-moz-transition: all 100ms ease-in-out;
-ms-transition: all 100ms ease-in-out;
-o-transition: all 100ms ease-in-out;
transition: all 100ms ease-in-out;
}
.dgwt-wcas-overlay-mobile-on .mfp-wrap .mfp-content {
width: 100vw;
}
.dgwt-wcas-overlay-mobile-on .mfp-close,
.dgwt-wcas-overlay-mobile-on .nav-sidebar {
display: none;
}
.dgwt-wcas-overlay-mobile-on .main-menu-overlay {
display: none;
}
.dgwt-wcas-open .header-search-dropdown .nav-dropdown {
opacity: 1;
max-height: inherit;
left: -15px !important;
}
.dgwt-wcas-open:not(.dgwt-wcas-theme-flatsome-dd-sc) .nav-right .header-search-dropdown .nav-dropdown {
left: auto;
/*right: -15px;*/
}
.dgwt-wcas-theme-flatsome .nav-dropdown .dgwt-wcas-search-wrapp {
min-width: 450px;
}
.header-search-form {
min-width: 250px;
}
</style>
<?php
} );
// Count search items in headers.
add_action( 'flatsome_header_elements', function ( $value ) {
global $dgwt_wcas_flatsome_search_counter;
if ( $value === 'search' ) {
$dgwt_wcas_flatsome_search_counter ++;
}
} );
add_action( 'wp_footer', function () {
global $dgwt_wcas_flatsome_search_counter;
// Overwriting search icon.
if ( get_theme_mod( 'header_search_style', 'dropdown' ) === 'dropdown' && $dgwt_wcas_flatsome_search_counter > 0 ) {
for ( $i = 0; $i < $dgwt_wcas_flatsome_search_counter; $i ++ ) {
echo '<div id="wcas-theme-search-' . $i . '" style="display: block;" class="wcas-theme-search"><li>' . do_shortcode( '[fibosearch layout="icon"]' ) . '</li></div>';
}
?>
<style>
.header-main .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-search-icon {
width: 16px;
}
.header-main .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler {
fill: hsla(0, 0%, 40%, .85);
max-width: 16px;
}
.header-main .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler:hover {
fill: hsla(0, 0%, 7%, .85);
}
.header-main.nav-dark .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler {
fill: hsla(0, 0%, 100%, .8);
}
.header-main.nav-dark .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler:hover {
fill: #ffffff;
}
</style>
<script>
wcasThemeSearch = document.querySelectorAll('.header-search');
if (wcasThemeSearch.length > 0) {
wcasThemeSearch.forEach((wcasThemeSearchItem, index) => {
if (document.querySelector('#wcas-theme-search-' + index + ' > li') !== null) {
wcasThemeSearchItem.replaceWith(document.querySelector('#wcas-theme-search-' + index + ' > li'));
}
});
}
document.querySelectorAll('.wcas-theme-search').forEach(function (elem) {
elem.remove();
});
</script>
<?php
}
$minChars = DGWT_WCAS()->settings->getOption( 'min_chars' );
if ( empty( $minChars ) || ! is_numeric( $minChars ) ) {
$minChars = 3;
}
?>
<script>
(function ($) {
$(document).ready(function () {
$(document).on('keyup', '#search-lightbox .dgwt-wcas-search-wrapp .dgwt-wcas-search-input', function () {
if (this.value.length >= <?php echo $minChars; ?>) {
if (!$(this).closest('.dgwt-wcas-search-wrapp').hasClass('dgwt-wcas-flatsome-up')) {
setTimeout(function () {
$(window).trigger('resize.autocomplete');
}, 105);
}
$(this).closest('.dgwt-wcas-search-wrapp').addClass('dgwt-wcas-flatsome-up');
}
});
var refreshDropdownPosition;
var style = '';
var positioning = false;
$(document).on('mouseenter', '.header-search-dropdown a', function (e) {
if (positioning) {
return;
}
setTimeout(function () {
var pos = $(e.target).closest('.header-search').find('.nav-dropdown').attr('style');
if (typeof pos == 'string' && pos.length > 0) {
style = pos;
}
refreshDropdownPosition = setInterval(function () {
if ($('body').hasClass('dgwt-wcas-open') && style.length > 0) {
$('.nav-dropdown').attr('style', style);
}
if (!$('body').hasClass('dgwt-wcas-open') && !$('.header-search').hasClass('current-dropdown')) {
clearInterval(refreshDropdownPosition);
$('.nav-dropdown').removeAttr('style');
style = '';
positioning = false;
}
}, 10)
}, 400);
positioning = true;
});
$(document).on('click', '.header-search-lightbox > a, .header-search-lightbox > .header-button > a', function () {
var formWrapper = $('#search-lightbox').find('.dgwt-wcas-search-wrapp');
setTimeout(function () {
if (formWrapper.find('.dgwt-wcas-close')[0]) {
formWrapper.find('.dgwt-wcas-close')[0].click();
}
formWrapper.removeClass('dgwt-wcas-flatsome-up');
formWrapper.find('.dgwt-wcas-search-input').trigger('focus');
}, 300);
});
// Mobile
$(document).on('click', '.mobile-nav .header-search .icon-search', function () {
var $handler = $('.mobile-nav .header-search').find('.js-dgwt-wcas-enable-mobile-form');
if ($handler.length) {
$handler[0].click();
}
});
});
})(jQuery);
</script>
<?php
}, 1000 );
add_action( 'wp_footer', function () { ?>
<script>
(function ($) {
// Fix Quantity buttons
$(document).on('dgwtWcasDetailsPanelLoaded', function () {
var $quantityFields = $('.dgwt-wcas-details-wrapp .quantity');
if ($quantityFields.length) {
$quantityFields.addQty();
}
});
})(jQuery);
</script>
<?php
}, 1001 );
add_filter( 'dgwt/wcas/troubleshooting/tests', function ( $tests ) {
$tests['direct'][] = array(
'label' => 'Flatsome incompatible settings',
'test' => function () {
$result = array(
'label' => '',
'status' => 'good',
'description' => '',
'actions' => '',
'test' => 'FlatsomeIncompatibleSettings',
);
if (
get_theme_mod( 'header_search_style' ) === 'lightbox' &&
get_theme_mod( 'header_cart_style', 'dropdown' ) === 'off-canvas' &&
DGWT_WCAS()->settings->getOption( 'show_details_box' ) === 'on'
) {
$customizeUrl = admin_url( 'customize.php' );
$result['status'] = 'critical';
$result['label'] = __( 'There is a conflict between Flatsome theme settings and our plugin', 'ajax-search-for-woocommerce' );
$result['description'] = '<p style="max-width: 740px">' . __( "There is a rare combination of <b>FiboSearch</b> and <b>Flatsome</b> settings that might cause issues when adding a product to the cart from the autocomplete search results. Unfortunately, you have this combination. You can't use <b>Off-Canvas Sidebar</b> as <b>Cart Style (Flatsome)</b>, <b>Search Icon Type</b> as <b>Search Icon Type (Flatsome)</b>, and <b>Details Panel (FiboSearch)</b> at the same time. The solution is to resign from one of these options.", 'ajax-search-for-woocommerce' ) . '</p>';
$result['description'] .= '<p><b>' . __( 'Solutions (you only need to use one of them)', 'ajax-search-for-woocommerce' ) . '</b></p>';
$result['description'] .= '<ol><li>' . __( '(FiboSearch settings) Go to <code>Autocomplete</code> tab and disable <code>Show Details Panel</code> option.', 'ajax-search-for-woocommerce' ) . '</li>';
$result['description'] .= '<li>' . sprintf( __( '(Flatsome settings) Go to <code>Appearance -> <a href="%s" target="_blank">Customize</a> -> Header -> Search</code> and change <code>Search Icon Type</code> option to <code>Dropdown</code>.', 'ajax-search-for-woocommerce' ), $customizeUrl ) . '</li>';
$result['description'] .= '<li>' . sprintf( __( '(Flatsome settings) Go to <code>Appearance -> <a href="%s" target="_blank">Customize</a> -> Header -> Cart</code> and change <code>Cart Style</code> option to <code>Dropdown</code> or <code>Link only</code>.', 'ajax-search-for-woocommerce' ), $customizeUrl ) . '</li></ol>';
}
return $result;
}
);
return $tests;
} );

View File

@@ -0,0 +1,75 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'template_redirect', function () {
remove_action( 'generate_menu_bar_items', 'generate_do_navigation_search_button' );
add_action( 'generate_menu_bar_items', function () {
echo '<div class="dgwt-wcas-menu-bar-item">';
echo do_shortcode( '[fibosearch layout="icon"]' );
echo '</div>';
} );
// If generate_is_using_flexbox() === false
add_filter( 'generate_navigation_search_menu_item_output', function ( $html ) {
return '<li class="dgwt-wcas-menu-search-item">' . do_shortcode( '[fibosearch layout="icon"]' ) . '</li>';
} );
// If generate_is_using_flexbox() === false
add_action( 'generate_inside_mobile_menu_bar', function () {
echo '<div class="dgwt-wcas-search-item">';
echo do_shortcode( '[fibosearch layout="icon"]' );
echo '</div>';
} );
} );
add_action( 'wp_head', function () {
$settings = false;
if ( function_exists( 'generate_get_color_defaults' ) ) {
$settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_color_defaults()
);
}
?>
<style>
.dgwt-wcas-menu-bar-item, .dgwt-wcas-menu-search-item, .dgwt-wcas-search-item {
padding-left: 20px;
padding-right: 20px;
}
.menu-bar-items .dgwt-wcas-ico-magnifier-handler,
.dgwt-wcas-menu-search-item .dgwt-wcas-ico-magnifier-handler,
.dgwt-wcas-search-item .dgwt-wcas-ico-magnifier-handler {
max-width: 16px;
}
.mobile-bar-items .search-item {
display: none;
}
#mobile-menu .dgwt-wcas-menu-search-item {
display: none;
}
#masthead .dgwt-wcas-search-item, .dgwt-wcas-menu-search-item {
padding-top: 20px;
}
<?php if ($settings) { ?>
.dgwt-wcas-search-icon path {
fill: <?php echo esc_attr($settings['navigation_text_color']); ?>;
}
.dgwt-wcas-search-icon:hover path {
fill: <?php echo esc_attr($settings['navigation_text_hover_color']); ?>;
}
<?php } ?>
</style>
<?php
} );

View File

@@ -0,0 +1,50 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
/**
* Default search
*/
add_action( 'wp_footer', function () {
echo '<div id="wcas-theme-search" style="display: block;"><div class="goya-search"><fieldset><div class="search-button-group">' . do_shortcode( '[wcas-search-form layout="classic"]' ) . '</div></fieldset></div></div>';
echo '<div id="wcas-theme-search-mobile" style="display: block;"><div class="goya-search"><fieldset><div class="search-button-group">' . do_shortcode( '[wcas-search-form layout="classic"]' ) . '</div></fieldset></div></div>';
?>
<script>
var wcasThemeSearch = document.querySelector('.search-panel .side-panel-content .goya-search');
if (wcasThemeSearch !== null) {
wcasThemeSearch.replaceWith(document.querySelector('#wcas-theme-search > div'));
}
document.querySelector('#wcas-theme-search').remove();
var wcasThemeSearchMobile = document.querySelector('.side-mobile-menu .side-panel-content .goya-search');
if (wcasThemeSearchMobile !== null) {
wcasThemeSearchMobile.replaceWith(document.querySelector('#wcas-theme-search-mobile > div'));
}
document.querySelector('#wcas-theme-search-mobile').remove();
(function ($) {
$(window).on('load', function () {
$('.site-header .quick_search').on('click', function (e) {
setTimeout(function () {
var $input = $('.search-panel .side-panel-content .dgwt-wcas-search-input');
if ($input.length > 0 && $input.val().length === 0) {
$input.trigger('focus');
}
}, 500);
});
});
}(jQuery));
</script>
<style>
.search-panel .search-button-group {
border-bottom: none;
}
.search-panel .search-button-group .dgwt-wcas-search-wrapp {
max-width: 100%;
}
</style>
<?php
}, 12);

View File

@@ -0,0 +1,123 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_head', function () { ?>
<style>
.w-search.layout_modern .w-search-close {
}
.w-search.layout_modern .w-search-close {
color: rgba(0, 0, 0, 0.5) !important;
}
.w-search.layout_modern .dgwt-wcas-close {
display: none;
}
.w-search.layout_modern .dgwt-wcas-preloader {
right: 20px;
}
.w-search.layout_fullscreen .w-form-row-field {
top: 48px;
}
</style>
<?php
} );
add_action( 'wp_footer', function () { ?>
<script>
(function ($) {
function dgwtWcasImprezaGetActiveInstance() {
var $el = $('.dgwt-wcas-search-wrapp.dgwt-wcas-active'),
instance;
if ($el.length > 0) {
$el.each(function () {
var $input = $(this).find('.dgwt-wcas-search-input');
if (typeof $input.data('autocomplete') == 'object') {
instance = $input.data('autocomplete');
return false;
}
});
}
return instance;
}
$(document).ready(function () {
$('.w-search.layout_modern .w-search-close').on('click', function () {
var instance = dgwtWcasImprezaGetActiveInstance();
if (typeof instance == 'object') {
instance.suggestions = [];
instance.hide();
instance.el.val('');
}
});
$('.w-search-open').on('click', function (e) {
if ($(window).width() < 900) {
e.preventDefault();
var $mobileHandler = $(e.target).closest('.w-search').find('.js-dgwt-wcas-enable-mobile-form');
if ($mobileHandler.length) {
$mobileHandler[0].click();
}
setTimeout(function () {
$('.w-search').removeClass('active');
}, 500);
}
});
});
})(jQuery);
</script>
<?php
}, 1000 );
/**
* Activate the search engine during AJAX loading of subsequent pages when the Grid
* element's pagination is set to "Load items on page scroll"
*/
add_filter( 'dgwt/wcas/helpers/is_search_query', function ( $enabled, $query ) {
if (
did_action( 'us_grid_before_custom_query' ) &&
$query->get( 'post_type' ) &&
is_string( $query->get( 'post_type' ) ) &&
$query->get( 'post_type' ) === 'product' &&
is_string( $query->get( 's' ) ) &&
strlen( $query->get( 's' ) ) > 0
) {
$enabled = true;
}
return $enabled;
}, 10, 2 );
/**
* Force orderby (if empty) during AJAX loading of subsequent pages when the Grid
* element's pagination is set to "Load items on page scroll"
*/
add_filter( 'woocommerce_get_catalog_ordering_args', function ( $args ) {
if ( function_exists( 'us_maybe_get_post_json' ) ) {
$template_vars = us_maybe_get_post_json();
if (
! empty( $template_vars ) &&
isset( $template_vars['query_args']['post_type'] ) &&
$template_vars['query_args']['post_type'] === 'product' &&
! empty( $template_vars['query_args']['s'] ) &&
empty( $template_vars['query_args']['orderby'] )
) {
$args['orderby'] = 'relevance';
$args['order'] = 'DESC';
}
}
return $args;
}, 999, 1 );

View File

@@ -0,0 +1,51 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
function fibosearchKadenceRenderColor( $color ) {
if ( empty( $color ) ) {
return false;
}
if ( ! is_array( $color ) && strpos( $color, 'palette' ) !== false ) {
$color = 'var(--global-' . $color . ')';
}
return $color;
}
add_action( 'after_setup_theme', function () {
remove_action( 'kadence_header_search', 'Kadence\header_search' );
} );
add_action( 'kadence_header_search', function () {
echo do_shortcode( '[fibosearch layout="icon"]' );
} );
add_action( 'wp_footer', function () {
$color = '';
$hoverColor = '';
if ( function_exists( 'Kadence\kadence' ) ) {
$color = Kadence\kadence()->sub_option( 'header_search_color', 'color' );
$hoverColor = Kadence\kadence()->sub_option( 'header_search_color', 'hover' );
}
?>
<style>
<?php if (!empty($color)) { ?>
.dgwt-wcas-search-icon path {
fill: <?php echo fibosearchKadenceRenderColor($color); ?>;
}
<?php } ?>
<?php if (!empty($hoverColor)) { ?>
.dgwt-wcas-search-icon:hover path {
fill: <?php echo fibosearchKadenceRenderColor($hoverColor); ?>;
}
<?php } ?>
</style>
<?php
} );

View File

@@ -0,0 +1,87 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_footer', function () {
if ( ! function_exists( 'konte_get_option' ) ) {
return;
}
// Search style: 'icon-modal', 'icon', 'form'
$header_search_style = konte_get_option( 'header_search_style' );
$layout = $header_search_style === 'icon' ? 'icon' : 'classic';
$class = $header_search_style === 'icon' ? 'icon' : 'form';
echo '<div id="wcas-search-instance" style="display: block;"><div class="header-search ' . $class . '">' . do_shortcode( '[wcas-search-form layout="' . $layout . '" mobile_overlay="1" mobile_breakpoint="1200" ]' ) . '</div></div>';
echo '<div id="wcas-search-instance-mobile" style="display: block;">' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="1200" ]' ) . '</div>';
?>
<script>
(function ($) {
<?php if ($header_search_style === 'form' || $header_search_style === 'icon') { ?>
// Replace search form (icon or form)
var themeSearch = document.querySelector('#masthead .header-search');
if (themeSearch !== null) {
themeSearch.replaceWith(document.querySelector('#wcas-search-instance > div'));
}
<?php } ?>
<?php if ($header_search_style === 'icon-modal') { ?>
var searchBtn = $('#masthead [data-target="search-modal"]');
// Replace search form in modal
$(window).on('load', function () {
var themeSearch = $('#search-modal .instance-search');
var wcasSearch = $('#wcas-search-instance > div');
if (themeSearch.eq(0)) {
themeSearch.html(wcasSearch);
}
$('#wcas-search-instance').remove();
});
// Autofocus
if ($(window).width() >= 1200) {
searchBtn.on('click', function () {
setTimeout(function () {
var $input = $('#search-modal .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
}, 500)
});
}
<?php } ?>
// Mobile search in sidebar
$(window).on('load', function () {
var themeSearchMobile = $('.mobile-menu__search-form');
var wcasSearchMobile = $('#wcas-search-instance-mobile > div');
if (themeSearchMobile.eq(0)) {
themeSearchMobile.html(wcasSearchMobile);
}
$('#wcas-search-instance-mobile').remove();
});
}(jQuery));
</script>
<?php
} );
add_action( 'wp_head', function () {
if ( ! function_exists( 'konte_get_option' ) ) {
return;
}
?>
<style>
.search-modal .modal-content {
top: 25%;
}
.dark .header-search.icon .dgwt-wcas-ico-magnifier-handler path {
fill: #ffffff;
}
.mobile-menu-panel .panel .mobile-menu__search-form {
padding-top: 20px;
}
</style>
<?php
} );

View File

@@ -0,0 +1,58 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_head', function () { ?>
<style>
#popup-search .row-popular-search-keywords {
display: none;
}
.dgwt-wcas-suggestion {
transition: none;
}
</style>
<?php
} );
add_action( 'wp_enqueue_scripts', function () {
// Force faster enqueuing as otherwise jQuery dependency error occurs.
wp_enqueue_script( 'jquery-dgwt-wcas' );
}, 15 );
add_action( 'wp_footer', function () {
echo '<div id="wcas-theme-search" style="display: block;">' . do_shortcode( '[fibosearch layout="classic"]' ) . '</div>';
?>
<script>
wcasThemeSearch = document.querySelector('#popup-search .page-search-popup-content');
if (wcasThemeSearch !== null) {
wcasThemeSearch.replaceWith(document.querySelector('#wcas-theme-search > div'));
}
document.querySelector('#wcas-theme-search').remove();
</script>
<script>
(function ($) {
// Autofocus.
$('.page-open-popup-search').on('click', function () {
$inputMobile = $('#popup-search .js-dgwt-wcas-enable-mobile-form');
$input = $('#popup-search .dgwt-wcas-search-input');
if ($inputMobile.length > 0) {
setTimeout(function () {
$inputMobile.trigger('click');
}, 50);
// Close the theme search window.
setTimeout(function () {
$('#popup-search #search-popup-close').trigger('click');
}, 200)
} else if ($input.length > 0) {
setTimeout(function () {
$input.trigger('focus');
}, 350);
}
});
}(jQuery));
</script>
<?php
}, 50 );

View File

@@ -0,0 +1,21 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_filter( 'hfg_template_locations', function ( $locations ) {
$locations = array_merge( array( DGWT_WCAS_DIR . 'partials/themes/neve/' ), $locations );
return $locations;
} );
add_action( 'wp_head', function () { ?>
<style>
html[data-neve-theme="dark"] .header .dgwt-wcas-search-icon svg,
html[data-neve-theme="dark"] .header .dgwt-wcas-search-icon path {
fill: white;
}
</style>
<?php
} );

View File

@@ -0,0 +1,7 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
echo do_shortcode( '[fibosearch layout="icon"]' );

View File

@@ -0,0 +1,11 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
?>
<div class="component-wrap search-field">
<div class="widget widget-search">
<?php echo do_shortcode('[fibosearch]'); ?>
</div>
</div>

View File

@@ -0,0 +1,365 @@
<?php
// Exit if accessed directly.
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
// Change mobile breakpoint
add_filter( 'dgwt/wcas/scripts/mobile_overlay_breakpoint', function () {
$mobile_menu_breakpoint = get_theme_mod( 'ocean_mobile_menu_breakpoints', '959' );
$mobile_menu_custom_breakpoint = get_theme_mod( 'ocean_mobile_menu_custom_breakpoint' );
if ( $mobile_menu_breakpoint === 'custom' && ! empty( $mobile_menu_custom_breakpoint ) ) {
$mobile_menu_breakpoint = $mobile_menu_custom_breakpoint;
}
return $mobile_menu_breakpoint;
} );
add_filter( 'get_search_form', function ( $form, $args ) {
// Used when search style is "Drop down" and on 404 page.
return do_shortcode( '[fibosearch]' );
}, 10, 2 );
add_action( 'wp', function () {
// Mobile search - icon in menu.
if (
! function_exists( 'oceanwp_mobile_menu_search_style' ) ||
! function_exists( 'oceanwp_header_style' )
) {
return;
}
$search_style = oceanwp_mobile_menu_search_style(); // Search Icon Style.
$search_style = $search_style ?: 'disabled';
$header_style = oceanwp_header_style();
if ( $search_style === 'disabled' || $header_style === 'vertical' ) {
return;
}
remove_action( 'ocean_after_mobile_icon', 'oceanwp_mobile_search_icon' );
remove_action( 'ocean_mobile_menu_icon_after', 'oceanwp_mobile_search_form_html' );
add_action( 'ocean_after_mobile_icon', function () {
// Placeholders to prevent JS errors.
echo '<span class="search-icon-dropdown"></span>';
echo '<span class="search-style-dropdown"></span>';
echo do_shortcode( '[fibosearch layout="icon"]' );
} );
add_action( 'wp_footer', function () {
$headerHeight = get_theme_mod( 'ocean_header_height', '74' );
?>
<style>
.oceanwp-mobile-menu-icon .dgwt-wcas-search-wrapp {
display: inline-block;
margin-left: 12px;
}
.oceanwp-mobile-menu-icon .dgwt-wcas-search-wrapp .icon-magnifier {
color: #555;
font-size: 13px;
line-height: <?php echo esc_attr($headerHeight); ?>px;
}
.oceanwp-mobile-menu-icon .dgwt-wcas-search-wrapp:hover .icon-magnifier {
color: #13aff0;
}
</style>
<?php
} );
add_filter( 'dgwt/wcas/form/magnifier_ico', function ( $html, $class ) {
if ( $class === 'dgwt-wcas-ico-magnifier-handler' ) {
$html = '<i class=" icon-magnifier" aria-hidden="true" role="img"></i>';
}
return $html;
}, 10, 2 );
}, 20 );
add_action( 'wp_head', function () {
if ( ! function_exists( 'oceanwp_header_style' ) ) {
return;
}
$headerStyle = oceanwp_header_style();
// Hide default search before overwrite.
if ( $headerStyle === 'medium' ) {
?>
<style>
#site-header.medium-header #medium-searchform > form {
display: none;
}
</style>
<?php
} else if ( $headerStyle === 'vertical' ) {
?>
<style>
#vertical-searchform > form {
display: none;
}
</style>
<?php
}
} );
add_action( 'wp_footer', function () {
if (
! function_exists( 'oceanwp_menu_search_style' ) ||
! function_exists( 'oceanwp_header_style' ) ||
! function_exists( 'oceanwp_mobile_menu_style' )
) {
return;
}
$menuSearchStyle = oceanwp_menu_search_style();
$headerStyle = oceanwp_header_style();
$mobileMenuStyle = oceanwp_mobile_menu_style(); // Mobile Menu Style.
$mobileMenuSearch = get_theme_mod( 'ocean_mobile_menu_search', true ); // MOBILE MENU SEARCH.
// Search styles - desktop.
if ( $menuSearchStyle === 'drop_down' ) {
// Drop down.
?>
<script>
var desktopSearchInput = document.querySelector('#searchform-dropdown .dgwt-wcas-search-input');
if (desktopSearchInput !== null) {
// This class is used to focus input.
desktopSearchInput.classList.add('field');
}
</script>
<?php
} else if ( $menuSearchStyle === 'overlay' ) {
// Overlay.
echo '<div id="dgwt-wcas-desktop-search" style="display: none;"><div>' . do_shortcode( '[fibosearch]' ) . '<a href="#" class="search-overlay-close"><span></span></a></div></div>';
?>
<script>
var desktopSearch = document.querySelector('#searchform-overlay > div > form');
if (desktopSearch !== null) {
desktopSearch.replaceWith(document.querySelector('#dgwt-wcas-desktop-search > div'));
}
document.querySelector('#dgwt-wcas-desktop-search').remove();
</script>
<style>
#searchform-overlay a.search-overlay-close {
top: 15% !important;
}
#searchform-overlay form {
position: static;
margin-top: 0;
}
#searchform-overlay .dgwt-wcas-search-wrapp {
max-width: none;
position: absolute;
top: 30%;
text-align: left;
}
.dgwt-wcas-details-wrapp {
z-index: 9999 !important;
}
#searchform-overlay form input {
z-index: inherit;
}
#searchform-overlay .dgwt-wcas-no-submit .dgwt-wcas-ico-magnifier {
fill: #fff;
}
#searchform-overlay .dgwt-wcas-voice-search path {
fill: #fff;
}
</style>
<?php
} else if ( $menuSearchStyle === 'header_replace' ) {
// Header replace.
echo '<div id="dgwt-wcas-desktop-search" style="display: none;">' . do_shortcode( '[fibosearch]' ) . '</div>';
?>
<script>
var desktopSearch = document.querySelector('#searchform-header-replace > form');
if (desktopSearch !== null) {
desktopSearch.replaceWith(document.querySelector('#dgwt-wcas-desktop-search > div'));
}
document.querySelector('#dgwt-wcas-desktop-search').remove();
</script>
<style>
#searchform-header-replace {
display: flex;
align-items: center;
}
#searchform-header-replace input {
padding: 10px 15px 10px 40px;
width: 100%;
font-size: inherit;
}
#searchform-header-replace .dgwt-wcas-search-wrapp {
margin-right: 40px;
}
</style>
<?php
}
// Mobile menu.
if ( $mobileMenuSearch ) {
// Menu style - dropdown.
if ( $mobileMenuStyle === 'dropdown' ) {
echo '<div id="dgwt-wcas-mobile-search" style="display: none;">' . do_shortcode( '[fibosearch]' ) . '</div>';
?>
<script>
var mobileSearch = document.querySelector('#mobile-menu-search > form');
if (mobileSearch !== null) {
mobileSearch.replaceWith(document.querySelector('#dgwt-wcas-mobile-search > div'));
}
document.querySelector('#dgwt-wcas-mobile-search').remove();
</script>
<style>
#mobile-dropdown #mobile-menu-search form input {
padding: 10px 15px 10px 40px !important;
}
</style>
<?php
} else if ( $mobileMenuStyle === 'sidebar' ) {
// Menu style - sidebar.
echo '<div id="dgwt-wcas-mobile-search" style="display: none;">' . do_shortcode( '[fibosearch]' ) . '</div>';
?>
<script>
(function ($) {
$(window).on('load', function () {
var mobileSearch = document.querySelector('#sidr .sidr-class-mobile-searchform');
if (mobileSearch !== null) {
mobileSearch.replaceWith(document.querySelector('#dgwt-wcas-mobile-search > div'));
}
document.querySelector('#dgwt-wcas-mobile-search').remove();
});
}(jQuery));
</script>
<style>
#sidr .sidr-class-mobile-searchform input {
padding: 10px 15px 10px 40px !important;
}
#sidr .dgwt-wcas-search-wrapp {
padding: 0 20px;
margin-top: 20px;
}
</style>
<?php
} else if ( $mobileMenuStyle === 'fullscreen' ) {
// Menu style - full screen.
echo '<div id="dgwt-wcas-mobile-search" style="display: none;">' . do_shortcode( '[fibosearch]' ) . '</div>';
?>
<script>
var mobileSearch = document.querySelector('#mobile-fullscreen #mobile-search > form');
if (mobileSearch !== null) {
mobileSearch.replaceWith(document.querySelector('#dgwt-wcas-mobile-search > div'));
}
document.querySelector('#dgwt-wcas-mobile-search').remove();
</script>
<style>
#mobile-fullscreen #mobile-search input {
padding: 10px 15px 10px 40px !important;
font-size: 16px;
}
#mobile-fullscreen #mobile-search {
margin: 0 auto;
max-width: 280px;
}
#mobile-fullscreen #mobile-search .dgwt-wcas-ico-magnifier {
fill: #fff;
}
#mobile-fullscreen #mobile-search .dgwt-wcas-voice-search path {
fill: #fff;
}
</style>
<?php
}
}
// Header styles.
if ( $headerStyle === 'medium' ) {
echo '<div id="dgwt-wcas-desktop-search-medium" style="display: none;">' . do_shortcode( '[fibosearch]' ) . '</div>';
?>
<script>
var desktopSearch = document.querySelector('#medium-searchform form');
if (desktopSearch !== null) {
desktopSearch.replaceWith(document.querySelector('#dgwt-wcas-desktop-search-medium > div'));
}
document.querySelector('#dgwt-wcas-desktop-search-medium').remove();
</script>
<style>
#site-header.medium-header #medium-searchform input {
padding: 10px 15px 10px 40px;
border: 1px solid #ddd;
max-width: 100%;
}
#site-header.medium-header #medium-searchform input:focus {
max-width: 100%;
}
#site-header.medium-header .dgwt-wcas-search-wrapp {
max-width: 200px;
}
</style>
<?php
} else if ( $headerStyle === 'vertical' ) {
echo '<div id="dgwt-wcas-desktop-search-vertical" style="display: none;">' . do_shortcode( '[fibosearch]' ) . '</div>';
?>
<script>
var desktopSearch = document.querySelector('#vertical-searchform form');
if (desktopSearch !== null) {
desktopSearch.replaceWith(document.querySelector('#dgwt-wcas-desktop-search-vertical > div'));
}
document.querySelector('#dgwt-wcas-desktop-search-vertical').remove();
</script>
<style>
#site-header.vertical-header #vertical-searchform form input {
padding: 10px 15px 10px 40px;
width: 100%;
font-size: inherit;
z-index: inherit;
}
</style>
<?php
} else if ( $headerStyle === 'full_screen' ) {
echo '<div id="dgwt-wcas-desktop-search-full-screen" style="display: none;">' . do_shortcode( '[fibosearch]' ) . '</div>';
?>
<script>
var desktopSearch = document.querySelector('#full-screen-menu .search-toggle-li > form');
if (desktopSearch !== null) {
desktopSearch.replaceWith(document.querySelector('#dgwt-wcas-desktop-search-full-screen > div'));
}
document.querySelector('#dgwt-wcas-desktop-search-full-screen').remove();
</script>
<style>
#site-header.full_screen-header .fs-dropdown-menu > li.search-toggle-li {
max-width: 350px;
}
#site-header.full_screen-header .fs-dropdown-menu > li.search-toggle-li input {
padding: 10px 15px 10px 40px;
z-index: inherit;
}
#full-screen-menu .search-toggle-li .dgwt-wcas-ico-magnifier {
fill: #fff;
}
#full-screen-menu .search-toggle-li .dgwt-wcas-voice-search path {
fill: #fff;
}
</style>
<?php
}
} );

View File

@@ -0,0 +1,111 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_footer', function () {
echo '<div id="wcas-theme-search" style="display: block;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
?>
<script>
var wcasThemeSearch = document.querySelector('.below-header #search-box');
if (wcasThemeSearch !== null) {
wcasThemeSearch.replaceWith(document.querySelector('#wcas-theme-search > div'));
}
wcasThemeSearch = document.querySelector('.below-header .thmk-woocommerce-search-wrap');
if (wcasThemeSearch !== null) {
wcasThemeSearch.replaceWith(document.querySelector('#wcas-theme-search > div'));
}
document.querySelector('#wcas-theme-search').remove();
</script>
<style>
.dgwt-wcas-search-wrapp {
min-width: 200px;
}
.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input {
height: 49px;
}
@media (max-width: 1200px) {
.dgwt-wcas-search-wrapp {
padding-left: 30px;
}
}
@media (max-width: 850px) {
.dgwt-wcas-search-wrapp {
padding-left: 10px;
}
.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input {
height: 45px;
}
}
@media (max-width: 768px) {
.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input {
height: 34px;
}
}
.dgwt-wcas-overlay-mobile .dgwt-wcas-search-wrapp {
padding-left: 0;
}
.below-header-bar .dgwt-wcas-search-wrapp {
padding-left: 18px;
}
</style>
<?php
if ( get_theme_mod( 'open_shop_sticky_header', false ) === true ) {
echo '<div id="wcas-theme-search-sticky" style="display: block;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
?>
<script>
var wcasThemeSearchInStickyHeader = document.querySelector('.search-wrapper #search-box');
if (wcasThemeSearchInStickyHeader !== null) {
wcasThemeSearchInStickyHeader.replaceWith(document.querySelector('#wcas-theme-search-sticky > div'));
}
wcasThemeSearchInStickyHeader = document.querySelector('.search-wrapper .thmk-woocommerce-search-wrap');
if (wcasThemeSearchInStickyHeader !== null) {
wcasThemeSearchInStickyHeader.replaceWith(document.querySelector('#wcas-theme-search-sticky > div'));
}
document.querySelector('#wcas-theme-search-sticky').remove();
(function ($) {
$(window).on('load', function () {
$('.prd-search').on('click', function () {
// Autofocus
if ($(window).width() >= 1024) {
setTimeout(function () {
var $input = $('.search-wrapper .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
}, 500);
} else {
var $mobile = $('.search-wrapper .js-dgwt-wcas-enable-mobile-form');
if ($mobile.length > 0) {
$mobile.trigger('click');
}
}
});
});
}(jQuery));
</script>
<style>
.search-close {
float: none;
margin-bottom: 0;
position: absolute;
top: calc(50% - 10px);
right: -10px;
}
.search-wrapper .dgwt-wcas-search-wrapp {
max-width: none;
}
</style>
<?php
}
} );

View File

@@ -0,0 +1,41 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
function qwery_trx_addons_action_search( $args ) {
echo do_shortcode( '[fibosearch layout="icon"]' );
}
add_filter( 'dgwt/wcas/form/magnifier_ico', function ( $html, $class ) {
return '<span class="trx_addons_icon-search ' . $class . '"></span>';
}, 10, 2 );
add_action( 'wp_head', function () {
?>
<style>
.dgwt-wcas-search-icon {
width: 25px;
height: 25px;
margin-bottom: -9px;
}
.dgwt-wcas-search-icon > .dgwt-wcas-ico-magnifier-handler {
font-size: 24px;
}
.dgwt-wcas-search-icon > .dgwt-wcas-ico-magnifier-handler:before,
.dgwt-wcas-search-submit > .dgwt-wcas-ico-magnifier:before {
color: var(--theme-color-text_dark);
content: '\e9a6';
font-family: "fontello";
padding: 1px;
}
.dgwt-wcas-suggestion {
transition: none;
}
</style>
<?php
} );

View File

@@ -0,0 +1,64 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_footer', function () {
echo '<div id="wcas-search-instance" style="display: block;">' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="1024" ]' ) . '</div>';
echo '<div id="wcas-search-icon-instance" style="display: block;">' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="1024" ]' ) . '</div>';
?>
<script>
var themeSearch = document.querySelector('#main_header .head_search');
if (themeSearch !== null) {
themeSearch.innerHTML = '';
themeSearch.append(document.querySelector('#wcas-search-instance > div'))
}
document.querySelector('#wcas-search-instance').remove();
var themeSearchPopup = document.querySelector('.search-header-contents');
if (themeSearchPopup !== null) {
themeSearchPopup.innerHTML = '';
themeSearchPopup.append(document.querySelector('#wcas-search-icon-instance > div'));
}
document.querySelector('#wcas-search-icon-instance').remove();
(function ($) {
$(window).on('load', function () {
$('.icon-search-onclick').on('click', function () {
// Autofocus
if ($(window).width() >= 1024) {
setTimeout(function () {
var $input = $('.search-header-contents .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
}, 500);
} else {
var $mobile = $('.search-header-contents .js-dgwt-wcas-enable-mobile-form');
if ($mobile.length > 0) {
$mobile.trigger('click');
// Support for new version of search popup (version >= v16.2)
if (document.querySelector('#rhSplashSearch') !== null) {
setTimeout(function () {
document.getElementById('rhSplashSearch').classList.remove('top-search-onclick-open');
document.querySelector('.rh-outer-wrap').classList.remove('rh-outer-wrap-move');
}, 100);
}
}
}
});
});
}(jQuery));
</script>
<style>
/* Fix for iPhone sticky header */
@media (max-width: 1024px) {
.sticky-wrapper.re-stickyheader .rh-stickme {
width: 100% !important;
}
}
</style>
<?php
}, 15 );

View File

@@ -0,0 +1,8 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
echo do_shortcode('[wcas-search-form layout="classic"]');

View File

@@ -0,0 +1,106 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_footer', function () {
if ( ! function_exists( 'get_nectar_theme_options' ) ) {
return;
}
$nectar_options = get_nectar_theme_options();
// Skin: 'original', 'material' or 'ascend'
$theme_skin = ( ! empty( $nectar_options['theme-skin'] ) ) ? $nectar_options['theme-skin'] : 'original';
$hint = '';
if ( $theme_skin === 'material' ) {
$hint = '<span>' . esc_html__( 'Hit enter to search or ESC to close', 'salient' ) . '</span>';
}
echo '<div id="wcas-search-instance" style="display: block;"><div>' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="1000" ]' ) . $hint . '</div></div>';
?>
<script>
(function ($) {
var searchBtn = $('#header-outer #search-btn a');
// Replace search form
$(window).on('load', function () {
var themeSearch = $('#search .inner-wrap > div');
var wcasSearch = $('#wcas-search-instance > div');
if (wcasSearch.length === 0) {
return;
}
if (themeSearch.eq(0)) {
themeSearch.html(wcasSearch);
}
$('#wcas-search-instance').remove();
});
// Autofocus
if ($(window).width() >= 1000) {
searchBtn.on('click', function () {
setTimeout(function () {
var $input = $('#search .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
}, 500)
});
$('body:not(.material) #search-box').on('blur', '.dgwt-wcas-search-input', function () {
$('#search-outer').stop(true).fadeOut(450, 'easeOutExpo');
searchBtn.removeClass('open-search');
});
}
// Mobile search
if ($(window).width() < 1000) {
setTimeout(function () {
var mobileSearchBtn = $('#header-outer .mobile-search');
mobileSearchBtn.addClass('open-search');
mobileSearchBtn.on('click', function () {
var $handler = $('#search .inner-wrap .js-dgwt-wcas-enable-mobile-form');
if ($handler.length) {
$handler[0].click();
}
});
}, 1000);
}
}(jQuery));
</script>
<?php
} );
add_action( 'wp_head', function () {
if ( ! function_exists( 'get_nectar_theme_options' ) ) {
return;
}
$nectar_options = get_nectar_theme_options();
// Skin: 'original', 'material' or 'ascend'
$theme_skin = ( ! empty( $nectar_options['theme-skin'] ) ) ? $nectar_options['theme-skin'] : 'original';
?>
<style>
#search #close {
display: none;
}
#search-outer #search .span_12 span {
max-width: 600px;
margin: 0 auto;
}
#search .dgwt-wcas-search-input:focus,
.dgwt-wcas-overlay-mobile input[id^="dgwt-wcas-search-input"]:focus {
border-color: #ddd;
background-color: #ffffff !important;
}
<?php if ($theme_skin === 'ascend') { ?>
#search-box {
top: 25%;
-webkit-transform: translateY(-25%);
transform: translateY(-25%);
}
<?php } ?>
</style>
<?php
} );

View File

@@ -0,0 +1,38 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_head', function () {
global $nm_theme_options;
?>
<style>
.nm-shop-search-input-wrap .dgwt-wcas-search-wrapp {
max-width: 100%;
}
.nm-menu-search .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon {
padding: 16px 12px 16px 0;
margin-left: 12px;
}
.nm-menu-search .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler {
max-width: 16px;
}
<?php if (isset($nm_theme_options['header_navigation_highlight_color'])) { ?>
.nm-menu-search .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler {
fill: <?php echo esc_attr( $nm_theme_options['header_navigation_color'] ); ?>
}
<?php }
if (isset($nm_theme_options['header_navigation_highlight_color'])) { ?>
.nm-menu-search .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler:hover {
fill: <?php echo esc_attr( $nm_theme_options['header_navigation_highlight_color'] ); ?>
}
<?php } ?>
</style>
<?php
} );

View File

@@ -0,0 +1,17 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
?>
<div id="nm-shop-search">
<div class="nm-row">
<div class="col-xs-12">
<div class="nm-shop-search-inner">
<div class="nm-shop-search-input-wrap">
<?php echo do_shortcode( '[wcas-search-form]' ); ?>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,48 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'init', function () {
remove_action( 'shop_isle_header', 'shop_isle_primary_navigation', 50 );
} );
add_action( 'shop_isle_header', function () {
if ( function_exists( 'shop_isle_primary_navigation' ) ) {
ob_start();
shop_isle_primary_navigation();
$html = ob_get_clean();
// https://regex101.com/r/AvkuEr/1/
$re = '/(.*<div class="header-search">)(.*<\/form>\s*<\/div>\s*)(<\/div>.*)/s';
$subst = '$1' . do_shortcode( '[wcas-search-form layout="icon"]' ) . '$3';
echo preg_replace( $re, $subst, $html );
}
}, 60 );
add_action( 'wp_footer', function () {
$menuItemsColor = empty( get_theme_mod( 'shop_isle_menu_items_color' ) ) ? '#cbc7c2' : get_theme_mod( 'shop_isle_menu_items_color' );
$menuItemsHoverColor = empty( get_theme_mod( 'shop_isle_menu_items_hover_color' ) ) ? '#ffffff' : get_theme_mod( 'shop_isle_menu_items_hover_color' );
?>
<style>
.dgwt-wcas-ico-magnifier-handler {
max-width: 16px;
margin-top: 3px;
}
.dgwt-wcas-search-icon path {
fill: <?php echo esc_attr($menuItemsColor); ?>;
max-width: 16px;
margin-top: 4px;
}
.dgwt-wcas-search-icon:hover path {
fill: <?php echo esc_attr($menuItemsHoverColor); ?>;
}
.dgwt-wcas-is-mobile .dgwt-wcas-ico-magnifier-handler {
max-width: 20px;
}
</style>
<?php
} );

View File

@@ -0,0 +1,39 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
if ( ! function_exists( 'shopical_product_search_form' ) ) {
function shopical_product_search_form() {
echo do_shortcode( '[wcas-search-form]' );
}
}
add_action( 'wp_footer', 'dgwt_wcas_shopical_mobile_search', 100 );
function dgwt_wcas_shopical_mobile_search() {
?>
<script>
(function ($) {
$(window).on('load', function () {
$('.open-search-form').off('click');
$(document).on('click', '.open-search-form', function (e) {
var $overlay = $(this).prev();
var $form = $overlay.find('.js-dgwt-wcas-enable-mobile-form');
if ($form.eq(0)) {
$form.trigger('click');
}
e.preventDefault();
});
});
}(jQuery));
</script>
<style>
.dgwt-wcas-overlay-mobile .dgwt-wcas-search-form {
padding: 0;
}
</style>
<?php
}

View File

@@ -0,0 +1,120 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
// Remove native form
add_action( 'init', function () {
remove_action( 'wp_loaded', 'shopkeeper_predictive_search', 100 );
} );
// Embed search bar
add_action( 'getbowtied_product_search', function () {
echo do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="767"]' );
} );
add_action( 'wp_head', function () {
?>
<style>
.site-search.off-canvas {
min-height: 100px;
}
.admin-bar .site-search.off-canvas {
min-height: 130px;
}
.site-search.off-canvas > .row {
margin-top: 30px;
}
.site-search.off-canvas p.search-text {
position: absolute;
top: 14px;
left: 20px;
}
.site-search-close {
position: absolute;
top: 5px;
right: 20px;
}
.site-search .dgwt-wcas-search-wrapp {
max-width: 800px;
}
.site-search .dgwt-wcas-search-input {
font-size: 20px;
border: none;
border-bottom: 1px solid #ccc;
}
@media (max-width: 1400px) {
.site-search .dgwt-wcas-search-wrapp {
max-width: 700px;
}
}
@media (max-width: 1250px) {
.site-search .dgwt-wcas-search-wrapp {
max-width: 500px;
}
}
@media (max-width: 1000px) {
.site-search.off-canvas p.search-text {
display: none;
}
.site-search .dgwt-wcas-search-wrapp {
max-width: calc(100% - 30px);
margin-left: 0;
}
}
@media (max-width: 768px) {
/*.site-search.off-canvas {*/
/* display: none;*/
/*}*/
}
</style>
<?php
} );
add_action( 'wp_footer', function () {
?>
<script>
(function ($) {
if ($(window).width() > 767) {
$('.search-button').on('click', function () {
var $input = $('.site-search .dgwt-wcas-search-input');
if ($input.length) {
setTimeout(function () {
$input.trigger('focus');
}, 500);
}
});
} else {
$('.search-button').on('click', function () {
var $mobileHandler = $('.site-search .js-dgwt-wcas-enable-mobile-form');
if ($mobileHandler.length) {
$mobileHandler[0].click();
setTimeout(function () {
if ($('.site-search-close button').length) {
$('.site-search-close button').trigger('click');
}
}, 500);
}
});
}
})(jQuery);
</script>
<?php
} );

View File

@@ -0,0 +1,54 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_filter( 'dgwt/wcas/form/magnifier_ico', function ( $html, $class ) {
if ( $class === 'dgwt-wcas-ico-magnifier-handler' ) {
$html = '<svg class="dgwt-wcas-ico-magnifier-handler" viewBox="0 0 20 20" id="search"><circle fill="none" stroke-width="2" stroke-miterlimit="10" cx="8.35" cy="8.35" r="6.5"></circle><path fill="none" stroke-width="2" stroke-miterlimit="10" d="M12.945 12.945l5.205 5.205"></path></svg>';
}
return $html;
}, 10, 2 );
add_action( 'wp_footer', function () {
echo '<div id="wcas-sober-mobile-search" style="display: none;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
echo '<div id="wcas-sober-search" style="display: block;">' . do_shortcode( '[wcas-search-form layout="icon"]' ) . '</div>';
?>
<script>
var soberSearch = document.querySelector('.menu-item-search a');
if (soberSearch !== null) {
soberSearch.replaceWith(document.querySelector('#wcas-sober-search > div'));
}
(function ($) {
$(window).on('load', function () {
var soberSearchMobile = $('#mobile-menu .search-form');
if (soberSearchMobile.eq(0)) {
soberSearchMobile.replaceWith($('#wcas-sober-mobile-search > div'));
}
});
}(jQuery));
</script>
<?php
} );
if ( ! function_exists( 'sober_search_modal' ) ) {
function sober_search_modal() {
}
}
add_action( 'wp_head', function () {
?>
<style>
#mobile-menu .dgwt-wcas-search-wrapp {
margin-bottom: 15px;
}
.menu-item-search .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-ico-magnifier-handler {
max-width: 18px;
}
</style>
<?php
} );

View File

@@ -0,0 +1,31 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_head', function () { ?>
<style>
.header-search-form {
display: none;
}
.dgwt-wcas-search-wrapp {
max-width: 100%;
}
</style>
<?php
} );
add_action( 'wp_footer', function () {
echo '<div id="wcas-theme-search" style="display: block;">' . do_shortcode( '[fibosearch layout="classic"]' ) . '</div>';
?>
<script>
wcasThemeSearch = document.querySelector('.header-search-form');
if (wcasThemeSearch !== null) {
wcasThemeSearch.replaceWith(document.querySelector('#wcas-theme-search > div'));
}
document.querySelector('#wcas-theme-search').remove();
</script>
<?php
} );

View File

@@ -0,0 +1,72 @@
<?php
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
if ( ! function_exists( 'storefront_product_search' ) ) {
function storefront_product_search() {
if ( storefront_is_woocommerce_activated() ) { ?>
<div class="site-search">
<?php echo do_shortcode( '[fibosearch]' ); ?>
</div>
<?php
}
}
}
add_action( 'wp_footer', function () {
if ( Helpers::isAMPEndpoint() ) {
?>
<style>
#page.search-mobile-active .storefront-handheld-footer-bar ul li.search .site-search {
bottom: 100%;
}
</style>
<?php
return;
}
?>
<style>
.dgwt-wcas-open .storefront-handheld-footer-bar,
.dgwt-wcas-focused .storefront-handheld-footer-bar {
display: none;
}
</style>
<script>
(function ($) {
$(window).on('load', function () {
$(document).on('click', '.storefront-handheld-footer-bar .search > a', function (e) {
var $wrapper = $(this).parent(),
$mobileHandler = $wrapper.find('.js-dgwt-wcas-enable-mobile-form');
$wrapper.removeClass('active');
if ($mobileHandler.length) {
$mobileHandler[0].click();
}
e.preventDefault();
});
});
}(jQuery));
</script>
<?php
}, 100 );
/**
* Toggle mobile search when AMP is active
*/
if ( ! function_exists( 'storefront_handheld_footer_bar_search' ) ) {
function storefront_handheld_footer_bar_search() {
if ( Helpers::isAMPEndpoint() ) {
echo '<a on="tap:page.toggleClass(class=\'search-mobile-active\')" href="javascript:void(0);">' . esc_attr__( 'Search', 'storefront' ) . '</a>';
} else {
echo '<a href="#">' . esc_attr__( 'Search', 'storefront' ) . '</a>';
}
storefront_product_search();
}
}

View File

@@ -0,0 +1,39 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
if ( ! function_exists( 'supro_extra_search' ) ) {
function supro_extra_search() {
$extras = supro_get_menu_extras();
if ( empty( $extras ) ) {
return;
}
if ( ! in_array( 'search', $extras ) ) {
return;
}
$form = do_shortcode( '[wcas-search-form layout="icon" mobile_overlay="1"]' );
echo sprintf(
'<li class="extra-menu-item menu-item-search">%s</li>',
$form
);
}
}
add_action( 'wp_footer', function () {
?>
<style>
.header-layout-1 .site-header .menu-extra.menu-extra-au .menu-item-search {
display: none;
}
.site-header .menu-extra.s-right .menu-item-search .dgwt-wcas-search-wrapp {
margin-top: -3px;
}
</style>
<?php
} );

View File

@@ -0,0 +1,8 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
echo do_shortcode('[wcas-search-form]');

View File

@@ -0,0 +1,272 @@
<?php
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'init', function () {
$headerSource = thegem_get_option( 'header_source', 'default' );
// Built-in Header.
if ( $headerSource === 'default' ) {
// Header Vertical
remove_filter( 'wp_nav_menu_items', 'thegem_menu_item_search', 10, 2 );
add_filter( 'wp_nav_menu_items', function ( $items, $args ) {
if ( $args->theme_location == 'primary' && ! thegem_get_option( 'hide_search_icon' ) ) {
$items .= '<li class="menu-item menu-item-search dgwt-wcas-thegem-menu-search">';
$items .= do_shortcode( '[fibosearch layout="icon"]' );
$items .= '</li>';
}
return $items;
}, 10, 2 );
// Header Fullwidth hamburger
remove_filter( 'wp_nav_menu_items', 'thegem_menu_item_hamburger_widget', 100, 2 );
add_action( 'thegem_before_nav_menu', function () {
if ( in_array( thegem_get_option( 'header_layout' ), array(
'perspective',
'fullwidth_hamburger',
'overlay'
) ) ) {
echo do_shortcode( '[fibosearch]' );
}
} );
// Perspective header
remove_filter( 'get_search_form', 'thegem_serch_form_vertical_header' );
add_action( 'thegem_perspective_menu_buttons', function () {
echo do_shortcode( '[fibosearch]' );
} );
// Remove the search bar from vertical header
add_filter( 'get_search_form', function ( $form ) {
if ( in_array( thegem_get_option( 'header_layout' ), array( 'fullwidth_hamburger', 'vertical' ) ) ) {
$form = '';
}
return $form;
}, 100 );
add_action( 'thegem_before_header', function () {
if ( ! in_array( thegem_get_option( 'header_layout' ), array( 'vertical' ) ) ) {
return;
}
$html = '<div class="dgwt-wcas-thegem-vertical-search">';
$html .= do_shortcode( '[fibosearch]' );
$html .= '</div>';
echo $html;
}, 20 );
// Force enable overlay for mobile search
add_filter( 'dgwt/wcas/settings/load_value/key=enable_mobile_overlay', function () {
return 'on';
} );
} else {
// Header Builder.
function dgwtWcasTheGemGetCustomCss( $atts, $uniqid ) {
$defaultAtts = [
'desktop_disable' => '',
'tablet_disable' => '',
'mobile_disable' => '',
];
if ( function_exists( 'thegem_templates_extra_options_extract' ) && function_exists( 'thegem_templates_design_options_extract' ) ) {
$defaultAtts = array_merge( thegem_templates_extra_options_extract(), thegem_templates_design_options_extract() );
}
$atts = wp_parse_args( $atts, $defaultAtts );
return thegem_templates_element_design_options( $uniqid, '.dgwt-wcas-search-wrapp', $atts );
}
add_shortcode( 'thegem_te_search_form', function ( $atts, $content, $shortcodeTag ) {
$uniqid = uniqid( 'thegem-custom-' ) . rand( 1, 9999 );
$customCss = dgwtWcasTheGemGetCustomCss( $atts, $uniqid );
$cssOutput = empty( $customCss ) ? '' : '<style>' . $customCss . '</style>';
return $cssOutput . do_shortcode( '[fibosearch layout="classic" class="' . $uniqid . '"]' );
} );
add_shortcode( 'thegem_te_search', function ( $atts, $content, $shortcodeTag ) {
$uniqid = uniqid( 'thegem-custom-' ) . rand( 1, 9999 );
$customCss = dgwtWcasTheGemGetCustomCss( $atts, $uniqid );
if ( isset( $atts['icon_size'] ) ) {
$customCss .= ".$uniqid .dgwt-wcas-ico-magnifier, .$uniqid .dgwt-wcas-ico-magnifier-handler{max-height:" . $atts['icon_size'] . "px;}";
}
if ( isset( $atts['icon_color_normal'] ) ) {
$customCss .= ".$uniqid .dgwt-wcas-ico-magnifier, .$uniqid .dgwt-wcas-ico-magnifier-handler{fill:" . $atts['icon_color_normal'] . ";}";
}
if ( isset( $atts['icon_color_hover'] ) ) {
$customCss .= ".$uniqid:hover .dgwt-wcas-ico-magnifier, .$uniqid:hover .dgwt-wcas-ico-magnifier-handler{fill:" . $atts['icon_color_hover'] . ";}";
}
$cssOutput = empty( $customCss ) ? '' : '<style>' . $customCss . '</style>';
return $cssOutput . do_shortcode( '[fibosearch layout="icon" class="' . $uniqid . '"]' );
} );
}
} );
/**
* Forcing our engine to run when WooCommerce >> Shop grid >> Layout Type is "Products Grid".
*/
add_filter( 'dgwt/wcas/helpers/is_search_query', function ( $enabled, $query ) {
if (
$query->get( 'post_type' ) &&
is_string( $query->get( 'post_type' ) ) &&
$query->get( 'post_type' ) === 'product' &&
is_string( $query->get( 's' ) ) &&
strlen( $query->get( 's' ) ) > 0 &&
Helpers::isRunningInsideFunction( 'thegem_extended_products_get_posts', 25 )
) {
$enabled = true;
}
return $enabled;
}, 10, 2 );
add_action( 'wp_head', function () {
$headerSource = thegem_get_option( 'header_source', 'default' );
$color = thegem_get_option( 'main_menu_level1_color' );
$colorHover = thegem_get_option( 'main_menu_level1_hover_color' );
$mobileColor = thegem_get_option( 'mobile_menu_level1_color' );
// Built-in Header.
if ( $headerSource === 'default' ) {
?>
<style>
.dgwt-wcas-thegem-menu-search .dgwt-wcas-search-wrapp {
margin-left: 10px;
margin-right: 10px;
}
.dgwt-wcas-thegem-menu-search .dgwt-wcas-ico-magnifier-handler {
max-width: 19px;
}
.dgwt-wcas-thegem-menu-search .dgwt-wcas-search-icon path {
fill: <?php echo $color; ?>;
}
.dgwt-wcas-thegem-menu-search .dgwt-wcas-search-icon:hover path {
fill: <?php echo $colorHover; ?>;
}
#primary-navigation.responsive .dgwt-wcas-thegem-menu-search .dgwt-wcas-search-icon path {
fill: <?php echo $mobileColor; ?>;
}
#primary-navigation.responsive .dgwt-wcas-thegem-menu-search {
padding: 16px 20px;
}
.header-layout-perspective > .dgwt-wcas-search-wrapp {
top: 30px;
position: absolute;
max-width: 600px;
left: 270px;
right: auto;
margin: 0 auto;
z-index: 10;
}
@media (max-width: 979px) {
.header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp,
.header-layout-perspective > .dgwt-wcas-search-wrapp {
max-width: 350px;
}
.header-style-vertical #site-header-wrapper .dgwt-wcas-thegem-vertical-search {
display: none;
}
}
@media (max-width: 769px) {
.header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp,
.header-layout-overlay .primary-navigation.responsive .overlay-menu-cell > .dgwt-wcas-search-wrapp,
.header-layout-perspective > .dgwt-wcas-search-wrapp {
display: none !important;
}
}
#page.vertical-header .dgwt-wcas-thegem-vertical-search {
margin-right: auto;
margin-left: auto;
padding-left: 21px;
padding-right: 21px;
}
.header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp {
top: 30px;
position: absolute;
left: 150px;
max-width: 600px;
-webkit-transition: all .3s, transform 1s;
transition: all .3s, transform 1s;
-webkit-transform: translateX(0);
transform: translateX(0);
}
@media (max-width: 979px) {
.header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp {
top: 12px;
}
}
.header-layout-fullwidth_hamburger #primary-navigation.hamburger-active > .dgwt-wcas-search-wrapp {
-moz-transform: translateX(-450px);
-webkit-transform: translateX(-450px);
transform: translateX(-450px);
}
.site-header.fixed .header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp,
.site-header.fixed .header-layout-perspective > .dgwt-wcas-search-wrapp {
top: 4px;
}
.site-header.fixed .header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp {
left: 80px;
}
@media (max-width: 979px) {
.header-layout-perspective > .dgwt-wcas-search-wrapp {
top: 10px;
}
}
@media (max-width: 1212px) and (min-width: 980px) {
.header-layout-perspective #perspective-menu-buttons {
padding-bottom: 30px;
}
.header-layout-perspective > .dgwt-wcas-search-wrapp {
top: 110px;
}
}
</style>
<?php
} else {
// Header Builder.
?>
<style>
.thegem-template-header .dgwt-wcas-search-wrapp.dgwt-wcas-layout-classic {
max-width: 300px;
margin: 0;
}
.thegem-template-header .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon {
max-width: 300px;
}
</style>
<?php
}
} );

View File

@@ -0,0 +1,117 @@
<?php
use DgoraWcas\Helpers;
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
/**
* Forcing our engine to run when WooCommerce >> Shop grid >> Layout Type is "Products Grid".
*/
add_filter( 'dgwt/wcas/helpers/is_search_query', function ( $enabled, $query ) {
if (
$query->get( 'post_type' ) &&
is_string( $query->get( 'post_type' ) ) &&
$query->get( 'post_type' ) === 'product' &&
is_string( $query->get( 's' ) ) &&
strlen( $query->get( 's' ) ) > 0 &&
Helpers::isRunningInsideFunction( 'thegem_extended_products_get_posts', 25 )
) {
$enabled = true;
}
return $enabled;
}, 10, 2 );
add_action( 'wp_head', function () { ?>
<style>
.dgwt-wcas-thegem-menu-search .minisearch {
width: 500px;
}
.header-layout-perspective > .dgwt-wcas-search-wrapp {
top: 30px;
position: absolute;
max-width: 600px;
left: 270px;
right: auto;
margin: 0 auto;
z-index: 10;
}
@media (max-width: 979px) {
.dgwt-wcas-thegem-menu-search .minisearch {
width: 100%;
}
.header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp,
.header-layout-perspective > .dgwt-wcas-search-wrapp {
max-width: 350px;
}
.header-style-vertical #site-header-wrapper .dgwt-wcas-thegem-vertical-search {
display: none;
}
}
@media (max-width: 769px) {
.header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp,
.header-layout-perspective > .dgwt-wcas-search-wrapp {
display: none;
}
}
#page.vertical-header .dgwt-wcas-thegem-vertical-search {
margin-right: auto;
margin-left: auto;
padding-left: 21px;
padding-right: 21px;
}
.header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp {
top: 30px;
position: absolute;
left: 50px;
max-width: 600px;
}
.site-header.fixed .header-layout-fullwidth_hamburger #primary-navigation > .dgwt-wcas-search-wrapp,
.site-header.fixed .header-layout-perspective > .dgwt-wcas-search-wrapp {
top: 8px;
}
body .header-layout-overlay #primary-menu.no-responsive.overlay-search-form-show.animated-minisearch > li.menu-item-search > .minisearch {
top: 0;
bottom: auto;
}
</style>
<?php
} );
add_action( 'wp_footer', function () { ?>
<script>
(function ($) {
$('.header-layout-overlay .dgwt-wcas-thegem-menu-search').on('click', function () {
var $searchHandler = $(this).find('.js-dgwt-wcas-enable-mobile-form');
if ($searchHandler.length) {
$searchHandler[0].click();
}
});
$('.dgwt-wcas-thegem-menu-search').on('click', function () {
var $input = $(this).find('.dgwt-wcas-search-input');
if ($input.length) {
setTimeout(function () {
$input.trigger('focus');
}, 300);
}
});
})(jQuery);
</script>
<?php
} );

View File

@@ -0,0 +1,91 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
/**
* Default search
*/
add_action( 'wp_footer', function () {
echo '<div id="wcas-theme-search" style="display: block;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
?>
<script>
var wcasThemeSearch = document.querySelector('.main-header #search-box form');
if (wcasThemeSearch !== null) {
wcasThemeSearch.replaceWith(document.querySelector('#wcas-theme-search > div'));
}
document.querySelector('#wcas-theme-search').remove();
</script>
<style>
.main-header .dgwt-wcas-search-wrapp {
max-width: 800px;
}
.main-header .dgwt-wcas-search-form {
width: 100% !important;
margin: 0 !important;
}
</style>
<?php
} );
/**
* Search in sticky header
*/
add_action( 'wp_footer', function () {
if ( get_theme_mod( 'top_store_pro_sticky_header', false ) === false && get_theme_mod( 'top_store_sticky_header', false ) === false ) {
return;
}
echo '<div id="wcas-theme-search-sticky" style="display: block;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
?>
<script>
var wcasThemeSearchSticky = document.querySelector('.search-wrapper #search-box form');
if (wcasThemeSearchSticky !== null) {
wcasThemeSearchSticky.replaceWith(document.querySelector('#wcas-theme-search-sticky > div'));
}
document.querySelector('#wcas-theme-search-sticky').remove();
(function ($) {
$(document).on('click', '.prd-search', function (e) {
if ($(window).width() <= 990) {
var $handler = $('.search-wrapper .js-dgwt-wcas-enable-mobile-form');
if ($handler.length) {
$handler[0].click();
}
setTimeout(function () {
var $closeBtn = $('.search-wrapper .search-close-btn');
if ($closeBtn.length) {
$closeBtn[0].click();
}
}, 1100)
} else {
setTimeout(function () {
var $input = $('.search-wrapper .dgwt-wcas-search-input');
if ($input.length > 0) {
$input.trigger('focus');
}
}, 500);
}
});
}(jQuery));
</script>
<style>
.search-wrapper .container {
display: flex;
justify-content: center;
flex-direction: row-reverse;
align-items: center;
}
.search-wrapper .search-close {
margin: 0 0 0 30px;
}
.search-wrapper .dgwt-wcas-search-form {
min-width: 500px;
}
</style>
<?php
} );

View File

@@ -0,0 +1,149 @@
<?php
use TotalTheme\Header\Core as Header;
use TotalTheme\Header\Menu\Search;
use TotalTheme\Mobile\Menu as Mobile_Menu;
// Exit if accessed directly.
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
// Remove search icon from theme.
add_action( 'init', function () {
remove_filter( 'wp_nav_menu_items', 'TotalTheme\Header\Menu\Search::insert_icon', 11, 2 );
// Override theme shortcodes (used in Flex headers).
add_shortcode( 'header_search_icon', function () {
return do_shortcode( '[fibosearch layout="icon" class="wpex-ml-20"]' );
} );
add_shortcode( 'searchform', function () {
return do_shortcode( '[fibosearch layout="classic" class="wpex-ml-20"]' );
} );
} );
add_filter( 'dgwt/wcas/scripts/mobile_overlay_breakpoint', function () {
return Mobile_Menu::breakpoint();
} );
add_filter( 'wp_nav_menu_items', function ( $items, $args ) {
// The following code is partly from TotalTheme\Header\Menu\Search::insert_icon().
if ( Header::has_flex_container() || ! Search::is_enabled() ) {
return $items;
}
$search_icon_theme_locations = (array) apply_filters( 'wpex_menu_search_icon_theme_locations', [ 'main_menu' ] );
if ( ! in_array( $args->theme_location, $search_icon_theme_locations ) ) {
return $items;
}
$liClasses = 'dgwt-wcas-search-menu-item search-toggle-li menu-item wpex-menu-extra';
$menuSearch = '<li class="' . esc_attr( $liClasses ) . '">';
if ( Header::style() === 'six' ) {
$menuSearch .= do_shortcode( '[fibosearch layout="classic"]' );
} else {
$menuSearch .= do_shortcode( '[fibosearch layout="icon"]' );
}
$menuSearch .= '</li>';
/**
* Filters the header menu search icon position.
*
* @param $position | options: start or end.
*/
$menuSearchPosition = apply_filters( 'wpex_header_menu_search_position', 'end' );
switch ( $menuSearchPosition ) {
case 'start':
$items = $menuSearch . $items;
break;
case 'end':
default;
$items = $items . $menuSearch;
break;
}
return $items;
}, 11, 2 );
add_action( 'wp_head', function () {
$iconSize = get_theme_mod( 'menu_search_icon_size' );
if ( empty( $iconSize ) ) {
$iconSize = '14px';
}
?>
<style>
.navbar-fixed-line-height .main-navigation-ul > .menu-item > .dgwt-wcas-search-wrapp {
height: var(--wpex-main-nav-height, 50px);
line-height: var(--wpex-main-nav-line-height, var(--wpex-main-nav-height, 50px));
}
.dgwt-wcas-ico-magnifier, .dgwt-wcas-ico-magnifier-handler {
max-width: none;
max-height: <?php echo esc_attr($iconSize); ?>;
fill: var(--wpex-main-nav-link-color, var(--wpex-text-2));
}
.dgwt-wcas-search-menu-item:hover .dgwt-wcas-ico-magnifier,
.dgwt-wcas-search-menu-item:hover .dgwt-wcas-ico-magnifier-handler,
#site-header-flex-aside .dgwt-wcas-ico-magnifier:hover,
#site-header-flex-aside .dgwt-wcas-ico-magnifier-handler:hover {
fill: var(--wpex-hover-main-nav-link-color, var(--wpex-accent, var(--wpex-main-nav-link-color, var(--wpex-text-2))));
}
.main-navigation-ul > .dgwt-wcas-search-menu-item {
padding-left: var(--wpex-main-nav-link-padding-x, 0px);
padding-right: var(--wpex-main-nav-link-padding-x, 0px);
}
#site-header-flex-aside-inner .dgwt-wcas-search-wrapp.dgwt-wcas-layout-classic {
max-width: 200px;
}
</style>
<?php
} );
add_action( 'wp_footer', function () {
$style = Mobile_Menu::style();
if ( $style === 'sidr' ) {
// Mobile Menu Style: Sidebar.
// We use the default search input, after clicking which we open our overlay.
?>
<script>
(function ($) {
$(document).on('focus', '#sidr-main input[type="search"]', function () {
var $input = $('.js-dgwt-wcas-enable-mobile-form');
if ($input.length > 0) {
$input[0].click();
}
});
}(jQuery));
</script>
<?php
} else {
echo '<div id="wcas-mobile-search" style="display: none;">' . do_shortcode( '[fibosearch layout="classic"]' ) . '</div>';
?>
<script>
var mobileSearch = document.querySelector('#mobile-menu-search');
if (mobileSearch !== null) {
mobileSearch.replaceWith(document.querySelector('#wcas-mobile-search > div'));
}
document.querySelector('#wcas-mobile-search').remove();
</script>
<?php
}
if ( Header::style() === 'two' ) {
// Header style: 2. Bottom Menu
echo '<div id="wcas-desktop-search" style="display: none;"><div class="wpex-clr">' . do_shortcode( '[fibosearch layout="classic"]' ) . '</div></div>';
?>
<script>
var desktopSearch = document.querySelector('#header-two-search');
if (desktopSearch !== null) {
desktopSearch.replaceWith(document.querySelector('#wcas-desktop-search > div'));
}
document.querySelector('#wcas-desktop-search').remove()
</script>
<?php
}
} );

View File

@@ -0,0 +1,57 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
// Force the theme to use the default $wp_query on the search page.
add_filter( 'uncode_use_legacy_search_query', '__return_true' );
add_action( 'wp_footer', function () {
echo '<div id="wcas-desktop-search" style="display: none;">' . do_shortcode( '[wcas-search-form layout="icon"]' ) . '</div>';
echo '<div id="wcas-mobile-search" style="display: none;">' . do_shortcode( '[wcas-search-form layout="icon"]' ) . '</div>';
?>
<script>
var desktopSearch = document.querySelector('.menu-wrapper a.search-icon');
if (desktopSearch !== null) {
desktopSearch.replaceWith(document.querySelector('#wcas-desktop-search > div'));
}
document.querySelector('#wcas-desktop-search').remove()
var mobileSearch = document.querySelector('.menu-wrapper a.mobile-search-icon');
if (mobileSearch !== null) {
mobileSearch.replaceWith(document.querySelector('#wcas-mobile-search > div'));
}
document.querySelector('#wcas-mobile-search').remove();
</script>
<style>
.menu-icons .dgwt-wcas-search-wrapp {
margin-right: 9px;
}
.dgwt-wcas-ico-magnifier-handler {
max-width: 18px;
}
.dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input {
border-color: #ddd !important;
}
.menu-dark .dgwt-wcas-search-icon path {
fill: #ffffff;
}
.menu-dark .dgwt-wcas-search-icon:hover path {
fill: rgba(255, 255, 255, 0.5);
}
@media (max-width: 959px) {
.menu-icons .dgwt-wcas-search-wrapp {
padding: 9px 36px 9px 36px;
max-width: none;
}
}
</style>
<?php
} );

View File

@@ -0,0 +1,32 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
if ( ! function_exists( 'webshop_header_search_markup' ) ) {
function webshop_header_search_markup() {
?>
<div class="ws-header-search">
<?php echo do_shortcode( '[fibosearch]' ); ?>
</div>
<?php
}
add_action( 'webshop_header_search', 'webshop_header_search_markup' );
}
add_action( 'wp_head', function () {
?>
<style>
.ws-header-search .dgwt-wcas-search-wrapp {
max-width: 100%;
}
.ws-header-search .dgwt-wcas-sf-wrapp input[type=search].dgwt-wcas-search-input {
font-size: 16px;
height: 50px;
}
</style>
<?php
} );

View File

@@ -0,0 +1,12 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
if ( ! function_exists( 'woodmart_search_form' ) ) {
function woodmart_search_form( $args = array() ) {
echo do_shortcode( '[wcas-search-form]' );
}
}

View File

@@ -0,0 +1,73 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
if ( ! function_exists( 'woostify_search' ) ) {
// Function used to generate search form in sidebar.
function woostify_search() {
if ( ! function_exists( 'woostify_options' ) ) {
return;
}
$options = woostify_options( false );
if ( ! $options['header_search_icon'] ) {
return;
}
$isHide = $options['mobile_menu_hide_search_field'];
?>
<div class="site-search <?php echo $isHide ? esc_attr( 'hide' ) : ''; ?>">
<?php echo do_shortcode( '[fibosearch]' ); ?>
</div>
<?php
}
}
add_action( 'init', function () {
// When we remove the popups, there is no "click" event on the magnifier icon.
remove_action( 'woostify_after_footer', 'woostify_dialog_search', 30 );
remove_action( 'elementor/page_templates/canvas/after_content', 'woostify_dialog_search', 50 );
} );
add_action( 'wp_footer', function () {
if ( ! function_exists( 'woostify_options' ) ) {
return;
}
$options = woostify_options( false );
// Desktop search.
echo '<div id="dgwt-wcas-desktop-search" style="display: none;">' . do_shortcode( '[fibosearch layout="icon"]' ) . '</div>';
?>
<script>
var desktopSearch = document.querySelector('.header-search-icon .icon-search');
if (desktopSearch !== null) {
desktopSearch.replaceWith(document.querySelector('#dgwt-wcas-desktop-search > div'));
}
document.querySelector('#dgwt-wcas-desktop-search').remove();
</script>
<style>
.site-header .header-search-icon .dgwt-wcas-search-icon {
width: 24px;
margin-bottom: 2px;
}
.site-header .header-search-icon .dgwt-wcas-ico-magnifier-handler {
max-width: 24px;
}
</style>
<?php
// Mobile sticky footer search.
if ( isset( $options['sticky_footer_bar_enable'] ) && $options['sticky_footer_bar_enable'] ) {
echo '<div id="dgwt-wcas-mobile-sticky-footer-search" style="display: none;">' . do_shortcode( '[fibosearch layout="icon"]' ) . '</div>';
?>
<script>
var mobileStickyFooterSearch = document.querySelector('.woostify-item-list .header-search-icon');
if (mobileStickyFooterSearch !== null) {
mobileStickyFooterSearch.replaceWith(document.querySelector('#dgwt-wcas-mobile-sticky-footer-search > div'));
}
document.querySelector('#dgwt-wcas-mobile-sticky-footer-search').remove();
</script>
<?php
}
} );

View File

@@ -0,0 +1,123 @@
<?php
// Exit if accessed directly
if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
exit;
}
add_action( 'wp_head', function () {
?>
<style>
.et_b_header-search > form {
display: none;
}
</style>
<?php
} );
add_action( 'wp_footer', function () {
$search_type_desktop = get_theme_mod( 'search_type_et-desktop', 'input' );
$top_header_color_desktop = get_theme_mod( 'top_header_color_et-desktop', '#ffffff' );
$search_type_mobile = get_theme_mod( 'search_type_et-mobile', 'icon' );
$top_header_color_mobile = get_theme_mod( 'top_header_color_et-mobile', '#ffffff' );
if ( $search_type_desktop === 'input' ) {
echo '<div id="wcas-desktop-search" style="display: none;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
?>
<script>
var desktopSearch = document.querySelector('.header-wrapper .et_b_header-search > form');
if (desktopSearch !== null) {
desktopSearch.replaceWith(document.querySelector('#wcas-desktop-search > div'));
}
document.querySelector('#wcas-desktop-search').remove()
</script>
<style>
.header-wrapper .dgwt-wcas-search-wrapp {
max-width: none;
}
</style>
<?php
} elseif ( $search_type_desktop === 'icon' ) {
echo '<div id="wcas-desktop-search" style="display: none;">' . do_shortcode( '[wcas-search-form layout="icon"]' ) . '</div>';
?>
<script>
var desktopSearch = document.querySelector('.header-wrapper .et_b_header-search > .et_b_search-icon');
if (desktopSearch !== null) {
desktopSearch.replaceWith(document.querySelector('#wcas-desktop-search > div'));
}
document.querySelector('#wcas-desktop-search').remove();
</script>
<style>
.header-wrapper .et_b_header-search .dgwt-wcas-ico-magnifier-handler {
max-width: 18px;
width: 1.5em !important;
height: 1.5em !important;
}
.header-wrapper .dgwt-wcas-search-icon path {
fill: <?php echo $top_header_color_desktop; ?>;
}
.header-wrapper .dgwt-wcas-search-icon:hover path {
fill: <?php echo $top_header_color_desktop; ?>;
}
</style>
<?php
}
if ( $search_type_mobile === 'input' ) {
echo '<div id="wcas-mobile-search" style="display: none;">' . do_shortcode( '[wcas-search-form]' ) . '</div>';
?>
<script>
var mobileSearch = document.querySelector('.mobile-header-wrapper .et_b_header-search > form');
if (mobileSearch !== null) {
mobileSearch.replaceWith(document.querySelector('#wcas-mobile-search > div'));
}
document.querySelector('#wcas-mobile-search').remove();
</script>
<?php
} elseif ( $search_type_mobile === 'icon' ) {
echo '<div id="wcas-mobile-search" style="display: none;">' . do_shortcode( '[wcas-search-form layout="icon"]' ) . '</div>';
?>
<script>
var mobileSearch = document.querySelector('.mobile-header-wrapper .et_b_header-search > .et_b_search-icon');
if (mobileSearch !== null) {
mobileSearch.replaceWith(document.querySelector('#wcas-mobile-search > div'));
}
document.querySelector('#wcas-mobile-search').remove();
</script>
<style>
.mobile-header-wrapper .dgwt-wcas-search-wrapp {
max-width: 30px !important;
min-width: 30px;
}
.mobile-header-wrapper .et_b_header-search .dgwt-wcas-ico-magnifier-handler {
max-width: 18px;
width: 1.5em !important;
height: 1.5em !important;
}
.mobile-header-wrapper .dgwt-wcas-search-icon path {
fill: <?php echo $top_header_color_mobile; ?>;
}
.mobile-header-wrapper .dgwt-wcas-search-icon:hover path {
fill: <?php echo $top_header_color_mobile; ?>;
}
</style>
<?php
}
?>
<script>
(function ($) {
$('.et-mobile-panel-wrapper .et_b_mobile-panel-search').on('click', function () {
var $searchHandler = $(document).find('.js-dgwt-wcas-enable-mobile-form');
if ($searchHandler.length) {
$searchHandler[0].click();
}
});
})(jQuery);
</script>
<?php
} );