hi,

i was wondering if it is possible (and if so how) to use hierarchical select to only give one taxonomy selection. i have a scenario where i have child terms each with multiple parent terms. i'd like to use the hierarchical select taxonomy views filter but only for the parent terms in some instances. there are other instances where i will have a very similar view where the option for child terms is required. the setup with child terms is quite simple (though i am sometimes getting an odd issue where an error pops up -
warning: array_merge() [function.array-merge]: Argument #2 is not an array in /var/www/html/DDO/sites/all/modules/views/includes/handlers.inc on line 590.
- and then the hierarchical select shows all 5 instances of the child term as optional dropdowns following a single parent term. it's odd, but happens rarely.

is there anyway to limit the child terms out for certain views?

Comments

Wim Leers’s picture

Assigned: Unassigned » Wim Leers
Status: Active » Postponed (maintainer needs more info)

You can do that, but you'll have to write some code. In fact, you'll have to write a new implementation of the HS API, based on the implementation for Taxonomy. Probably that's too much work. If you're willing to sponsor it, I could write it for you though.

The error you're referring to is probably related to this issue: #588612: Error when Hierarchical Select in Views with exposed filters, so let's keep that there.

jaron’s picture

i wouldn't know how to write the new implementation of it (not much of a programmer). what's involved in sponsoring it? would i need to know a lot about php (see last comment). i'm not adverse to it, just want to make sure i could do a good job with it.

Wim Leers’s picture

On the day you made that comment, I committed the port of the HS Content Taxonomy module. That implementation of the HS API does have a 'depth' parameter, which supports exactly what you need.

However, HS Content Taxonomy Views has not yet been ported. And that 'depth' setting is only available through the Content Taxonomy Field configuration UI (and is then transferred automatically to the HS configuration).
So, in order to allow for you to configure the depth for each HS Taxonomy exposed filter, we would need to do the following:
- transfer the 'depth' functionality from HS Content Taxonomy to HS Taxonomy
- make this configurable in the UI of HS Taxonomy Views

Wim Leers’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Closing due to lack of response. Feel free to reopen!

dgastudio’s picture

example of taxonomy lineage: country-region-city-street-number

Is it possible in views to:
- add node title.
- add content taxonomy field (hierarchical select)
- select depth (for example: 2)
- add the same taxonomy field again
- select different depth (for example: 5)

in output have: title | region | number.

???

p.d. sorry for my english.

Vuds’s picture

Title: only one selection as an option » option to limit the terms depth displayed
Status: Closed (fixed) » Active

Reopening... I am needing that.

I could write a patch, but I'd like to have some initial help since there is a long time I don't play with HS code. Mainly indications of functions to look in and copy/adapt then to this situation.

Or, if this can transform it in an easier task, I had found the "Taxonomy: limit exposed dropdown by term depth" (http://drupal.org/project/tax_depth_lim_filter) module. It'd have to be adapted also to work with HS (initially it works with common dropdown or Autocomplete), but I saw that code and it's less complex than HS and it works well for its proposition (with the patch http://drupal.org/node/962732).

But I'm really needing the issue. I have a 3-depth taxonomy with more than 1000 terms, but I just really need to display 2 depths in a view exposed filter. On top of that, this filter will go in all site pages. If I choose to use dropdown even with limit, it'd add me at least 100kB more per page!

Wim Leers’s picture

Category: support » feature
Priority: Normal » Minor
Status: Active » Needs work

Look at the hs_content_taxonomy implementation, that implementation supports depth limiting.

Note that I won't support this in the UI.