Forum Replies Created
- ovaislak@hotmail.comParticipant4 years, 12 months ago in reply to: Product found in instant search but not on search result page #12057
Screenshot of results page when wpsolr is not installed the searched term is a product title.
screenshot for search results –> https://prntscr.com/nlezvd
ovaislak@hotmail.comParticipant4 years, 12 months ago in reply to: Product found in instant search but not on search result page #12054The link contains screenshots of problem that I am facing.
ovaislak@hotmail.comParticipant5 years ago in reply to: styling default live search suggestions (how to style wp solr search results) #120081-
Can you please suggest which file controls the instant search result ? because I need to edit the html along with css2-
I am using “use my own theme search template” but still its showing that screen see screenshot
https://prntscr.com/nkbq4zovaislak@hotmail.comParticipant5 years ago in reply to: WordPress Rest API #11999I use this code for my search API we hit it using our mobile application
/** * Medicine Search * Get search results from WooCommerce * @group Open Web Services * @bodyParam q string Keywork for searching medicine. Example: para * @bodyParam paged int Page number for pagination. Example: 1 */ public function medicine_search(Request $request) { global $wpdb; $error_response = [ 'q' => $request->input('q') ?? "", 'paged' => $request->input('paged') ?? 1 ]; try { $validator = Validator::make($request->all(), [ 'q' => 'required' ],[ 'required' => 'The :attribute field is required.' ]); if ($validator->fails()) { return $this->api_error_syntax($validator->errors()->first(), $error_response); } $search_term = $request->input('q') ?? ""; $paged = $request->input('paged') ?? 1; $args = array( 'post_type' => 'product', 'post_status' => 'publish', 'stock' => 1, 'orderby' => 'date', 'posts_per_page' => 10, 'paged' => $paged, 'order' => 'DESC', 's' => $search_term, 'tax_query' => array( array( 'taxonomy' => 'product_visibility', 'field' => 'slug', 'terms' => 'exclude-from-catalog', 'operator' => 'NOT IN' ) ) ); $loop = new \WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); global $product; $product_id = $product->id; $terms = wp_get_post_terms( $product_id, 'Manufacturer' ); $on_brand = ''; if ( $terms && ! is_wp_error( $terms ) ) { $brand_links = array(); foreach ( $terms as $term ) { $brand_links[] = $term->name; } $on_brand = join( ", ", $brand_links ); } $on_category = ''; $categories = wp_get_post_terms( $product_id, 'product_cat' ); if ( $categories && ! is_wp_error( $categories ) ) { $categories_links = array(); foreach ( $categories as $category ) { $categories_links[] = $category->name; } $on_category = join( ", ", $categories_links ); } $category_output = $on_category; $product_arr['id'] = $product->id; $product_arr['name'] = $product->post->post_title; $product_arr['category'] = $category_output; $product_arr['brand'] = $on_brand; $image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' ); $product_arr['image'] = (isset($image[0])) ? $image[0] : ""; $price_html = $this->price_array($product->get_price_html()); $price_split = strip_tags($price_html); $price_split = str_replace(' '," ",$price_split); $price_split = str_replace('₨'," ",$price_split); $product_arr['price'] = trim($price_split); $product_arr['currency'] = get_option('woocommerce_currency'); $product_arr['content_html'] = $product->post->post_content; $product_arr['content'] = strip_tags($product->post->post_content); $product_arr['slug'] = $product->post->post_name; $products['products'][] = $product_arr; endwhile; wp_reset_query(); $products['pagination'] = array( "total_pages" => $loop->max_num_pages, "current_page" => $paged, "next_page" => (($paged + 1) <= $loop->max_num_pages) ? ($paged + 1) : "", "previous_page" => (($paged - 1) > 0) ? ($paged - 1) : "" ); return $this->api_response_syntax("Done",$products); } catch (\Exception $ex) { $this->log_error($ex,"medicine_search"); return $this->api_error_syntax(Lang::get("responses.error_in_connection")); } }
ovaislak@hotmail.comParticipant5 years ago in reply to: WordPress Rest API #11997If we perform a search from wordpress rest API does this plugin return the search from elasticsearch index ?
Like it replaced the default WP search
ovaislak@hotmail.comParticipant5 years ago in reply to: WPSOLR: error on term #11993Indexing completed, thanks for the fix.
Does this fix excludes products with the problem or it indexes them as well ?
If it excluded those products, is there a way to get the list of excluded products / products not in index?
ovaislak@hotmail.comParticipant5 years ago in reply to: WPSOLR: error on term #11991PSB
WPSOLR: term 10733 for taxonomy strength has no name:
ovaislak@hotmail.comParticipant5 years ago in reply to: WPSOLR: error on term #11988Nothing fruitful. The same “error on term” message is displayed.
ovaislak@hotmail.comParticipant5 years ago in reply to: WPSOLR: error on term #11986if ( property_exists( $term_parent, ‘name’ ) ) {
ovaislak@hotmail.comParticipant5 years ago in reply to: WPSOLR: error on term #11984Generating this error after indexing 50,001 products. I know i am taking too much of your time, but i want to make this plugin work for me
Error on line 313 of file /home/262510.cloudwaysapps.com/rusnfygwrz/public_html/wp-content/plugins/wpsolr-pro/wpsolr/core/classes/models/post/class-wpsolr-model-post.php: First parameter must either be an object or the name of an existing class
ovaislak@hotmail.comParticipant5 years ago in reply to: WPSOLR: error on term #11982please view and amend the code, It’s difficult for me to play with this code
ovaislak@hotmail.comParticipant5 years ago in reply to: WPSOLR: error on term #11980I think I placed the code wrongly
Error on line 313 of file /home/262510.cloudwaysapps.com/rusnfygwrz/public_html/wp-content/plugins/wpsolr-pro/wpsolr/core/classes/models/post/class-wpsolr-model-post.php: First parameter must either be an object or the name of an existing class
foreach ( $term_parents_ids as $term_parent_id ) {
$term_parent = get_term( $term_parent_id, $parent );if ( $term_parent instanceof \WP_Error ) {
throw new \Exception( sprintf( ‘WPSOLR: error on term %s for taxonomy \’%s\’: %s’, $term_parent_id, $parent, $term_parent->get_error_message() ) );
}if ( property_exists( $term_parent, ‘name’ ) ) {
array_push( $term_parents_names, $term_parent->name );
// Add the term to the non-flat hierarchy (for filter queries on all the hierarchy levels)
array_push( $taxonomy_non_flat_hierarchies, $term_parent->name );} else {
// Some taxonomies do not have the property name. Probably due to bad imports.throw new \Exception( sprintf( “WPSOLR: term %s for taxonomy %s has no name: %s”, $term_parent_id, $parent, print_r( $term_parent, true ) ) );
}
}// Add the term to the flat hierarchy
array_push( $taxonomy_flat_hierarchies, implode( WpSolrSchema::FACET_HIERARCHY_SEPARATOR, $term_parents_names ) );// Add the term to the taxonomy
array_push( $nm1_array, $term->name );ovaislak@hotmail.comParticipant5 years ago in reply to: WPSOLR: error on term #11978Where should I add this code ?
ovaislak@hotmail.comParticipant5 years ago in reply to: WPSOLR: error on term #11976I found that the error is arising from products that are not assigned to custom taxonomies
screenshot of wpsolr index page
https://prntscr.com/njy0kqScreenshot of database query
https://prntscr.com/njy11pScreenshots of product
https://prntscr.com/njy1ij
https://prntscr.com/njy29q (taxonomy formula is unchecked)ovaislak@hotmail.comParticipant5 years ago in reply to: WPSOLR: error on term #11975Now gives the following error while the term 531 has name Paracetamol
WPSOLR: term 531 for taxonomy formula has no name: WP_Term Object ( [term_id] => 531 [name] => Paracetamol [slug] => paracetamol [term_group] => 0 [term_taxonomy_id] => 531 [taxonomy] => formula [description] => [parent] => 0 [count] => 422 [filter] => raw )