Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
A place to collect workarounds for #1170192: Port Hierarchical Select Taxonomy Views (for exposed filters in Views) to Drupal 7 to make the other issue get to the point.
Comment | File | Size | Author |
---|---|---|---|
#23 | voorbeeld-dropdown.PNG | 40.99 KB | augustynen |
#21 | hierarchical_filters.png | 4.74 KB | Saratt |
#5 | search2.png | 11.32 KB | Yazzbe |
#4 | searchbox.png | 4.48 KB | Yazzbe |
#2 | screen.jpg | 84.97 KB | dgastudio |
Comments
Comment #1
gabriel.camby CreditAttribution: gabriel.camby commentedHey there,
I'm posting a workaround based on Tim Sherratt rewrite of the original workaround using jQuery. It transforms a select list to a multiple select list with sub categories. You need to configure Hierachical Select to display your list like this:
Cat 1
-Subcat 11
-Subcat 12
Cat 2
-Subcat 21
-Subcat 22
This workaround use the dash separator to parse the vocabulary structure; it's its only weakness I think. I tweaked it a bit to make it work on most browsers; mostly the "selected" part and wrapped it up in a Drupal behavior for those ajax views.
Voila; feel free to use it by changing the jQuery selector
#edit-field-categories
to your liking. Load the javascript on your Drupal either via template (drupal_add_js(file.js);
or<script/>
)or via .info file.Comment #2
dgastudio CreditAttribution: dgastudio commentedsoon on codecanyon
Comment #3
dgastudio CreditAttribution: dgastudio commentedViews Hierarchical Taxonomy Filter
Views Hierarchical Taxonomy Filter extends Views with an option of using hierarchical taxonomy select in a capacity of the exposed filter.
The module adds to Views a special filter that enables selecting taxonomy terms of the specified vocabulary consecutively.
The selection considers terms hierarchy and uses AJAX for set of “select” type fields, in which a value of each next depends on the value of the previous.
It works in combination with other taxonomy filters, including the same filter, used for the other vocabulary
Comment #4
Yazzbe CreditAttribution: Yazzbe commentedHi Kervi,
I just went to CodeCanyon and bought your module. With 2 or 3 dependent select lists this works great :)
BUT if we combine it with a keyword search (text box) in the same views exposed filter (see attach search box), then we get a nasty AJAX error :(
PDOException: You cannot serialize or unserialize PDO instances in DrupalDatabaseCache->set() (line 463 of /host/artmania/mydrupal.be/public/includes/cache.inc).
Is there a workaround for this ?
Many thanks,
Yazzy
Comment #5
Yazzbe CreditAttribution: Yazzbe commentedSorry Kervi, another issue ...
When I have 2 search blocks on the same page (in the same region) then the values are pickup by both boxes simultaniously (see attach) if they use the same taxonomy. So the dependent listboxes are not populated correctly.
I see in the html code that the id's of select lists using the same taxonomy terms are identical, across different search blocks.
Is there a way to make the id's of form fields using the same taxonomy terms unique, so multiple search boxes can be used on the same page?
thanks
Yazzy
Comment #6
Barto.G CreditAttribution: Barto.G commentedNot perfect but free
https://github.com/guizmo/Multi-step-select-list-for-nested-taxonomy-as-...
Comment #7
dgastudio CreditAttribution: dgastudio commentedthank you for the report, i'll work on it.
Comment #8
liminu CreditAttribution: liminu commented#1 works, i change #edit-field-categories and #edit-field-docu-categories with the id of the select.
Thanks
Comment #9
emberhxc CreditAttribution: emberhxc commentedHi guys,
I'm also using kervi's module, and i'm having two problems:
first, it returns a Strict Warning/Strict Standards
Declaration of views_hst_filter_handler_filter::exposed_validate() should be compatible with that of views_handler::exposed_validate()
And second, i get and incompatibility with the better exposed filter module, because it doesn't have a filter identifier... anyone know how to work around this?
Comment #10
dkre CreditAttribution: dkre commentedThanks G4be, really nice solution.
From my testing this good in FF/Chrome and IE9-7.
Comment #11
osorkon5513 CreditAttribution: osorkon5513 commentedHello,
Thanks for the script. I implement it on my site, but I have a problem when the list is as follows:
Cat 1
-Subcat 11
--Subcat 111
-Subcat 12
--Subcat 121
Cat 2
-Subcat 21
--Subcat 211
-Subcat 22
--Subcat 221
Can you help me!!!
Comment #12
osorkon5513 CreditAttribution: osorkon5513 commented#1
Hello,
Thanks for the script. I implement it on my site, but I have a problem when the list is as follows:
Cat 1
-Subcat 11
--Subcat 111
-Subcat 12
--Subcat 121
Cat 2
-Subcat 21
--Subcat 211
-Subcat 22
--Subcat 221
Can you help me!!!
Comment #13
danielnolde CreditAttribution: danielnolde commented#3 is a blatant violation of both GPL with legal relevancy and a horrible misbehaviour of community rules. Having a fix of open source software ready and not contributing it back but instead withholding it illegally and trying to close-source it to earn money from selling has to be contributed back by contract (GPL) is contrary to our beliefs and rules and can't be tolerated in any way.
@Admins/Mods and @Maintainer: Please care so that #3 is removed from this issue.
Has already bought someone the code in #3 and can post it here if it's good? Would helpful and be totally legal!! => GPL!
Comment #14
infines CreditAttribution: infines commented@danielnolde This has already been discussed and resolved about in another issue. Please try to stay to the issue at hand. Here is the other issue:
http://drupal.org/node/1170192
Comment #15
osorkon5513 CreditAttribution: osorkon5513 commentedif you want to work with a select deep 3 example:
Category1
-SubCategory11
- SubSubCategory111
-SubCategory12
- SubSubCategory121
Category2
-SubCategory21
- SubSubCategory211
-SubCategory22
- SubSubCategory221
Just change the counter:
Thanks g4be for your script
Comment #16
chandan.drupalchamp CreditAttribution: chandan.drupalchamp commentedI need also 3 level dependent categories and i have used filter-hierarchy-select.js but i have not result.
may you please say how I'll use it.
Thanks
Comment #17
chandan.drupalchamp CreditAttribution: chandan.drupalchamp commentedI need also 3 level dependent categories and i have used filter-hierarchy-select.js but i have not result.
may you please say how I'll use it.
Thanks
Comment #18
augustynen CreditAttribution: augustynen commentedYes, I need the 3 level to,
it's a beauty this one: http://codecanyon.net/item/views-hierarchical-taxonomy-filter/full_scree...
If i just knew where to start to get this one working
Ohw, sorry, i would have to buy it.
And so strange, that for something that's working on the nodepages, but not in views, I just can't believe that something like this is SOW complicated.
I have a solution for 2 levels but I can't get it to work for 3 levels.
Just put the code in the head of your page (html.tpl.php).
But it's like I said, a 2 level solution.
Is there any one that can help me?
Comment #19
augustynen CreditAttribution: augustynen commentedReally, somebody that can help me make this script work for 3 levels?
I can read and edit a little bit PHP, but something big like this... I don't know how to do that.
I think that people would be happy to see it working for 3 levels.
Please?
Comment #20
augustynen CreditAttribution: augustynen commentedI already made some changes to it. But they result in not working of the script at all.
The thing is the middle child can be a value, when there are 3 levels.
But when I copy the line with .attr('text', level2Label); I get a syntax error. Really don't get it how you do this...
Comment #21
Saratt CreditAttribution: Saratt commentedI have been using the following script(from this thread or found it in another thread) for many views now. It works perfectly for 3 levels. All you have to change is the id of the first dropdown in line 4, where I have #edit-term-node-tid-depth.
Preface: In my case I have a view with an exposed filter. For example this is part of the filter before I use the script.
Financial Management
-Travel
--Travel Management Center(TMC).
I attached the result that I get when I use the script in the view.
Comment #22
augustynen CreditAttribution: augustynen commentedLooks fantastic that .png, st455.
Don't get it to work thoug....
I guesse it has something to do with:
What do I do with this ID's ?
I've putted the code in my HEAD.
Do i have to put it somewhere else?
Comment #23
augustynen CreditAttribution: augustynen commentedAlright, sow i didn't put a jquery library for it:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
But now I got something else.
I have a dropdown menu that shows one option: all terms from all levels just right behind each other...
Very strange....
My code looks like:
End in my I put:
End now nothing sows up any more.
What do I do wrong?
Comment #24
augustynen CreditAttribution: augustynen commentedI FOUND IT
OOOH
@st455 I could kiss you right now.
I just deleted the "---" in the taxonomy options and there it gose !
IT WORKED
HOERA - we say in Belgium !
Comment #25
Saratt CreditAttribution: Saratt commented@augustynen I am glad it worked.
You can basically delete this. I had to add this for the view that I was working on. The hierarchical select has nothing to do with these lines.
Comment #26
augustynen CreditAttribution: augustynen commented@st455 okay, thanks a lot !
Comment #27
benjmarr CreditAttribution: benjmarr commented@st455 this is great!! well done.
I had a question for you. Is it possible when only the parent is selected that it shows all child terms in the result?
Thanks Again
Comment #28
Saratt CreditAttribution: Saratt commented@brandercreative I am not sure I understand your question right, but I think that is how it works. For example, the first level of dropdowns might show something like this.
Ford
Honda
Toyota
Only when you select one of these items a second dropdown should show up with the corresponding children. Until you select a term in the first dropdown, you dont see another dropdown. And only when you select a result in the second dropdown you will see a third dropdown with the corresponding grand children (if your list has 3 levels). Let me know if that answers your question.
Comment #29
benjmarr CreditAttribution: benjmarr commented@st455 yep that works as required this is what im after though
Say we have this structure-
Honda
-Civic
-CRV
-Prelude
-Odyssey
When i select honda it gives me the children and also the first term being - Choose- (see below)
What i need to happen is when i dont select a child (Leave select box on -choose-) from the parent it returns all children under that parent in the result.
Make Sense?
Comment #30
benjmarr CreditAttribution: benjmarr commentedAny Ideas? Is there another way to accomplish this? Is this code capable of being tweaked to add this functionally?
Comment #31
Saratt CreditAttribution: Saratt commented@brandercreative, that depends on how you have the view setup, in the view if the exposed filter is Content:Has taxonomy terms with depth and in settings if you have depth > 1 it will return the children. Let me know if that helps.
Comment #32
benjmarr CreditAttribution: benjmarr commentedunfortunately my view is showing profiles not content which removes
Content:Has taxonomy terms with depth
from the list of possible filters. Im going to look into wether its possible to rework the filter to work for profiles too.
Cheers
Comment #33
stefan.r CreditAttribution: stefan.r commentedComment #34
jatinkumar1989 CreditAttribution: jatinkumar1989 commented#1, works for me,
i change #edit-field-categories and #edit-field-docu-categories with the id of the select.
Thanks a lot :) @gabriel.camby
Comment #35
gumanov CreditAttribution: gumanov commentedIf anyone is still looking for a workaround for HS Views integrations, here's what seems to work pretty good for me:
I installed both HS, and SHS (Simple Hierarchial Select).
SHS has decent Views integration, but it's missing some features I use in HS - so I am using both.
I modified SHS slightly, the portion of the code that identifies all fields that have the taxonomy_shs widget type.
I simply added an OR statement, to also include the taxonomy_hs widget types. This way SHS will be available as an exposed filter in Views to both HS as well as SHS fields.
file: shs.module, line 754, before
file: shs.module, line 754, after
if (($instance['widget']['type'] == 'taxonomy_shs') || ($instance['widget']['type'] == 'taxonomy_hs')) {
and
file shs.module, line 762, before
if ($instance['widget']['type'] == 'taxonomy_shs') {
file shs.module, line 762, after
if (($instance['widget']['type'] == 'taxonomy_shs') || ($instance['widget']['type'] == 'taxonomy_hs')) {
I don't know if this is a great idea, I'm not a coding guru. But no issues so far :)
Comment #36
Proteo CreditAttribution: Proteo as a volunteer commented@gumanov wow, it works beautifully! Thanks a lot.
FYI, in the latest version of SHS the lines you need to modify are 1086 and 1094 respectively, inside the _shs_get_instances() function.