Sleeveless shirt in soft and light cotton and viscose blend fabric. Classic collar, front buttoning and breast pocket applique. Knot on the bottom. Modern and trendy.
/** * Get products based on search query with merchant filtering */ private function get_search_products($atts) { global $wpdb; $search_term = $atts['search']; $search_mode = isset($atts['search_mode']) ? $atts['search_mode'] : 'comprehensive'; $product_ids = array(); // Mode 1: Basic WordPress search (fastest but limited) if ($search_mode === 'basic') { $args = array( 'post_type' => 'product', 'post_status' => 'publish', 's' => $search_term, 'posts_per_page' => -1, 'fields' => 'ids' ); $query = new WP_Query($args); $product_ids = $query->posts; } // Mode 2: Title only search using LIKE elseif ($search_mode === 'title_only') { $product_ids = $wpdb->get_col($wpdb->prepare(" SELECT ID FROM {$wpdb->posts} WHERE post_type = 'product' AND post_status = 'publish' AND post_title LIKE %s ", '%' . $wpdb->esc_like($search_term) . '%')); } // Mode 3: Comprehensive search (default) else { // Direct SQL search for maximum compatibility $search_like = '%' . $wpdb->esc_like($search_term) . '%'; // Search in titles and content $title_content_ids = $wpdb->get_col($wpdb->prepare(" SELECT ID FROM {$wpdb->posts} WHERE post_type = 'product' AND post_status = 'publish' AND (post_title LIKE %s OR post_content LIKE %s OR post_excerpt LIKE %s) ", $search_like, $search_like, $search_like)); if (!empty($title_content_ids)) { $product_ids = array_merge($product_ids, $title_content_ids); } // Search by SKU $sku_ids = $wpdb->get_col($wpdb->prepare(" SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_sku' AND meta_value LIKE %s ", $search_like)); if (!empty($sku_ids)) { $product_ids = array_merge($product_ids, $sku_ids); } // Search in product categories $cat_ids = $wpdb->get_col($wpdb->prepare(" SELECT tr.object_id FROM {$wpdb->term_relationships} tr JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id JOIN {$wpdb->terms} t ON tt.term_id = t.term_id WHERE tt.taxonomy = 'product_cat' AND t.name LIKE %s ", $search_like)); if (!empty($cat_ids)) { $product_ids = array_merge($product_ids, $cat_ids); } } // Remove duplicates $product_ids = array_unique($product_ids); if (empty($product_ids)) { return array(); } // Filter out hidden products $visible_product_ids = array(); foreach ($product_ids as $product_id) { $product = wc_get_product($product_id); if ($product && $product->is_visible()) { $visible_product
Sleeveless shirt in soft and light cotton and viscose blend fabric. Classic collar, front buttoning and breast pocket applique. Knot on the bottom. Modern and trendy.
Reviews
There are no reviews yet.