<?php
defined('ABSPATH') || exit('No Access!');

global $options, $labels;
$product_cat_in_search = $options->get_option('product-cat-in-search');
?>
<div class="search-form-wrapper">
    <form class="search-form" method="get" action="<?php echo esc_url(home_url('/')); ?>">
        <input type="text" name="s" autocomplete="off" value="<?php echo isset($_GET['post_type']) && $_GET['post_type'] == 'product' ? get_search_query() : ''; ?>" placeholder="<?php echo esc_attr($labels->get_label('search-placeholder')); ?>" <?php echo $product_cat_in_search ? (is_rtl() ? 'style="padding-left:128px;"' : 'style="padding-right:128px;"') : null; ?>>
        <span class="reset" <?php echo !$product_cat_in_search ? (is_rtl() ? 'style="left:10px;"' : 'style="right:10px;"') : null; ?>></span>
        <input type="hidden" name="post_type" value="<?php echo esc_attr(irk_search_post_type()); ?>">
        <?php
        if ($product_cat_in_search) {
            wp_dropdown_categories(array(
                'taxonomy' => irk_search_tax(),
                'name' => '_cat',
                'show_option_all' => esc_html($labels->get_label('all-cat')),
                'hide_empty' => 0,
                'hierarchical' => 1,
                'selected' => isset($_GET['product_cat']) ? $_GET['product_cat'] : 0,
                'value_field' => 'slug',
                'class' => 'product-cat',
            ));
        }
        ?>
    </form>
    <div class="search-results"></div>
</div>