0

I have a content type called Specifications which has 4 fields

  • Engine Specifications
  • Features Specifications
  • Variation (exposable filter)
  • Model

I also have another content type called Cars which has 1 field called Model too.

I am created a SpecificationsView which displays the content-type Specifications as a block in Cars.

Is it possible to show in each Car the Specifications whose model matches the current ''Car'' node's model?

0

I have done it using entity reference module and some php code in views. All you need to do is use entity reference module make a view that list model taxonomy terms as entity reference display.

Then you need to add a er(entity reference) field in both content type and input in that view you just made then make another view that list specification fields add a relationship to add entity reference model field add a contextual filter taxonomy term id in provide a default value choose PHP code and paste this code :

$nid = arg(1);
$node = node_load($nid);
$term  = $node->field_model['und']['0']['entity']->tid;
return $term; 

Or refine this code by yourself.

  • 1
    Use [LANGUAGE_NONE] instead of ['und']. – NeoHQ Aug 21 '14 at 12:27

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.