WPSOLR: error on term
- ovaislak@hotmail.comParticipant4 years, 11 months ago #11963
Got this error now
WPSOLR: term 8680 for taxonomy packing has no name
ovaislak@hotmail.comParticipant4 years, 11 months ago #11965You 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 ?
ovaislak@hotmail.comParticipant4 years, 11 months ago #11967sorry, 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.
ovaislak@hotmail.comParticipant4 years, 11 months ago #11969ovaislak@hotmail.comParticipant4 years, 11 months ago #11971Removed the custom image field from the taxonomy
Retried indexing got error this time for Formula 531 screenshot attached
Screenshot of formula ID 531
ovaislak@hotmail.comParticipant4 years, 11 months ago #11973ovaislak@hotmail.comParticipant4 years, 11 months ago #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 )
ovaislak@hotmail.comParticipant4 years, 11 months ago #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)wpsolrKeymaster4 years, 11 months ago #11977My 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 ) ) ); }
You must be logged in to reply to this topic.