1

I am not sure where to begin except experimenting with contextual filters which is not getting me very far. I am trying to display taxonomy terms in a block based on if a certain field has the same info that is on the same taxonomy page.

For example

Current term page = Radioshack
Radioshack has the fields: 
Term Field City: San diego
Term Field Type: Electronic

And the terms I want to list would be 
Term: Frys Electronics
Term Field City: San Diego
Term Field Type: Electronics Store

Term: Best Buy
Term Field City: La Jolla
Term Field Type: Electronics Store

So if you notice they all have the same type which is electronic store so it would display those 2 terms on the current page which is radioshack and any other terms with the same type electronics

1

I was able to get this done by adding my code in into my contextual filter which would be Taxonomy Term:[You term field name].

This is the code I used.

$path = drupal_get_path_alias($_GET['q']);
$path = explode('/', $path);
$termname = array_pop($path);
$termname = str_replace("-", " ", $termname);
$terms = taxonomy_get_term_by_name($termname );
$term = reset($terms);
$term->tid;
$term_list = taxonomy_term_load($term->tid);
return $term_list->field_companies_industry['und']['0']['value'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.