Hi WimLeers,
I remember bumping into a support request in HS issue queue that asked how to hierarchicaly relate several different fields. And you advised him/her to create a single vocabulary and arrange taxonomy terms within it hierarchically, so as to use HS. That is what I've done.
So in my content profile creation form I have the following HS taxonomy tree:
Country >> Region >> City >> Company >> Division
But all of these print as taxonomy terms and the first 3 levels are pretty confusing. So I would like to print only the last 2 levels: Company >> Division
How can I do that???

Thanks in advice - I'm sure many others will find the solution posted here useful.

Comments

wim leers’s picture

Assigned: Unassigned » wim leers
Status: Active » Fixed

It's documented. README.txt, the "Rendering hierarchy lineages when viewing content" section.

drupalina’s picture

Status: Fixed » Needs work

Lets's say I want to print Company >> Division at the begning of the node, and then Country >> Region >> City at the end of the node.
The readme.txt code doesn't answer how to print only the last 2 item or the first 3 items in the lineage. It only tells us how to print the lineage. And that's why I posted this Support Request.

The code, which I presume we should put in node-nodetype.tpl.php needs some sort of DELTAs or something like that. No?

  <?php if ($taxonomy):
    require_once(drupal_get_path('module', 'hierarchical_select') . '/includes/common.inc');
    $vid = 2;                                                    // Vocabulary ID. CHANGE THIS!
    $config_id = "taxonomy-$vid";                                // Generate the config ID.
    $config = hierarchical_select_common_config_get($config_id); // Get the Hierarchical Select configuration through the config ID.
    $config['module'] = 'hs_taxonomy';                           // Set the module.
    $config['params']['vid'] = $vid;                             // Set the parameters.
  ?>
    <div class="terms"><?php print theme('hierarchical_select_selection_as_lineages', $node->taxonomy, $config); ?></div>
  <?php endif; ?>

And my question was -- what kind of code should we put in the code above, in order to make it print the last 2 items or the first 3?

And this is not documented and it should be IMHO -- at least in this forum, so that others facing a similar problem can Google for it and find a solution.

wim leers’s picture

Status: Needs work » Fixed

This is not a forum, this is the issue queue.

If you want to print just the last two levels, then create your own theme function, but start from theme_hierarchical_select_selection_as_lineages(). That's how it works in general in Drupal :)

drupalina’s picture

thanks for the pointer ;)

Status: Fixed » Closed (fixed)

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