I have 3 vocabularies that are being used. Let's call them Place, Animal and Colour. I have a "base" menu setup in Taxonomy Filter that shows a filter menu for Colour on term listings from Place and Animal.

Going to taxonomy term pages from the vocabs Place, Animal or any combinations of Place, Animal & Colour gives me the correct Taxonomy Filter Menu and these pages show up correctly too.

But going to a term page that only has a term from Colour gives me an error up top in The Red Box of Dissapointment "warning: Invalid argument supplied for foreach() in .../sites/all/modules/taxonomy_filter/taxonomy_filter.module on line 221."

Comments

OneTwoTait’s picture

I got the same error again... simpler scenario.

VocabA is used in the filter on the term pages for VocabB

On term pages of VocabA, the error shows up.
On the page that actually shows the filter (term pages of VocabB), it's fine.

Both pages that showed errors had "Tags" checked on ...admin/content/taxonomy/edit/vocabulary/...

christiaan_’s picture

Encountered the same issue. Not a PHP coder at all - but seems like the issue is that the array $sections_info is "0" on pages that the block should not appear.
Added this bit of code to count the items in the array $sections_info and check if the number of items is not equal to "0", in the 'taxonomy_filter.module' file just before line 221 :

$count_sections_info = count($sections_info);
  if ($count_sections_info != 0){

So line 221-237 of 'taxonomy_filter.module' should read :


  $count_sections_info = count($sections_info);
  if ($count_sections_info != 0){
	  foreach ($sections_info as $section_info) {
		$module = $section_info['module'];
		$items = taxonomy_filter_invoke($module, 'tf_section', $section_info, $block['info']);
		$section = array(
		  'title' => $section_info['section_title'],
		  'items' => $items,
		  'info' => $section_info,
		);
		drupal_alter('tf_section', $section, $block['info']);
		$block['sections'][] = $section;
	  }
  }
  drupal_alter('tf_block', $block);
  return $block;
}

This worked for me.

solotandem’s picture

Assigned: Unassigned » solotandem
Status: Active » Needs review

This should be fixed in the latest dev release.

solotandem’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.