WPSOLR: error on term

  • 4 years, 11 months ago #11963

    Got this error now

    WPSOLR: term 8680 for taxonomy packing has no name

    wpsolr
    Keymaster
    4 years, 11 months ago #11964

    Open your term 8680 in category ‘packing’. It probably has no name.

    It can come from imports that forgot to load names.

    4 years, 11 months ago #11965

    You are genius.

    I have deliberately left taxonomies empty for few products. Like a taxonomy prescription_required is not applicable to all products in my store.

    What should be done in this case ?

    wpsolr
    Keymaster
    4 years, 11 months ago #11966

    Add a name to each taxonomy terms manually, or by sql, or with a tool, or reimport with names.

    4 years, 11 months ago #11967

    sorry, I think I misunderstood your reply.

    I check the term 8680 in packings it has name assigned to it. To verify further I checked the whole list and there was no term without a name.

    I then checked the product 73010 and found that Packing was not assigned to this product either.

    I tried running the index again then it generated another error on “formula”

    I opened the term using the id and witnessed that the name is already there.

    wpsolr
    Keymaster
    4 years, 11 months ago #11968

    Can I see a screenshot of term 8680?

    4 years, 11 months ago #11969

    term 8680

    wpsolr
    Keymaster
    4 years, 11 months ago #11970

    Broken image.

    4 years, 11 months ago #11971

    Removed the custom image field from the taxonomy

    Retried indexing got error this time for Formula 531 screenshot attached formula 531

    Screenshot of formula ID 531 531 edit formula screenshot

    wpsolr
    Keymaster
    4 years, 11 months ago #11972

    All you screenshots are broken.

    wpsolr
    Keymaster
    4 years, 11 months ago #11974

    Use
    throw new \Exception( sprintf( "WPSOLR: term %s for taxonomy %s has no name: %s", $term_parent_id, $parent, print_r( $term_parent, true ) ) );
    to display the term content on error

    4 years, 11 months ago #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 )

    4 years, 11 months ago #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)

    wpsolr
    Keymaster
    4 years, 11 months ago #11977

    My mistake, my work around should test properties, not methods:

    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 ) ) );
    }
Viewing 15 posts - 46 through 60 (of 76 total)

You must be logged in to reply to this topic.