WPSolr logo
Search
Close this search box.

Forum Replies Created

  • Screenshot of results page when wpsolr is not installed the searched term is a product title.

    screenshot for search results –> https://prntscr.com/nlezvd

    The link contains screenshots of problem that I am facing.

    1-
    Can you please suggest which file controls the instant search result ? because I need to edit the html along with css

    2-
    I am using “use my own theme search template” but still its showing that screen see screenshot
    https://prntscr.com/nkbq4z

    5 years ago in reply to: WordPress Rest API #11999

    I 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"));
            }
        }
    
    5 years ago in reply to: WordPress Rest API #11997

    If we perform a search from wordpress rest API does this plugin return the search from elasticsearch index ?

    Like it replaced the default WP search

    5 years ago in reply to: WPSOLR: error on term #11993

    Indexing 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?

    5 years ago in reply to: WPSOLR: error on term #11991

    PSB

    WPSOLR: term 10733 for taxonomy strength has no name:

    5 years ago in reply to: WPSOLR: error on term #11988

    Nothing fruitful. The same “error on term” message is displayed.

    5 years ago in reply to: WPSOLR: error on term #11986

    if ( property_exists( $term_parent, ‘name’ ) ) {

    5 years ago in reply to: WPSOLR: error on term #11984

    Generating 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

    5 years ago in reply to: WPSOLR: error on term #11982

    https://pastebin.com/B6Vk3Xec

    please view and amend the code, It’s difficult for me to play with this code

    5 years ago in reply to: WPSOLR: error on term #11980

    I 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 );

    5 years ago in reply to: WPSOLR: error on term #11978

    Where should I add this code ?

    5 years ago in reply to: WPSOLR: error on term #11976

    I found that the error is arising from products that are not assigned to custom taxonomies

    screenshot of wpsolr index page
    https://prntscr.com/njy0kq

    Screenshot of database query
    https://prntscr.com/njy11p

    Screenshots of product
    https://prntscr.com/njy1ij
    https://prntscr.com/njy29q (taxonomy formula is unchecked)

    5 years ago in reply to: WPSOLR: error on term #11975

    Now 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 )

Viewing 15 posts - 31 through 45 (of 75 total)