Example #1
0
 function sf_super_search($contained = "")
 {
     global $sf_options;
     $ss_enable = $sf_options['ss_enable'];
     if ($ss_enable) {
         global $sf_supersearchcount, $woocommerce;
         $ss_button_text = __($sf_options['ss_button_text'], 'swiftframework');
         $close_icon = apply_filters('sf_close_icon', '<i class="ss-delete"></i>');
         $count = 1;
         $super_search = $search_text = $shop_url = "";
         $shop_url = get_permalink(wc_get_page_id('shop'));
         if (sf_theme_supports('super-search-config')) {
             $search_config = $sf_options['ss_super_search_field'];
             foreach ($search_config as $search_field) {
                 $search_text .= '<span>' . $search_field['beforetext'] . '</span>';
                 $search_text .= sf_super_search_dropdown($count, $search_field['ss-filter'], $search_field['label']);
                 $search_text .= '<span>' . $search_field['aftertext'] . '</span>';
                 $count++;
             }
         } else {
             $field1_text = __($sf_options['field1_text'], 'swiftframework');
             $field1_filter = __($sf_options['field1_filter'], 'swiftframework');
             $field1_default_text = __($sf_options['field1_default_text'], 'swiftframework');
             $field2_text = __($sf_options['field2_text'], 'swiftframework');
             $field2_filter = __($sf_options['field2_filter'], 'swiftframework');
             $field2_default_text = __($sf_options['field2_default_text'], 'swiftframework');
             $field3_text = __($sf_options['field3_text'], 'swiftframework');
             $field3_filter = __($sf_options['field3_filter'], 'swiftframework');
             $field3_default_text = __($sf_options['field3_default_text'], 'swiftframework');
             $field4_text = __($sf_options['field4_text'], 'swiftframework');
             $field4_filter = __($sf_options['field4_filter'], 'swiftframework');
             $field4_default_text = __($sf_options['field4_default_text'], 'swiftframework');
             $field5_text = __($sf_options['field5_text'], 'swiftframework');
             $field5_filter = __($sf_options['field5_filter'], 'swiftframework');
             $field5_default_text = __($sf_options['field5_default_text'], 'swiftframework');
             $field6_text = __($sf_options['field6_text'], 'swiftframework');
             $field6_filter = __($sf_options['field6_filter'], 'swiftframework');
             $field6_default_text = __($sf_options['field6_default_text'], 'swiftframework');
             $ss_final_text = __($sf_options['ss_final_text'], 'swiftframework');
             if ($field1_text != "") {
                 $search_text .= '<span>' . $field1_text . '</span>';
                 $search_text .= sf_super_search_dropdown(1, $field1_filter, $field1_default_text);
             }
             if ($field2_text != "") {
                 $search_text .= '<span>' . $field2_text . '</span>';
                 $search_text .= sf_super_search_dropdown(2, $field2_filter, $field2_default_text);
             }
             if ($field3_text != "") {
                 $search_text .= '<span>' . $field3_text . '</span>';
                 $search_text .= sf_super_search_dropdown(3, $field3_filter, $field3_default_text);
             }
             if ($field4_text != "") {
                 $search_text .= '<span>' . $field4_text . '</span>';
                 $search_text .= sf_super_search_dropdown(4, $field4_filter, $field4_default_text);
             }
             if ($field5_text != "") {
                 $search_text .= '<span>' . $field5_text . '</span>';
                 $search_text .= sf_super_search_dropdown(5, $field5_filter, $field5_default_text);
             }
             if ($field6_text != "") {
                 $search_text .= '<span>' . $field6_text . '</span>';
                 $search_text .= sf_super_search_dropdown(6, $field6_filter, $field6_default_text);
             }
             $search_text .= '<span>' . $ss_final_text . '</span>';
         }
         if ($sf_supersearchcount == 0 || !$sf_supersearchcount) {
             $super_search .= '<div id="super-search" class="sf-super-search clearfix">';
         } else {
             $super_search .= '<div id="super-search-' . $sf_supersearchcount . '" class="sf-super-search clearfix">';
         }
         if ($contained) {
             $super_search .= '<div class="container">';
         }
         $super_search .= '<div class="search-options col-sm-9">';
         $super_search .= $search_text;
         $super_search .= '</div>';
         $super_search .= '<div class="search-go col-sm-3">';
         $super_search .= '<a href="#" class="super-search-go sf-button accent" data-home_url="' . get_home_url() . '" data-shop_url="' . $shop_url . '"><span class="text">' . $ss_button_text . '</span></a>';
         $super_search .= '<a class="super-search-close" href="#">' . $close_icon . '</a>';
         $super_search .= '</div>';
         if ($contained) {
             $super_search .= '</div>';
         }
         $super_search .= '</div><!-- close #super-search -->';
         if ($sf_supersearchcount >= 0) {
             $sf_supersearchcount++;
         } else {
             $sf_supersearchcount = 0;
         }
         return $super_search;
     }
 }
 function sf_super_search()
 {
     global $sf_supersearchcount, $woocommerce;
     $options = get_option('sf_dante_options');
     $ss_final_text = $options['ss_final_text'];
     $ss_button_text = $options['ss_button_text'];
     $field1_text = $options['field1_text'];
     $field1_filter = $options['field1_filter'];
     $field1_default_text = $options['field1_default_text'];
     $field2_text = $options['field2_text'];
     $field2_filter = $options['field2_filter'];
     $field2_default_text = $options['field2_default_text'];
     $field3_text = $options['field3_text'];
     $field3_filter = $options['field3_filter'];
     $field3_default_text = $options['field3_default_text'];
     $field4_text = $options['field4_text'];
     $field4_filter = $options['field4_filter'];
     $field4_default_text = $options['field4_default_text'];
     $field5_text = $options['field5_text'];
     $field5_filter = $options['field5_filter'];
     $field5_default_text = $options['field5_default_text'];
     $field6_text = $options['field6_text'];
     $field6_filter = $options['field6_filter'];
     $field6_default_text = $options['field6_default_text'];
     $super_search = $search_text = $shop_page_url = "";
     if (version_compare(WOOCOMMERCE_VERSION, "2.1.0") >= 0) {
         $shop_page_url = get_permalink(wc_get_page_id('shop'));
     } else {
         $shop_page_url = get_permalink(woocommerce_get_page_id('shop'));
     }
     $search_btn_text = $ss_button_text;
     if ($field1_text != "") {
         $search_text .= '<span>' . $field1_text . '</span>';
         $search_text .= sf_super_search_dropdown(1, $field1_filter, $field1_default_text);
     }
     if ($field2_text != "") {
         $search_text .= '<span>' . $field2_text . '</span>';
         $search_text .= sf_super_search_dropdown(2, $field2_filter, $field2_default_text);
     }
     if ($field3_text != "") {
         $search_text .= '<span>' . $field3_text . '</span>';
         $search_text .= sf_super_search_dropdown(3, $field3_filter, $field3_default_text);
     }
     if ($field4_text != "") {
         $search_text .= '<span>' . $field4_text . '</span>';
         $search_text .= sf_super_search_dropdown(4, $field4_filter, $field4_default_text);
     }
     if ($field5_text != "") {
         $search_text .= '<span>' . $field5_text . '</span>';
         $search_text .= sf_super_search_dropdown(5, $field5_filter, $field5_default_text);
     }
     if ($field6_text != "") {
         $search_text .= '<span>' . $field6_text . '</span>';
         $search_text .= sf_super_search_dropdown(6, $field6_filter, $field6_default_text);
     }
     $search_text .= '<span>' . $ss_final_text . '</span>';
     if ($sf_supersearchcount == 0 || !$sf_supersearchcount) {
         $super_search .= '<div id="super-search" class="sf-super-search">';
     } else {
         $super_search .= '<div id="super-search-' . $sf_supersearchcount . '" class="sf-super-search">';
     }
     $super_search .= '<div class="container">';
     $super_search .= '<div class="row">';
     $super_search .= '<div class="search-options col-sm-9">';
     $super_search .= $search_text;
     $super_search .= '</div>';
     $super_search .= '<div class="search-go col-sm-3">';
     $super_search .= '<a href="#" class="super-search-go sf-button accent" data-home_url="' . get_home_url() . '" data-shop_url="' . $shop_page_url . '"><span class="text">' . $search_btn_text . '</span></a>';
     $super_search .= '<a class="super-search-close" href="#"><i class="ss-delete"></i></a>';
     $super_search .= '</div>';
     $super_search .= '</div><!-- close .row -->';
     $super_search .= '</div><!-- close .container -->';
     $super_search .= '</div><!-- close #super-search -->';
     if ($sf_supersearchcount >= 0) {
         $sf_supersearchcount++;
     } else {
         $sf_supersearchcount = 0;
     }
     return $super_search;
 }