YITH Ajax Search - Flatsom Compatibility
<?php
/**
* YITH WooCommerce Ajax Search template
*
* @author Your Inspiration Themes
* @package YITH WooCommerce Ajax Search
* @version 1.0.0
*/
if ( !defined( 'YITH_WCAS' ) ) { exit; } // Exit if accessed directly
//wp_enqueue_script('yith_wcas_jquery-autocomplete' );
if( defined( 'YITH_WCAS_PREMIUM' ) ) {
wp_enqueue_script('yith_wcas_frontend' );
}
$research_post_type = ( get_option('yith_wcas_default_research') ) ? get_option('yith_wcas_default_research') : 'product';
$rand_id = rand();
?>
<div class="row yith-search-premium collapse search-wrapper yith-ajaxsearchform-container yith-ajaxsearchform-container <?php echo $rand_id; ?>_container">
<form role="search" method="get" class="yith-search-premium" id="yith-ajaxsearchform" action="<?php echo esc_url( home_url( '/' ) ) ?>">
<div class="yith-ajaxsearchform-select">
<?php
if ( get_option( 'yith_wcas_show_search_list' ) == 'yes' ):
$selected_search = ( isset( $_REQUEST['post_type'] ) ) ? $_REQUEST['post_type'] : $research_post_type; ?>
<select class="yit_wcas_post_type selectbox" id="yit_wcas_post_type" name="post_type">
<option value="product" <?php selected( 'product', $selected_search ) ?>><?php _e( 'Products', 'yith-woocommerce-ajax-search' ) ?></option>
<option value="any" <?php selected( 'any', $selected_search ) ?>><?php _e( 'All', 'yith-woocommerce-ajax-search' ) ?></option>
</select>
<?php else: ?>
<input type="hidden" name="post_type" class="yit_wcas_post_type" id="yit_wcas_post_type" value="<?php echo $research_post_type ?>" />
<?php endif; ?>
<?php
if ( get_option( 'yith_wcas_show_category_list' ) == 'yes' ):
$product_categories = yith_wcas_get_shop_categories( get_option( 'yith_wcas_show_category_list_all' ) == 'all' );
$selected_category = ( isset( $_REQUEST['product_cat'] ) ) ? $_REQUEST['product_cat'] : '';
if ( !empty( $product_categories ) ) : ?>
<select class="search_categories selectbox" id="search_categories" name="product_cat">
<option value="" <?php selected( '', $selected_category ) ?>><?php _e( 'All', 'yith-woocommerce-ajax-search' ) ?></option>
<?php foreach ( $product_categories as $cat ): ?>
<option value="<?php echo $cat->slug ?>" <?php selected( $cat->slug, $selected_category ) ?>><?php echo $cat->name ?></option>
<?php endforeach; ?>
</select>
<?php endif ?>
<?php endif ?>
</div>
<div class="large-10 small-10 columns">
<input type="hidden" name="post_type" class="yit_wcas_post_type" id="yit_wcas_post_type" value="<?php echo $research_post_type ?>" />
<input type="search"
value="<?php echo get_search_query() ?>"
name="s"
id="<?php echo $rand_id; ?>_yith-s"
class="yith-s"
data-append-top
placeholder="<?php echo esc_attr( get_option('yith_wcas_search_input_label') ) ?>"
data-loader-icon="<?php echo esc_attr( str_replace( '"', '', apply_filters('yith_wcas_ajax_search_icon', '') ) ) ?>"
data-min-chars="<?php echo esc_attr( get_option('yith_wcas_min_chars') ); ?>" />
</div><!-- input -->
<div class="large-2 small-2 columns">
<button type="submit" id="yith-searchsubmit" class="button secondary postfix"><i class="icon-search"></i></button>
</div><!-- button -->
</form>
</div><!-- row -->
/* NEW HEADER STYLE */
#masthead #logo {
width: 190px;
height: auto;
}
#masthead .right-links {
width: 1px;
}
.wide-nav-search {
width: 100%;
display: block !important;
}
.wide-nav-search>div {
display: block;
vertical-align: initial;
padding-top: 0;
padding-left: 0;
}
#masthead .row {
height: 100%;
width: 100% !important;
}
.wide-nav-search form {
width: 100%;
display: table;
}
.wide-nav-search form > div {
display: table-cell;
vertical-align: middle;
margin: 0;
padding: 0;
float: none !important;
max-width: 100px;
}
.wide-nav-search form > div.yith-ajaxsearchform-select {
width: 100px;
}
.wide-nav-search form > div select {
margin: 0 !important;
}
select#yit_wcas_post_type {
display: none;
}
.wide-nav-search form > div input, .wide-nav-search form > div button {
height: 36px;
}